X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_svc.cgi;h=b80118f898fe7cc2c051169e77667fffd295287d;hp=d0cc9b64553dc72fcc23c41cdc55afd0096c2375;hb=aad287228dfbe5ef01be73ebaaa9a06dfbe11226;hpb=50dbca8812cac271c584cbe5629d4583cd11a01c diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index d0cc9b645..b80118f89 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,249 +1,285 @@ - -<% - my $part_svc; - my $clone = ''; - if ( $cgi->param('error') ) { #error - $part_svc = new FS::part_svc ( { - map { $_, scalar($cgi->param($_)) } fields('part_svc') - } ); - } elsif ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {#clone - #$cgi->param('clone') =~ /^(\d+)$/ or die "malformed query: $query"; - $part_svc = qsearchs('part_svc', { 'svcpart'=>$1 } ) - or die "unknown svcpart: $1"; - $clone = $part_svc->svcpart; - $part_svc->svcpart(''); - } 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" &> +<& /elements/menubar.html, + 'View all service definitions' => "${p}browse/part_svc.cgi" #" onLoad=\"visualize()\"" -%> - -<%= header("$action Service Definition", - menubar( 'Main Menu' => $p, - 'View all service definitions' => "${p}browse/part_svc.cgi" - ), - ) -%> - -<% if ( $cgi->param('error') ) { %> -Error: <%= $cgi->param('error') %> -<% } %> +&> -
+<& /elements/init_overlib.html &> - Service Part #<%= $part_svc->svcpart ? $part_svc->svcpart : "(NEW)" %> -

-Service
-Disable new orders {disabled} eq 'Y' ? ' CHECKED' : '' %>>
- -
-Services are items you offer to your customers. - -For the selected table, you can give fields default or fixed (unchangable) -values. For example, a SLIP/PPP account may have a default (or perhaps fixed) -slipip of 0.0.0.0, while a POP mailbox will probably have a fixed -blank slipip as well as a fixed shell something like /bin/true or -/usr/bin/passwd.

-<% -#these might belong somewhere else for other user interfaces -#pry need to eventually create stuff that's shared amount UIs -my %defs = ( - 'svc_acct' => { - 'dir' => 'Home directory', - 'uid' => 'UID (set to fixed and blank for dial-only)', - 'slipip' => 'IP address (Set to fixed and blank to disable dialin, or, set a value to be exported to RADIUS Framed-IP-Address. Use the special value 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' => { - desc => 'Username', - type => 'disabled', - }, - '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', - }, - 'usergroup' => { - desc =>'ICRADIUS/FreeRADIUS groups', - type =>'radius_usergroup_selector', - }, - }, - 'svc_domain' => { - 'domain' => 'Domain', - }, - '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' => '', - }, - 'svc_broadband' => { - 'actypenum' => 'This is the actypenum that refers to the type of AC that can be provisioned for this service. This field must be set fixed.', - 'speed_down' => 'Maximum download speed for this service in Kbps. 0 denotes unlimited.', - 'speed_up' => 'Maximum upload speed for this service in Kbps. 0 denotes unlimited.', - 'acnum' => 'acnum of a specific AC that this service is restricted to. Not required', - 'ip_addr' => 'IP address. Leave blank for automatic assignment.', - 'ip_netmask' => 'Mask length, aka. netmask bits. (Eg. 255.255.255.0 == 24)', - 'mac_addr' => 'MAC address which is used by some ACs for access control. Specified by 6 colon seperated hex octets. (Eg. 00:00:0a:bc:1a:2b)', - 'location' => 'Defines the physically location at which this service was installed. This is not necessarily the billing address', - }, -); + + + + + +Service Part #<% $part_svc->svcpart ? $part_svc->svcpart : "(NEW)" %> + +<& /elements/tr-input-locale-text.html, + 'object' => $part_svc, + 'cgi' => $cgi, + 'field' => 'svc', + 'label' => 'Service', + 'curr_value' => $hashref->{svc}, +&> +%# +%# +%# +%# + +<& /elements/tr-select-part_svc_class.html, curr_value=>$hashref->{classnum} &> + + + + - $html .= '
'; - $html; + + + + + + + + +
Service
Self-service access + + +
Disable new orders + {disabled} eq 'Y' ? ' CHECKED' : '' %>>
Preserve this service on package cancellation + {'preserve'} eq 'Y' ? ' CHECKED' : '' %>> 
+ + + +
+ +Table <% $widget->html %> + +<& /elements/footer.html &> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $conf = FS::Conf->new; +my $part_svc; +my $clone = ''; +if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {#clone + #$cgi->param('clone') =~ /^(\d+)$/ or die "malformed query: $query"; + $part_svc = qsearchs('part_svc', { 'svcpart'=>$1 } ) + or die "unknown svcpart: $1"; + $clone = $part_svc->svcpart; + $part_svc->svcpart(''); +} 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'; + + +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' => 960, + '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' => 'SvcEditMain', + #'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 { + include('elements/part_svc_column.html', + shift, + 'part_svc' => $part_svc, + 'clone' => $clone + ) + } +); + - }, - ); -%> -Table <%= $widget->html %> - -