summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2006-10-25 02:22:33 +0000
committerjeff <jeff>2006-10-25 02:22:33 +0000
commitc84d872fdca241d798cc988b44c63d5ac0ea8ead (patch)
tree64d81be3eb8c843e134501da355af4fec612d798
parentdf4a30e2813c3be288747cd2a5fa2fa3ed15a248 (diff)
limited domain select
-rw-r--r--FS/FS/part_svc.pm6
-rw-r--r--FS/FS/part_svc_column.pm4
-rwxr-xr-xhttemplate/browse/part_svc.cgi1
-rwxr-xr-xhttemplate/edit/part_svc.cgi27
-rwxr-xr-xhttemplate/edit/svc_acct.cgi9
5 files changed, 38 insertions, 9 deletions
diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm
index 2587347..fc5258f 100644
--- a/FS/FS/part_svc.pm
+++ b/FS/FS/part_svc.pm
@@ -544,6 +544,12 @@ sub process {
$param->{ $svcdb.'__'.$_ } =
delete( $param->{ $svcdb.'__'.$_.'_classnum' } );
}
+ if ( $param->{ $svcdb.'__'.$_.'_flag' } =~ /^S$/ ) {
+ $param->{ $svcdb.'__'.$_} =
+ ref($param->{ $svcdb.'__'.$_})
+ ? join(',', @{$param->{ $svcdb.'__'.$_ }} )
+ : $param->{ $svcdb.'__'.$_ };
+ }
( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' );
}
@fields;
diff --git a/FS/FS/part_svc_column.pm b/FS/FS/part_svc_column.pm
index fb08eaa..d2b8fd9 100644
--- a/FS/FS/part_svc_column.pm
+++ b/FS/FS/part_svc_column.pm
@@ -41,7 +41,7 @@ fields are currently supported:
=item columnvalue - default or fixed value for the column
-=item columnflag - null or empty (no default), `D' for default, `F' for fixed (unchangeable), `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded.
+=item columnflag - null or empty (no default), `D' for default, `F' for fixed (unchangeable), `S' for selectable choice, `M' for manual selection from inventory, or `A' for automatic selection from inventory. For virtual fields, can also be 'X' for excluded.
=back
@@ -91,7 +91,7 @@ sub check {
;
return $error if $error;
- $self->columnflag =~ /^([DFMAX])$/
+ $self->columnflag =~ /^([DFSMAX])$/
or return "illegal columnflag ". $self->columnflag;
$self->columnflag(uc($1));
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi
index 0113263..7953935 100755
--- a/httemplate/browse/part_svc.cgi
+++ b/httemplate/browse/part_svc.cgi
@@ -5,6 +5,7 @@
% '' => '',
% 'D' => 'Default',
% 'F' => 'Fixed (unchangeable)',
+% 'S' => 'Selectable choice',
% #'M' => 'Manual selection from inventory',
% 'M' => 'Manual selected from inventory',
% #'A' => 'Automatically fill in from inventory',
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index 595d7b8..cc9145f 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -73,17 +73,20 @@ that field.
% select_table => 'svc_acct_pop',
% select_key => 'popnum',
% select_label => 'city',
+% disable_select => 1,
% },
% 'username' => {
% desc => 'Username',
% type => 'text',
% disable_default => 1,
% disable_fixed => 1,
+% disable_select => 1,
% },
% 'quota' => {
% desc => '',
% type => 'text',
% disable_inventory => 1,
+% disable_select => 1,
% },
% '_password' => 'Password',
% 'gid' => 'GID (when blank, defaults to UID)',
@@ -93,6 +96,7 @@ that field.
% type =>'select',
% select_list => [ $conf->config('shells') ],
% disable_inventory => 1,
+% disable_select => 1,
% },
% 'finger' => 'Real name (GECOS)',
% 'domsvc' => {
@@ -102,15 +106,18 @@ that field.
% select_key => 'svcnum',
% select_label => 'domain',
% disable_inventory => 1,
+% disable_select => 1,
% },
% 'usergroup' => {
% desc =>'RADIUS groups',
% type =>'radius_usergroup_selector',
+% disable_select => 1,
% disable_inventory => 1,
% },
% 'seconds' => { desc => '',
% type => 'text',
% disable_inventory => 1,
+% disable_select => 1,
% },
% },
%
@@ -148,11 +155,13 @@ that field.
% 'countrycode' => { desc => 'Country code',
% type => 'text',
% disable_inventory => 1,
+% disable_select => 1,
% },
% 'phonenum' => 'Phone number',
% 'pin' => { desc => 'Personal Identification Number',
% type => 'text',
% disable_inventory => 1,
+% disable_select => 1,
% },
% },
%
@@ -200,6 +209,10 @@ that field.
% 'condition' =>
% sub { ref($_[0]) && $_[0]->{disable_fixed} },
% },
+% 'S' => { 'desc' => 'Selectable Choice',
+% 'condition' =>
+% sub { !ref($_[0]) || $_[0]->{disable_select} },
+% },
%# need to template-ize httemplate/edit/svc_* first
%# 'M' => { 'desc' => 'Manual selection from inventory',
%# 'condition' => $inv_sub,
@@ -329,7 +342,7 @@ that field.
% " what.form.${layer}__${field}_classnum.disabled = true;".
% " what.form.${layer}__${field}_classnum.style.backgroundColor = '#dddddd';".
% " }".
-% ' } else if ( f == "D" || f == "F" ) { //enable, text box',
+% ' } else if ( f == "D" || f == "F" || f =="S" ) { //enable, text box',
% " what.form.${layer}__${field}.disabled = false;".
% " what.form.${layer}__${field}.style.backgroundColor = '#ffffff';".
% " what.form.${layer}__${field}.style.display = '';".
@@ -384,20 +397,22 @@ that field.
%
% } elsif ( $def->{type} eq 'select' ) {
%
-% $html .= qq!<SELECT NAME="${layer}__${field}" $disabled>!;
+% $html .= qq!<SELECT NAME="${layer}__${field}" $disabled!;
+% $html .= ' multiple' if $flag == 'S';
+% $html .= '>';
% $html .= '<OPTION> </OPTION>' unless $value;
% if ( $def->{select_table} ) {
% foreach my $record ( qsearch( $def->{select_table}, {} ) ) {
% my $rvalue = $record->getfield($def->{select_key});
% $html .= qq!<OPTION VALUE="$rvalue"!.
-% ( $rvalue==$value ? ' SELECTED>' : '>' ).
-% $record->getfield($def->{select_label}). '</OPTION>';
+% (grep(/^$rvalue$/, split(',',$value)) ? ' SELECTED>' : '>' ).
+% $record->getfield($def->{select_label}). '</OPTION>';
% } #next $record
% } else { # select_list
% foreach my $item ( @{$def->{select_list}} ) {
% $html .= qq!<OPTION VALUE="$item"!.
-% ( $item eq $value ? ' SELECTED>' : '>' ).
-% $item. '</OPTION>';
+% (grep(/^$item$/, split(',',$value)) ? ' SELECTED>' : '>' ).
+% $item. '</OPTION>';
% } #next $item
% } #endif
% $html .= '</SELECT>';
diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi
index 60ca24d..097e8c2 100755
--- a/httemplate/edit/svc_acct.cgi
+++ b/httemplate/edit/svc_acct.cgi
@@ -216,7 +216,14 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR>
% }
% }
%
-% if ($cust_pkg && !$conf->exists('svc_acct-alldomains') ) {
+% if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'S' ) {
+% foreach my $domain
+% (split(',',$part_svc->part_svc_column('domsvc')->columnvalue)) {
+% my $svc_domain =
+% qsearchs('svc_domain', { 'svcnum' => $domain } );
+% $svc_domain{$svc_domain->svcnum} = $svc_domain if $svc_domain;
+% }
+% }elsif ($cust_pkg && !$conf->exists('svc_acct-alldomains') ) {
% my @cust_svc =
% map { qsearch('cust_svc', { 'pkgnum' => $_->pkgnum } ) }
% qsearch('cust_pkg', { 'custnum' => $cust_pkg->custnum } );