X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_svc.cgi;h=007c246295f42394fd67b2b7593624b02410703d;hb=e513d7cb331d7c7d99d1ea7b5f0a5f8e08e0d725;hp=57ab3985e1a5ec07d46c1a0dcbd7bbd7c1bfff7f;hpb=0ab8b21b9b39d9349c94e6cea10dbb006ff176a5;p=freeside.git
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index 57ab3985e..007c24629 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -1,272 +1,493 @@
-
-<%
- my $part_svc;
- if ( $cgi->param('error') ) { #error
- $part_svc = new FS::part_svc ( {
- map { $_, scalar($cgi->param($_)) } fields('part_svc')
- } );
- } elsif ( $cgi->keywords ) { #edit
- my($query) = $cgi->keywords;
- $query =~ /^(\d+)$/ or die "malformed query: $query";
- $part_svc=qsearchs('part_svc', { 'svcpart'=>$1 } )
- or die "unknown svcpart: $1";
- } else { #adding
- $part_svc = new FS::part_svc {};
- }
- my $action = $part_svc->svcpart ? 'Edit' : 'Add';
- my $hashref = $part_svc->hashref;
- my $p_svcdb = $part_svc->svcdb || 'svc_acct';
+<& /elements/header.html, "$action Service Definition",
+ menubar('View all service definitions' => "${p}browse/part_svc.cgi"),
+ #" onLoad=\"visualize()\""
+&>
-%>
+<& /elements/init_overlib.html &>
-
+
+
+
0e0
[zero e zero] to enable export to RADIUS without a Framed-IP-Address.)',
-# 'popnum' => qq!POP number!,
- 'popnum' => {
- desc => 'Access number',
- type => 'select',
- select_table => 'svc_acct_pop',
- select_key => 'popnum',
- select_label => 'city',
- },
- 'username' => 'Username',
- 'quota' => '',
- '_password' => 'Password',
- 'gid' => 'GID (when blank, defaults to UID)',
- 'shell' => 'Shell (all service definitions should have a default or fixed shell that is present in the shells configuration file)',
- 'finger' => 'GECOS',
- 'domsvc' => {
- desc =>'svcnum from svc_domain',
- type =>'select',
- select_table => 'svc_domain',
- select_key => 'svcnum',
- select_label => 'domain',
- },
- },
- 'svc_domain' => {
- 'domain' => 'Domain',
- },
- 'svc_acct_sm' => {
- 'domuser' => 'domuser@virtualdomain.com',
- 'domuid' => 'UID where domuser@virtualdomain.com mail is forwarded',
- 'domsvc' => 'svcnum from svc_domain for virtualdomain.com',
- },
- 'svc_forward' => {
- 'srcsvc' => 'service from which mail is to be forwarded',
- 'dstsvc' => 'service to which mail is to be forwarded',
- 'dst' => 'someone@another.domain.com to use when dstsvc is 0',
- },
- 'svc_charge' => {
- 'amount' => 'amount',
- },
- 'svc_wo' => {
- 'worker' => 'Worker',
- '_date' => 'Date',
- },
- 'svc_www' => {
- #'recnum' => '',
- #'usersvc' => '',
- },
-);
+% my %vfields;
+% #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
+% # params: ( $def, $layer, $field ) (see SUB below)
+% my $inv_sub = sub {
+% $_[0]->{disable_inventory}
+% || $_[0]->{'type'} ne 'text'
+% };
+% tie my %flag, 'Tie::IxHash',
+% '' => { 'desc' => 'No default', },
+% 'D' => { 'desc' => 'Default',
+% 'condition' =>
+% sub { $_[0]->{disable_default} },
+% },
+% 'F' => { 'desc' => 'Fixed (unchangeable)',
+% 'condition' =>
+% sub { $_[0]->{disable_fixed} },
+% },
+% 'S' => { 'desc' => 'Selectable Choice',
+% 'condition' =>
+% sub { !ref($_[0]) || $_[0]->{disable_select} },
+% },
+% 'M' => { 'desc' => 'Manual selection from inventory',
+% 'condition' => $inv_sub,
+% },
+% 'A' => { 'desc' => 'Automatically fill in from inventory',
+% 'condition' => $inv_sub,
+% },
+% 'H' => { 'desc' => 'Select from hardware class',
+% 'condition' => sub { $_[0]->{type} ne 'select-hardware' },
+% },
+% 'X' => { 'desc' => 'Excluded',
+% 'condition' =>
+% sub { ! $vfields{$_[1]}->{$_[2]} },
+%
+% },
+% ;
+%
+% my @dbs = $hashref->{svcdb}
+% ? ( $hashref->{svcdb} )
+% : FS::part_svc->svc_tables();
+%
+% my $help = '';
+% unless ( $hashref->{svcpart} ) {
+% $help = ' '.
+% include('/elements/popup_link.html',
+% 'action' => $p.'docs/part_svc-table.html',
+% 'label' => 'help',
+% 'actionlabel' => 'Service table help',
+% 'width' => 763,
+% #'height' => 400,
+% );
+% }
+%
+% tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } grep dbdef->table($_), @dbs;
+% my $widget = new HTML::Widgets::SelectLayers(
+% #'selected_layer' => $p_svcdb,
+% 'selected_layer' => $hashref->{svcdb} || 'svc_acct',
+% 'options' => \%svcdb,
+% 'form_name' => 'dummy',
+% #'form_action' => 'process/part_svc.cgi',
+% 'form_action' => 'part_svc.cgi', #self
+% 'form_elements' => [qw( svc svcpart classnum selfservice_access
+% disabled preserve
+% )],
+% 'html_between' => $help,
+% 'layer_callback' => sub {
+% my $layer = shift;
+%
+% my $html = qq!!;
+%
+% #$html .= $svcdb_info;
+%
+% my $columns = 3;
+% my $count = 0;
+% my $communigate = 0;
+% my @part_export =
+% map { qsearch( 'part_export', {exporttype => $_ } ) }
+% keys %{FS::part_export::export_info($layer)};
+% $html .= '