[freeside-commits] freeside/httemplate/edit part_svc.cgi, 1.79, 1.80 part_virtual_field.html, NONE, 1.1
Erik Levinson
levinse at wavetail.420.am
Fri Jul 22 11:56:27 PDT 2011
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv17321/httemplate/edit
Modified Files:
part_svc.cgi
Added Files:
part_virtual_field.html
Log Message:
custom fields, RT11714
Index: part_svc.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_svc.cgi,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -w -d -r1.79 -r1.80
--- part_svc.cgi 21 Jun 2011 01:04:55 -0000 1.79
+++ part_svc.cgi 22 Jul 2011 18:56:24 -0000 1.80
@@ -15,20 +15,7 @@
<BR>
-
-% #YUCK. false laziness w/part_svc.pm. go away virtual fields, please
% my %vfields;
-% foreach my $svcdb ( FS::part_svc->svc_tables() ) {
-% eval "use FS::$svcdb;";
-% my $self = "FS::$svcdb"->new;
-% $vfields{$svcdb} = {};
-% foreach my $field ($self->virtual_fields) { # svc_Common::virtual_fields with a null svcpart returns all of them
-% my $pvf = $self->pvf($field);
-% $vfields{$svcdb}->{$field} = $pvf;
-% #warn "\$vfields{$svcdb}->{$field} = $pvf";
-% } #next $field
-% } #next $svcdb
-%
% #code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm
% # and generalize the subs
% # condition sub is tested to see whether to disable display of this choice
--- NEW FILE: part_virtual_field.html ---
<% include('elements/edit.html',
'name_singular' => 'custom field',
'viewall_dir' => 'browse',
'table' => 'part_virtual_field',
'labels' => { 'vfieldpart' => '',
'dbtable' => 'Table',
'name' => 'Name',
'length' => 'Length',
'label' => 'Label',
'dbtable_dummy' => 'Table',
},
'fields' => [
{ field=>'vfieldpart', type=>'hidden', },
{ field=>'name', type=>'text', },
{ field => 'dbtable',
type => 'select',
options => [ 'svc_broadband', 'router', 'cust_main', ],
},
{ field=>'label', type=>'text', },
{ field=>'length', type=>'text', },
],
'edit_callback' => $callback,
'error_callback' => $callback,
'html_init' => 'Please be patient after clicking the button as
this process may take more than 10 seconds.
<br><br>',
)
%>
<%init>
my $callback = sub {
my ($cgi, $object, $fields) = (shift, shift, shift);
my @edit_fixed_fields = qw( dbtable name length );
foreach my $f ( @{$fields} ) {
# XXX: editing anything other than label is disabled for now
$f->{type} = 'fixed'
if $object->vfieldpart && grep { $f->{field} eq $_ } @edit_fixed_fields;
}
};
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
</%init>
More information about the freeside-commits
mailing list