X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_svc.cgi;h=77011e9dd2590284d505d115ba6512f2b3332a89;hp=c5fff25e0540af19ee996759ce07c654bf98801e;hb=9608be1f5c73517fc348f1ab458892b34ed7facb;hpb=8af88c7428552043516f529007645ab489b32063
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index c5fff25e0..77011e9dd 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -38,28 +38,24 @@ Service
Disable new orders {disabled} eq 'Y' ? ' CHECKED' : '' %>>
-Services are items you offer to your customers.
-
svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts
+Service definitions are the templates for items you offer to your customers.
+
svc_acct - Accounts - anything with a username (Mailboxes, PPP accounts, shell accounts, etc.)
svc_domain - Domains
svc_forward - mail forwarding
svc_www - Virtual domain website
-
svc_broadband - Broadband/High-speed Internet service
+
svc_broadband - Broadband/High-speed Internet service (always-on)
svc_external - Externally-tracked service
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.
+values, or select an inventory class to manually or automatically fill in
+that field.
<%
-my %vfields;
-
#these might belong somewhere else for other user interfaces
#pry need to eventually create stuff that's shared amount UIs
my $conf = new FS::Conf;
@@ -77,28 +73,42 @@ my %defs = (
select_label => 'city',
},
'username' => {
- desc => 'Username',
- type => 'disabled',
+ desc => 'Username',
+ type => 'text',
+ disable_default => 1,
+ disable_fixed => 1,
+ },
+ 'quota' => {
+ desc => '',
+ type => 'text',
+ disable_inventory => 1,
},
- 'quota' => '',
'_password' => 'Password',
'gid' => 'GID (when blank, defaults to UID)',
'shell' => {
- desc =>'Shell (all service definitions should have a default or fixed shell that is present in the shells configuration file, set to blank for no shell tracking)',
+ #desc =>'Shell (all service definitions should have a default or fixed shell that is present in the shells configuration file, set to blank for no shell tracking)',
+ desc =>'Shell ( set to blank for no shell tracking)',
type =>'select',
select_list => [ $conf->config('shells') ],
+ disable_inventory => 1,
},
- 'finger' => 'GECOS',
+ 'finger' => 'Real name (GECOS)',
'domsvc' => {
desc =>'svcnum from svc_domain',
type =>'select',
select_table => 'svc_domain',
select_key => 'svcnum',
select_label => 'domain',
+ disable_inventory => 1,
},
'usergroup' => {
desc =>'RADIUS groups',
type =>'radius_usergroup_selector',
+ disable_inventory => 1,
+ },
+ 'seconds' => { desc => '',
+ type => 'text',
+ disable_inventory => 1,
},
},
'svc_domain' => {
@@ -132,6 +142,7 @@ my %defs = (
},
);
+ my %vfields;
foreach my $svcdb (grep dbdef->table($_), keys %defs ) {
my $self = "FS::$svcdb"->new;
$vfields{$svcdb} = {};
@@ -149,6 +160,37 @@ my %defs = (
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
+ # params: ( $def, $layer, $field ) (see SUB below)
+ my $inv_sub = sub {
+ ref($_[0]) && ( $_[0]->{disable_inventory}
+ || $_[0]->{'type'} ne 'text' )
+ };
+ tie my %flag, 'Tie::IxHash',
+ '' => { 'desc' => 'No default', },
+ 'D' => { 'desc' => 'Default',
+ 'condition' =>
+ sub { ref($_[0]) && $_[0]->{disable_default} },
+ },
+ 'F' => { 'desc' => 'Fixed (unchangeable)',
+ 'condition' =>
+ sub { ref($_[0]) && $_[0]->{disable_fixed} },
+ },
+ 'M' => { 'desc' => 'Manual selection from inventory',
+ 'condition' => $inv_sub,
+ },
+ 'A' => { 'desc' => 'Automatically fill in from inventory',
+ 'condition' => $inv_sub,
+ },
+ 'X' => { 'desc' => 'Excluded',
+ 'condition' =>
+ sub { ! $vfields{$_[1]}->{$_[2]} },
+
+ },
+ ;
my @dbs = $hashref->{svcdb}
? ( $hashref->{svcdb} )
@@ -174,8 +216,8 @@ my %defs = (
my @part_export =
map { qsearch( 'part_export', {exporttype => $_ } ) }
keys %{FS::part_export::export_info($layer)};
- $html .= '