diff options
Diffstat (limited to 'httemplate/edit')
27 files changed, 627 insertions, 285 deletions
diff --git a/httemplate/edit/access_group.html b/httemplate/edit/access_group.html index 11b8df7bc..d7f7667f4 100644 --- a/httemplate/edit/access_group.html +++ b/httemplate/edit/access_group.html @@ -5,6 +5,42 @@ 'groupnum' => 'Group number', 'groupname' => 'Group name', }, + 'viewall_dir' => 'browse', + + 'html_bottom' => + sub { + my $access_group = shift; + + "<BR>Group virtualized to customers of agents:<BR>". + ntable("#cccccc",2). + '<TR><TD>'. + include( '/elements/checkboxes-table.html', + 'source_obj' => $access_group, + 'link_table' => 'access_groupagent', + 'target_table' => 'agent', + 'name_col' => 'agent', + 'target_link' => $p.'edit/agent.cgi?', + 'disable-able' => 1, + ). + '</TR></TD></TABLE>'. + + "<BR>Group rights:<BR>". + ntable("#cccccc",2). + '<TR><TD>'. + include( '/elements/checkboxes-table-name.html', + 'source_obj' => $access_group, + 'link_table' => 'access_right', + 'link_static' => { 'righttype' => + 'FS::access_group', + }, + 'num_col' => 'rightobjnum', + 'name_col' => 'rightname', + 'names_list' => [ FS::AccessRight->rights() ], + ). + '</TR></TD></TABLE>' + + ; + }, ) %> diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html index 2b19dbf7b..fb2a97196 100644 --- a/httemplate/edit/access_user.html +++ b/httemplate/edit/access_user.html @@ -6,6 +6,7 @@ { field=>'_password', type=>'password' }, 'last', 'first', + { field=>'disabled', type=>'checkbox', value=>'Y' }, ], 'labels' => { 'usernum' => 'User number', @@ -13,6 +14,7 @@ '_password' => 'Password', 'last' => 'Last name', 'first' => 'First name', + 'disabled' => 'Disable employee', }, 'viewall_dir' => 'browse', 'html_bottom' => diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index 946b1087b..8de627d20 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -24,9 +24,7 @@ my $otaker = getotaker; my $p1 = popurl(1); -%> - -<%= header("Post Credit", '') %> +%><%= include('/elements/header-popup.html', 'Enter Credit') %> <% if ( $cgi->param('error') ) { %> <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> @@ -74,7 +72,7 @@ Credit </TABLE> <BR> -<CENTER><INPUT TYPE="submit" VALUE="Post credit"></CENTER> +<CENTER><INPUT TYPE="submit" VALUE="Enter credit"></CENTER> </FORM> </BODY> </HTML> diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index bb2a8618e..c3d1804bc 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -64,7 +64,11 @@ if ( $cgi->param('error') ) { @invoicing_list = (); } $cgi->delete_all(); + my $action = $custnum ? 'Edit' : 'Add'; +$action .= ": ". $cust_main->name if $custnum; + +my $r = qq!<font color="#ff0000">*</font> !; %> @@ -77,38 +81,29 @@ my $action = $custnum ? 'Edit' : 'Add'; ) %> <% if ( $error ) { %> -<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $error %></FONT> +<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $error %></FONT><BR><BR> <% } %> <FORM NAME="topform" STYLE="margin-bottom: 0"> <INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>"> -Customer # <%= $custnum ? "<B>$custnum</B>" : " (NEW)" %> - -<!-- agent --> - -<% +<% if ( $custnum ) { %> + Customer #<B><%= $custnum %></B> - + <B><FONT COLOR="<%= $cust_main->statuscolor %>"> + <%= ucfirst($cust_main->status) %> + </FONT></B> + <BR><BR> +<% } %> -my $r = qq!<font color="#ff0000">*</font> !; +<%= &ntable("#cccccc") %> -my %agent_search = dbdef->table('agent')->column('disabled') - ? ( 'disabled' => '' ) : (); -my @agents = qsearch( 'agent', \%agent_search ); -#die "No agents created!" unless @agents; -eidiot "You have not created any agents (or all agents are disabled). You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; -my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first +<!-- agent --> +<%= include('/elements/tr-select-agent.html', $cust_main->agentnum, + 'label' => "<B>${r}Agent</B>", + 'empty_label' => 'Select agent', + ) %> -<% if ( scalar(@agents) == 1 ) { %> - <INPUT TYPE="hidden" NAME="agentnum" VALUE="<%= $agentnum %>"> -<% } else { %> - <BR><BR><%=$r%>Agent <SELECT NAME="agentnum" SIZE="1"> - <% foreach my $agent (sort { $a->agent cmp $b->agent; } @agents) { %> - <OPTION VALUE="<%= $agent->agentnum %>"<%= " SELECTED"x($agent->agentnum==$agentnum) %>><%= $agent->agent %> - <% } %> - </SELECT> -<% } %> - <!-- referral (advertising source) --> <% @@ -118,28 +113,9 @@ if ( $custnum && ! $conf->exists('editreferrals') ) { <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>"> -<% - } else { - - my(@referrals) = qsearch('part_referral',{}); - if ( scalar(@referrals) == 0 ) { - eidiot "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources."; - } elsif ( scalar(@referrals) == 1 ) { - $refnum ||= $referrals[0]->refnum; -%> - - <INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $refnum %>"> - <% } else { %> - <BR><BR><%=$r%>Advertising source - <SELECT NAME="refnum" SIZE="1"> - <%= $refnum ? '' : '<OPTION VALUE="">' %> - <% foreach my $referral (sort { $a->refnum <=> $b->refnum } @referrals) { %> - <OPTION VALUE="<%= $referral->refnum %>" <%= $referral->refnum == $refnum ? 'SELECTED' : '' %>><%= $referral->refnum %>: <%= $referral->referral %> - <% } %> - </SELECT> -<% } %> + <%= include('/elements/tr-select-part_referral.html') %> <% } %> @@ -153,14 +129,26 @@ if ( $cust_main->referral_custnum ) { %> - <BR><BR>Referring Customer: - <A HREF="<%= popurl(1) %>/cust_main.cgi?<%= $cust_main->referral_custnum %>"><%= $cust_main->referral_custnum %>: <%= $referring_cust_main->name %></A> + <TR> + <TD ALIGN="right">Referring customer</TD> + <TD> + <A HREF="<%= popurl(1) %>/cust_main.cgi?<%= $cust_main->referral_custnum %>"><%= $cust_main->referral_custnum %>: <%= $referring_cust_main->name %></A> + </TD> + </TR> <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<%= $cust_main->referral_custnum %>"> <% } elsif ( ! $conf->exists('disable_customer_referrals') ) { %> - <BR><BR>Referring customer number: - <INPUT TYPE="text" NAME="referral_custnum" VALUE=""> + <TR> + <TD ALIGN="right">Referring customer</TD> + <TD> + <!-- <INPUT TYPE="text" NAME="referral_custnum" VALUE=""> --> + <%= include('/elements/search-cust_main.html', + 'field_name' => 'referral_custnum', + ) + %> + </TD> + </TR> <% } else { %> @@ -168,6 +156,8 @@ if ( $cust_main->referral_custnum <% } %> +</TABLE> + <!-- contact info --> <BR><BR> @@ -377,10 +367,10 @@ unless ( $custnum ) { #false laziness, copied from FS::cust_pkg::order my $pkgpart; + my @agents = $FS::CurrentUser::CurrentUser->agents; if ( scalar(@agents) == 1 ) { # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART - my($agent)=qsearchs('agent',{'agentnum'=> $agentnum }); - $pkgpart = $agent->pkgpart_hashref; + $pkgpart = $agents[0]->pkgpart_hashref; } else { #can't know (agent not chosen), so, allow all my %typenum; diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index a03a245eb..e7734c1fc 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -9,22 +9,20 @@ my %payby = ( 'MCRD' => 'Manual credit card', ); -my($link, $linknum, $paid, $payby, $payinfo, $quickpay, $_date); +my($link, $linknum, $paid, $payby, $payinfo, $_date); if ( $cgi->param('error') ) { $link = $cgi->param('link'); $linknum = $cgi->param('linknum'); $paid = $cgi->param('paid'); $payby = $cgi->param('payby'); $payinfo = $cgi->param('payinfo'); - $quickpay = $cgi->param('quickpay'); $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; } elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { - $link = 'custnum'; + $link = $cgi->param('popup') ? 'popup' : 'custnum'; $linknum = $1; $paid = ''; $payby = $cgi->param('payby') || 'BILL'; $payinfo = ''; - $quickpay = $cgi->param('quickpay'); $_date = time; } elsif ( $cgi->param('invnum') =~ /^(\d+)$/ ) { $link = 'invnum'; @@ -32,7 +30,6 @@ if ( $cgi->param('error') ) { $paid = ''; $payby = $cgi->param('payby') || 'BILL'; $payinfo = ""; - $quickpay = ''; $_date = time; } else { die "illegal query ". $cgi->keywords; @@ -43,9 +40,15 @@ my $paybatch = "webui-$_date-$$-". rand() * 2**32; my $title = 'Post '. $payby{$payby}. ' payment'; $title .= " against Invoice #$linknum" if $link eq 'invnum'; -%> +if ( $link eq 'popup' ) { + +%><%= include('/elements/header-popup.html', $title ) %> + +<% } else { %> -<%= include("/elements/header.html",$title, '') %> +<%= include("/elements/header.html", $title, '') %> + +<% } %> <% if ( $cgi->param('error') ) { %> <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> @@ -60,7 +63,6 @@ $title .= " against Invoice #$linknum" if $link eq 'invnum'; <FORM ACTION="<%= popurl(1) %>process/cust_pay.cgi" METHOD=POST> <INPUT TYPE="hidden" NAME="link" VALUE="<%= $link %>"> <INPUT TYPE="hidden" NAME="linknum" VALUE="<%= $linknum %>"> -<INPUT TYPE="hidden" NAME="quickpay" VALUE="<%= $quickpay %>"> <% my $money_char = $conf->config('money_char') || '$'; @@ -74,7 +76,9 @@ if ( $link eq 'invnum' ) { } %> +<% unless ( $link eq 'popup' ) { %> <%= small_custview($custnum, $conf->config('countrydefault')) %> +<% } %> <INPUT TYPE="hidden" NAME="payby" VALUE="<%= $payby %>"> diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 120c03a3c..c40a00492 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -9,13 +9,38 @@ # 'column' => 'Label', # } # - # listref - each item is a literal column name (or method) or (notyet) coderef + # listref - each item is a literal column name (or method) or hashref + # or (notyet) coderef # if not specified all columns (except for the primary key) will be editable # 'fields' => [ + # 'columname', + # { 'field' => 'another_columname', + # 'type' => 'text', #text, fixed, hidden, checkbox + # #eventually more for <SELECT>, etc. + # 'value' => 'Y', #only for checkbox + # }, # ] # # 'menubar' => '', #menubar arrayref # + # #run when re-displaying with an error + # 'error_callback' => sub { my( $cgi, $object ) = @_; }, + # + # #run when editing + # 'edit_callback' => sub { my( $cgi, $object ) = @_; }, + # + # # returns a hashref for the new object + # 'new_hashref_callback' + # + # #run when adding + # 'new_callback' => sub { my( $cgi, $object ) = @_; }, + # + # #XXX describe + # 'field_callback' => sub { }, + # + # #string or coderef of additional HTML to add before </TABLE> + # 'html_table_bottom' => '', + # # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' # # 'html_bottom' => '', #string @@ -43,15 +68,30 @@ map { $_ => scalar($cgi->param($_)) } fields($table) }); + &{$opt{'error_callback'}}($cgi, $object) + if $opt{'error_callback'}; + } elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; $object = qsearchs( $table, { $pkey => $1 } ); + warn "$table $pkey => $1" + if $opt{'debug'}; + + &{$opt{'edit_callback'}}($cgi, $object) + if $opt{'edit_callback'}; } else { #adding - $object = $class->new( {} ); + my $hashref = $opt{'new_hashref_callback'} + ? &{$opt{'new_hashref_callback'}} + : {}; + + $object = $class->new( $hashref ); + + &{$opt{'new_callback'}}($cgi, $object) + if $opt{'new_callback'}; } @@ -91,16 +131,15 @@ <%= ntable("#cccccc",2) %> -<% foreach my $f ( @$fields ) { +<% foreach my $f ( map { ref($_) ? $_ : {'field'=>$_} } + @$fields + ) { + + &{ $opt{'field_callback'} }( $f ) + if $opt{'field_callback'}; - my( $field, $type); - if ( ref($f) ) { - $field = $f->{'field'}, - $type = $f->{'type'} || 'text', - } else { - $field = $f; - $type = 'text'; - } + my $field = $f->{'field'}; + my $type = $f->{'type'} ||= 'text'; %> @@ -113,18 +152,34 @@ %> </TD> - <% - #eventually more options for <SELECT>, etc. fields - %> + <% if ( $type eq 'fixed' ) { %> + + <TD BGCOLOR="#dddddd"><%= $f->{'value'} %></TD> + <INPUT TYPE="hidden" NAME="<%= $field %>" VALUE="<%= $f->{'value'} %>"> + + <% } elsif ( $type eq 'checkbox' ) { %> + + <TD> + <INPUT TYPE="checkbox" NAME="<%= $field %>" VALUE="<%= $f->{'value'} %>" <%= $object->$field() eq $f->{'value'} ? ' CHECKED' : '' %>> + </TD> - <TD> - <INPUT TYPE="<%= $type %>" NAME="<%= $field %>" VALUE="<%= $object->$field() %>"> - <TD> + <% } else { %> + + <TD> + <INPUT TYPE="<%= $type %>" NAME="<%= $field %>" VALUE="<%= $object->$field() %>"> + <TD> + + <% } %> </TR> <% } %> +<%= ref( $opt{'html_table_bottom'} ) + ? &{ $opt{'html_table_bottom'} }( $object ) + : $opt{'html_table_bottom'} +%> + </TABLE> <%= ref( $opt{'html_bottom'} ) diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html new file mode 100644 index 000000000..c113ad645 --- /dev/null +++ b/httemplate/edit/elements/svc_Common.html @@ -0,0 +1,98 @@ +<% + + my %opt = @_; + + #my( $svcnum, $pkgnum, $svcpart, $part_svc ); + my( $pkgnum, $svcpart, $part_svc ); + + #get & untaint pkgnum & svcpart + my($query) = $cgi->keywords; #they're not proper cgi params + if ( $query =~ /^pkgnum(\d+)-svcpart(\d+)$/ ) { + $pkgnum = $1; + $svcpart = $2; + $cgi->delete_all(); #so the standard edit.html treats this correctly as new + } + +%><%= include( 'edit.html', + + 'menubar' => [], + + 'error_callback' => sub { + my( $cgi, $svc_x ) = @_; + #$svcnum = $svc_x->svcnum; + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + + $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart }); + die "No part_svc entry!" unless $part_svc; + }, + + 'edit_callback' => sub { + my( $cgi, $svc_x ) = @_; + #$svcnum = $svc_x->svcnum; + my $cust_svc = $svc_x->cust_svc + or die "Unknown (cust_svc) svcnum!"; + + $pkgnum = $cust_svc->pkgnum; + $svcpart = $cust_svc->svcpart; + + $part_svc = qsearchs ('part_svc', { svcpart=>$svcpart }); + die "No part_svc entry!" unless $part_svc; + }, + + 'new_hash_callback' => sub { + #my( $cgi, $svc_x ) = @_; + + { svcpart => $svcpart }; + + }, + + 'new_callback' => sub { + my( $cgi, $svc_x ) = @_;; + + $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart }); + die "No part_svc entry!" unless $part_svc; + + #$svcnum=''; + + $svc_x->set_default_and_fixed; + + }, + + 'field_callback' => sub { + my $f = shift; + my $columndef = $part_svc->part_svc_column($f->{'field'}); + my $flag = $columndef->columnflag; + if ( $flag eq 'F' ) { + $f->{'type'} = 'fixed'; + $f->{'value'} = $columndef->columnvalue; + } + }, + + 'html_table_bottom' => sub { + my $svc_x = shift; + my $html = ''; + foreach my $field ($svc_x->virtual_fields) { + if ($part_svc->part_svc_column($field)->columnflag ne 'F'){ + # If the flag is X, it won't even show up + # in $svc_acct->virtual_fields. + $html .= + $svc_x->pvf($field)->widget( 'HTML', + 'edit', + $svc_x->getfield($field) + ); + } + } + $html; + }, + + 'html_bottom' => sub { + qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!. + qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!; + }, + + 'debug' => 1, + + %opt #pass through/override params + ) +%> diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 57eedbc71..32a3f2df0 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -139,13 +139,21 @@ my $money_char = $conf->config('money_char') || '$'; tie my %events, 'Tie::IxHash', 'fee' => { - 'name' => 'Late fee', + 'name' => 'Late fee (flat)', 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );', 'html' => 'Amount <INPUT TYPE="text" SIZE="7" NAME="charge" VALUE="%%%charge%%%">'. '<BR>Reason <INPUT TYPE="text" NAME="reason" VALUE="%%%reason%%%">', 'weight' => 10, }, + 'fee_percent' => { + 'name' => 'Late fee (percentage)', + 'code' => '$cust_main->charge( sprintf(\'%.2f\', $cust_bill->owed * %%%percent%%% / 100 ), \'%%%reason%%%\' );', + 'html' => + 'Percent <INPUT TYPE="text" SIZE="2" NAME="percent" VALUE="%%%percent%%%">%'. + '<BR>Reason <INPUT TYPE="text" NAME="reason" VALUE="%%%reason%%%">', + 'weight' => 10, + }, 'suspend' => { 'name' => 'Suspend', 'code' => '$cust_main->suspend();', diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 462d5161f..b085d2260 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -237,7 +237,7 @@ if ( dbdef->table('pkg_svc')->column('primary_svc') ) { push @form_radio, 'pkg_svc_primary'; } -tie my %freq, 'Tie::IxHash', %FS::part_pkg::freq; +tie my %freq, 'Tie::IxHash', %{FS::part_pkg->freqs_href()}; if ( $part_pkg->dbdef_table->column('freq')->type =~ /(int)/i ) { delete $freq{$_} foreach grep { ! /^\d+$/ } keys %freq; } diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi deleted file mode 100755 index dce1e6394..000000000 --- a/httemplate/edit/part_referral.cgi +++ /dev/null @@ -1,44 +0,0 @@ -<% - -my $part_referral; -if ( $cgi->param('error') ) { - $part_referral = new FS::part_referral ( { - map { $_, scalar($cgi->param($_)) } fields('part_referral') - } ); -} elsif ( $cgi->keywords ) { - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $part_referral = qsearchs( 'part_referral', { 'refnum' => $1 } ); -} else { #adding - $part_referral = new FS::part_referral {}; -} -my $action = $part_referral->refnum ? 'Edit' : 'Add'; -my $hashref = $part_referral->hashref; - -my $p1 = popurl(1); - -%><%= include('/elements/header.html', "$action Advertising source", menubar( - 'Main Menu' => popurl(2), - 'View all advertising sources' => popurl(2). "browse/part_referral.cgi", -)) %> - -<% if ( $cgi->param('error') ) { %> - <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> -<% } %> - -<FORM ACTION="<%= $p1 %>process/part_referral.cgi" METHOD=POST> - -<INPUT TYPE="hidden" NAME="refnum" VALUE="<%= $hashref->{refnum} %>"> - -<% -#print "Referral #", $hashref->{refnum} ? $hashref->{refnum} : "(NEW)"; -%> - -Advertising source <INPUT TYPE="text" NAME="referral" SIZE=32 VALUE="<%= $hashref->{referral} %>"> - -<BR> -<INPUT TYPE="submit" VALUE="<%= $hashref->{refnum} ? "Apply changes" : "Add advertising source" %>"> - -</FORM> - -<%= include('/elements/footer.html') %> diff --git a/httemplate/edit/part_referral.html b/httemplate/edit/part_referral.html new file mode 100755 index 000000000..ec0f32f58 --- /dev/null +++ b/httemplate/edit/part_referral.html @@ -0,0 +1,9 @@ +<%= include( 'elements/edit.html', + 'name' => 'Advertising source', + 'table' => 'part_referral', + 'fields' => [ 'referral' ], + 'labels' => { 'referral' => 'Advertising source' }, + 'viewall_dir' => 'browse', + 'html_table_bottom' => include('/elements/tr-select-agent.html'), + ) +%> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index c5fff25e0..489a2339c 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -38,32 +38,30 @@ Service <INPUT TYPE="text" NAME="svc" VALUE="<%= $hashref->{svc} %>"><BR> Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<%= $hashref->{disabled} eq 'Y' ? ' CHECKED' : '' %>><BR> <INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $hashref->{svcpart} %>"> <BR> -Services are items you offer to your customers. -<UL><LI>svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts +Service definitions are the templates for items you offer to your customers. +<UL><LI>svc_acct - Accounts - anything with a username (Mailboxes, PPP accounts, shell accounts, RADIUS entries for broadband, etc.) <LI>svc_domain - Domains <LI>svc_forward - mail forwarding <LI>svc_www - Virtual domain website - <LI>svc_broadband - Broadband/High-speed Internet service + <LI>svc_broadband - Broadband/High-speed Internet service (always-on) + <LI>svc_phone - Customer phone numbers <LI>svc_external - Externally-tracked service <!-- <LI>svc_charge - One-time charges (Partially unimplemented) <LI>svc_wo - Work orders (Partially unimplemented) --> </UL> 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) -<B>slipip</B> of <B>0.0.0.0</B>, while a POP mailbox will probably have a fixed -blank <B>slipip</B> as well as a fixed shell something like <B>/bin/true</B> or -<B>/usr/bin/passwd</B>. +values, or select an inventory class to manually or automatically fill in +that field. <BR><BR> <% -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; my %defs = ( + 'svc_acct' => { 'dir' => 'Home directory', 'uid' => 'UID (set to fixed and blank for no UIDs)', @@ -77,38 +75,55 @@ 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 <b>shells</b> 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 <b>shells</b> 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' => { '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', # }, @@ -116,22 +131,39 @@ my %defs = ( # 'worker' => 'Worker', # '_date' => 'Date', # }, + 'svc_www' => { #'recnum' => '', #'usersvc' => '', }, + 'svc_broadband' => { '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.', 'ip_addr' => 'IP address. Leave blank for automatic assignment.', 'blocknum' => 'Address block.', }, + + 'svc_phone' => { + 'countrycode' => { desc => 'Country code', + type => 'text', + disable_inventory => 1, + }, + 'phonenum' => 'Phone number', + 'pin' => { desc => 'Personal Identification Number', + type => 'text', + disable_inventory => 1, + }, + }, + 'svc_external' => { #'id' => '', #'title' => '', }, + ); + my %vfields; foreach my $svcdb (grep dbdef->table($_), keys %defs ) { my $self = "FS::$svcdb"->new; $vfields{$svcdb} = {}; @@ -149,10 +181,42 @@ 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} }, + }, +# need to template-ize httemplate/edit/svc_* first +# '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} ) - : qw( svc_acct svc_domain svc_forward svc_www svc_broadband svc_external ); + : qw( svc_acct svc_domain svc_forward svc_www svc_broadband svc_phone svc_external ); tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } grep dbdef->table($_), @dbs; my $widget = new HTML::Widgets::SelectLayers( @@ -174,8 +238,8 @@ my %defs = ( my @part_export = map { qsearch( 'part_export', {exporttype => $_ } ) } keys %{FS::part_export::export_info($layer)}; - $html .= '<BR><BR>'. table(). - table(). "<TR><TH COLSPAN=$columns>Exports</TH></TR><TR>"; + $html .= '<BR><BR>'. table(). + "<TR><TH COLSPAN=$columns>Exports</TH></TR><TR>"; foreach my $part_export ( @part_export ) { $html .= '<TD><INPUT TYPE="checkbox"'. ' NAME="exportnum'. $part_export->exportnum. '" VALUE="1" '; @@ -191,75 +255,176 @@ my %defs = ( } $html .= '</TR></TABLE><BR><BR>'; - $html .= table(). "<TH>Field</TH><TH COLSPAN=2>Modifier</TH>"; + $html .= include('/elements/table-grid.html', 'cellpadding' => 4 ). + '<TR>'. + '<TH CLASS="grid" BGCOLOR="#cccccc">Field</TH>'. + '<TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=2>Modifier</TH>'. + '</TR>'; + + my $bgcolor1 = '#eeeeee'; + my $bgcolor2 = '#ffffff'; + my $bgcolor; + #yucky kludge my @fields = defined( dbdef->table($layer) ) ? grep { $_ ne 'svcnum' } fields($layer) : (); push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge $part_svc->svcpart($clone) if $clone; #haha, undone below + + foreach my $field (@fields) { + my $part_svc_column = $part_svc->part_svc_column($field); my $value = $part_svc_column->columnvalue; my $flag = $part_svc_column->columnflag; my $def = $defs{$layer}{$field}; my $desc = ref($def) ? $def->{desc} : $def; + + if ( $bgcolor eq $bgcolor1 ) { + $bgcolor = $bgcolor2; + } else { + $bgcolor = $bgcolor1; + } - $html .= "<TR><TD>$field"; + $html .= qq!<TR><TD CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">!. + $field; $html .= "- <FONT SIZE=-1>$desc</FONT>" if $desc; $html .= "</TD>"; $flag = '' if ref($def) && $def->{type} eq 'disabled'; - $html .= - qq!<TD><INPUT TYPE="radio" NAME="${layer}__${field}_flag" VALUE=""!. - ' CHECKED'x($flag eq ''). ">Off</TD>". - '<TD>'; - unless ( ref($def) && $def->{type} eq 'disabled' ) { - $html .= - qq!<INPUT TYPE="radio" NAME="${layer}__${field}_flag" VALUE="D"!. - ' CHECKED'x($flag eq 'D'). ">Default ". - qq!<INPUT TYPE="radio" NAME="${layer}__${field}_flag" VALUE="F"!. - ' CHECKED'x($flag eq 'F'). ">Fixed "; - $html .= '<BR>'; - } - if ( ref($def) ) { - if ( $def->{type} eq 'select' ) { - $html .= qq!<SELECT NAME="${layer}__${field}">!; - $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>'; - } #next $record - } else { # select_list - foreach my $item ( @{$def->{select_list}} ) { - $html .= qq!<OPTION VALUE="$item"!. - ( $item eq $value ? ' SELECTED>' : '>' ). - $item. '</OPTION>'; - } #next $item - } #endif - $html .= '</SELECT>'; - } elsif ( $def->{type} eq 'radius_usergroup_selector' ) { - $html .= FS::svc_acct::radius_usergroup_selector( - [ split(',', $value) ], "${layer}__${field}" ); - } elsif ( $def->{type} eq 'disabled' ) { - $html .= - qq!<INPUT TYPE="hidden" NAME="${layer}__${field}" VALUE="">!; - } else { - $html .= '<font color="#ff0000">unknown type'. $def->{type}; - } + + $html .= qq!<TD CLASS="grid" BGCOLOR="$bgcolor">!; + + if ( ref($def) && $def->{type} eq 'disabled' ) { + + $html .= 'No default'; + } else { - $html .= - qq!<INPUT TYPE="text" NAME="${layer}__${field}" VALUE="$value">!; + + $html .= qq!<SELECT NAME="${layer}__${field}_flag"!. + qq! onChange="${layer}__${field}_flag_changed(this)">!; + + foreach my $f ( keys %flag ) { + + #here is where the SUB from above is called, to skip some choices + next if $flag{$f}->{condition} + && &{ $flag{$f}->{condition} }( $def, $layer, $field ); + + $html .= qq!<OPTION VALUE="$f"!. + ' SELECTED'x($flag eq $f ). + '>'. $flag{$f}->{desc}; + + } + + $html .= '</SELECT>'; + + $html .= join("\n", + '<SCRIPT>', + " function ${layer}__${field}_flag_changed(what) {", + ' var f = what.options[what.selectedIndex].value;', + ' if ( f == "" || f == "X" ) { //disable', + " what.form.${layer}__${field}.disabled = true;". + " what.form.${layer}__${field}.style.backgroundColor = '#dddddd';". + " if ( what.form.${layer}__${field}_classnum ) {". + " what.form.${layer}__${field}_classnum.disabled = true;". + " what.form.${layer}__${field}_classnum.style.backgroundColor = '#dddddd';". + " }". + ' } else if ( f == "D" || f == "F" ) { //enable, text box', + " what.form.${layer}__${field}.disabled = false;". + " what.form.${layer}__${field}.style.backgroundColor = '#ffffff';". + " what.form.${layer}__${field}.style.display = '';". + " if ( what.form.${layer}__${field}_classnum ) {". + " what.form.${layer}__${field}_classnum.disabled = false;". + " what.form.${layer}__${field}_classnum.style.backgroundColor = '#ffffff';". + " what.form.${layer}__${field}_classnum.style.display = 'none';". + " }". + ' } else if ( f == "M" || f == "A" ) { //enable, inventory', + " what.form.${layer}__${field}.disabled = false;". + " what.form.${layer}__${field}.style.backgroundColor = '#ffffff';". + " what.form.${layer}__${field}.style.display = 'none';". + " if ( what.form.${layer}__${field}_classnum ) {". + " what.form.${layer}__${field}_classnum.disabled = false;". + " what.form.${layer}__${field}_classnum.style.backgroundColor = '#ffffff';". + " what.form.${layer}__${field}_classnum.style.display = '';". + " }". + ' }', + ' }', + '</SCRIPT>', + ); + } - if($vfields{$layer}->{$field}) { - $html .= qq!<BR><INPUT TYPE="radio" NAME="${layer}__${field}_flag" VALUE="X"!. - ' CHECKED'x($flag eq 'X'). ">Excluded "; + $html .= qq!</TD><TD CLASS="grid" BGCOLOR="$bgcolor">!; + + my $disabled = $flag ? '' + : 'DISABLED STYLE="background-color: #dddddd"'; + + if ( ! ref($def) || $def->{type} eq 'text' ) { + + my $nodisplay = ' STYLE="display:none"'; + my $is_inv = ( $flag =~ /^[MA]$/ ); + + $html .= + qq!<INPUT TYPE="text" NAME="${layer}__${field}" VALUE="$value" !. + $disabled. + ( $is_inv ? $nodisplay : $disabled ). + '>'; + + $html .= include('/elements/select-table.html', + 'element_name' => "${layer}__${field}_classnum", + 'element_etc' => ( $is_inv + ? $disabled + : $nodisplay + ), + 'table' => 'inventory_class', + 'name_col' => 'classname', + 'value' => $value, + 'empty_label' => 'Select inventory class', + ); + + } elsif ( $def->{type} eq 'select' ) { + + $html .= qq!<SELECT NAME="${layer}__${field}" $disabled>!; + $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>'; + } #next $record + } else { # select_list + foreach my $item ( @{$def->{select_list}} ) { + $html .= qq!<OPTION VALUE="$item"!. + ( $item eq $value ? ' SELECTED>' : '>' ). + $item. '</OPTION>'; + } #next $item + } #endif + $html .= '</SELECT>'; + + } elsif ( $def->{type} eq 'radius_usergroup_selector' ) { + + #XXX disable the RADIUS usergroup selector? ugh it sure does need + #an overhaul, people have dum group problems because of it + + $html .= FS::svc_acct::radius_usergroup_selector( + [ split(',', $value) ], "${layer}__${field}" ); + + } elsif ( $def->{type} eq 'disabled' ) { + + $html .= + qq!<INPUT TYPE="hidden" NAME="${layer}__${field}" VALUE="">!; + + } else { + + $html .= '<font color="#ff0000">unknown type'. $def->{type}; + } + $html .= "</TD></TR>\n"; - } + + } #foreach my $field (@fields) { + $part_svc->svcpart('') if $clone; #undone $html .= "</TABLE>"; diff --git a/httemplate/edit/process/access_group.html b/httemplate/edit/process/access_group.html index e8c6d07b1..9bb9d1dda 100644 --- a/httemplate/edit/process/access_group.html +++ b/httemplate/edit/process/access_group.html @@ -1,5 +1,15 @@ <%= include( 'elements/process.html', 'table' => 'access_group', 'viewall_dir' => 'browse', + 'process_m2m' => { 'link_table' => 'access_groupagent', + 'target_table' => 'agent', + }, + 'process_m2name' => { + 'link_table' => 'access_right', + 'link_static' => { 'righttype' => 'FS::access_group', }, + 'num_col' => 'rightobjnum', + 'name_col' => 'rightname', + 'names_list' => [ FS::AccessRight->rights() ], + }, ) %> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 09a42544c..4ba30c435 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -103,8 +103,6 @@ if ( $new->custnum eq '' ) { 'popnum' => $cgi->param('popnum'), } ); - my $y = $svc_acct->setdefault; # arguably should be in new method - $error ||= $y unless ref($y); #and just in case you were silly $svc_acct->svcpart($svcpart); $svc_acct->username($cgi->param('username')); diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index 87d6011e7..cecccb59e 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -4,15 +4,16 @@ $cgi->param('linknum') =~ /^(\d+)$/ or die "Illegal linknum: ". $cgi->param('linknum'); my $linknum = $1; -$cgi->param('link') =~ /^(custnum|invnum)$/ +$cgi->param('link') =~ /^(custnum|invnum|popup)$/ or die "Illegal link: ". $cgi->param('link'); -my $link = $1; +my $field = my $link = $1; +$field = 'custnum' if $field eq 'popup'; my $_date = str2time($cgi->param('_date')); my $new = new FS::cust_pay ( { - $link => $linknum, - _date => $_date, + $field => $linknum, + _date => $_date, map { $_, scalar($cgi->param($_)); } qw(paid payby payinfo paybatch) @@ -24,19 +25,30 @@ my $error = $new->insert; if ($error) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string ); -} elsif ( $link eq 'invnum' ) { +} elsif ( $field eq 'invnum' ) { print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum"); -} elsif ( $link eq 'custnum' ) { +} elsif ( $field eq 'custnum' ) { if ( $cgi->param('apply') eq 'yes' ) { my $cust_main = qsearchs('cust_main', { 'custnum' => $linknum }) or die "unknown custnum $linknum"; $cust_main->apply_payments; } - if ( $cgi->param('quickpay') eq 'yes' ) { - print $cgi->redirect(popurl(3). "search/cust_main-quickpay.html"); - } else { + if ( $link eq 'popup' ) { + + %><%= header('Payment entered') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + + </BODY></HTML> + <% + + } elsif ( $link eq 'custnum' ) { print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum"); + } else { + die "unknown link $link"; } + } %> diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 59ad35ee4..7cae78bfc 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -5,6 +5,7 @@ ### ##req ## + # # 'table' => # # #? 'primary_key' => #required when the dbdef doesn't know...??? @@ -13,10 +14,24 @@ ### ##opt ### + # # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + # OR + # 'redirect' => 'view/table.cgi?', # value of primary key is appended + # + # 'edit_ext' => 'html', #defaults to 'html', you might want 'cgi' while the + # #naming is still inconsistent + # # 'process_m2m' => { 'link_table' => 'link_table_name', # 'target_table' => 'target_table_name', - # }. + # }, + # 'process_m2name' => { 'link_table' => 'link_table_name', + # 'link_static' => { 'column' => 'value' }, + # 'num_col' => 'column', #if column name is different in + # #link_table than source_table + # 'name_col' => 'name_column', + # 'names_list' => [ 'list', 'names' ], + # }, my(%opt) = @_; @@ -52,9 +67,20 @@ ); } + if ( !$error && $opt{'process_m2name'} ) { + $error = $new->process_m2name( %{ $opt{'process_m2name'} }, + 'params' => scalar($cgi->Vars), + ); + } + + # XXX print?!?! + if ( $error ) { $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); + my $edit_ext = $opt{'edit_ext'} || 'html'; + print $cgi->redirect(popurl(2). "$table.$edit_ext?". $cgi->query_string ); + } elsif ( $opt{'redirect'} ) { + print $cgi->redirect( $opt{'redirect'}. $pkeyvalue ); } else { print $cgi->redirect( popurl(3). ( $opt{'viewall_dir'} || 'search' ). diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html new file mode 100644 index 000000000..1f8f8315e --- /dev/null +++ b/httemplate/edit/process/elements/svc_Common.html @@ -0,0 +1,14 @@ +<% + + my %opt = @_; + my $table = $opt{'table'}; + $opt{'fields'} ||= [ fields($table) ]; + push @{ $opt{'fields'} }, qw( pkgnum svcpart ); + +%><%= include( 'process.html', + 'edit_ext' => 'cgi', + 'redirect' => popurl(3)."view/$table.cgi?", + %opt, + ) +%> + diff --git a/httemplate/edit/process/part_referral.cgi b/httemplate/edit/process/part_referral.cgi deleted file mode 100755 index fd2c01506..000000000 --- a/httemplate/edit/process/part_referral.cgi +++ /dev/null @@ -1,28 +0,0 @@ -<% - -my $refnum = $cgi->param('refnum'); - -my $new = new FS::part_referral ( { - map { - $_, scalar($cgi->param($_)); - } fields('part_referral') -} ); - -my $error; -if ( $refnum ) { - my $old = qsearchs( 'part_referral', { 'refnum' =>$ refnum } ); - die "(Old) Record not found!" unless $old; - $error = $new->replace($old); -} else { - $error = $new->insert; -} -$refnum=$new->refnum; - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "part_referral.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/part_referral.cgi"); -} - -%> diff --git a/httemplate/edit/process/part_referral.html b/httemplate/edit/process/part_referral.html new file mode 100755 index 000000000..0b5d959a0 --- /dev/null +++ b/httemplate/edit/process/part_referral.html @@ -0,0 +1,5 @@ +<%= include( 'elements/process.html', + 'table' => 'part_referral', + 'viewall_dir' => 'browse', + ) +%> diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html new file mode 100644 index 000000000..c1d4b7547 --- /dev/null +++ b/httemplate/edit/process/svc_phone.html @@ -0,0 +1,4 @@ +<%= include( 'elements/svc_Common.html', + 'table' => 'svc_phone', + ) +%> diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 1e87c67ad..71b324d99 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -68,18 +68,22 @@ unless ( $svcnum || $cgi->param('error') ) { #adding } } - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - if ( $part_svc_column->columnname eq 'usergroup' ) { - @groups = split(',', $part_svc_column->columnvalue); - } else { - $svc_acct->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } - } + $svc_acct->set_default_and_fixed( { + #false laziness w/svc-acct::_fieldhandlers + 'usergroup' => sub { + my( $self, $groups ) = @_; + if ( ref($groups) eq 'ARRAY' ) { + @groups = @$groups; + $groups; + } elsif ( length($groups) ) { + @groups = split(/\s*,\s*/, $groups); + [ @groups ]; + } else { + @groups = (); + []; + } + } + } ); } @@ -274,7 +278,7 @@ if ( $part_svc->part_svc_column('popnum')->columnflag eq 'F' ) { <% foreach my $xid (qw( uid gid )) { %> <% - if ( $part_svc->part_svc_column($xid)->columnflag eq 'F' + if ( $part_svc->part_svc_column($xid)->columnflag =~ /^[FA]$/ || ! $conf->exists("svc_acct-edit_$xid") ) { %> @@ -376,7 +380,7 @@ if ( $part_svc->part_svc_column('shell')->columnflag eq 'F' <% } %> -<% if ( $part_svc->part_svc_column('slipip')->columnflag eq 'F' ) { %> +<% if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) { %> <INPUT TYPE="hidden" NAME="slipip" VALUE="<%= $svc_acct->slipip %>"> @@ -396,7 +400,7 @@ foreach my $r ( grep { /^r(adius|[cr])_/ } fields('svc_acct') ) { my $a = $2; %> - <% if ( $part_svc->part_svc_column($r)->columnflag eq 'F' ) { %> + <% if ( $part_svc->part_svc_column($r)->columnflag =~ /^[FA]$/ ) { %> <INPUT TYPE="hidden" NAME="<%= $r %>" VALUE="<%= $svc_acct->getfield($r) %>"> diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index cbd0c2c3a..d66cff690 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -47,14 +47,7 @@ if ( $cgi->param('error') ) { $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_broadband->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_broadband->set_default_and_fixed; } } diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index f47ba0a8f..1156bf0ba 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -44,14 +44,7 @@ if ( $cgi->param('error') ) { $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_domain->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_domain->set_default_and_fixed; } diff --git a/httemplate/edit/svc_external.cgi b/httemplate/edit/svc_external.cgi index bcfc85e3f..38b3ce1a4 100644 --- a/httemplate/edit/svc_external.cgi +++ b/httemplate/edit/svc_external.cgi @@ -40,14 +40,7 @@ if ( $cgi->param('error') ) { $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_external->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_external->set_default_and_fixed; } } diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index c1b90a9bd..c32fbd7c1 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -44,14 +44,7 @@ if ( $cgi->param('error') ) { $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_forward->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_forward->set_default_and_fixed; } } diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi new file mode 100644 index 000000000..77b4975a1 --- /dev/null +++ b/httemplate/edit/svc_phone.cgi @@ -0,0 +1,11 @@ +<%= include( 'elements/svc_Common.html', + 'name' => 'Phone number', + 'table' => 'svc_phone', + 'fields' => [qw( countrycode phonenum )], #pin + 'labels' => { + 'countrycode' => 'Country code', + 'phonenum' => 'Phone number', + 'pin' => 'PIN', + }, + ) +%> diff --git a/httemplate/edit/svc_www.cgi b/httemplate/edit/svc_www.cgi index 3cb752850..280346bb4 100644 --- a/httemplate/edit/svc_www.cgi +++ b/httemplate/edit/svc_www.cgi @@ -42,14 +42,7 @@ if ( $cgi->param('error') ) { $svcnum=''; - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_www->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } + $svc_www->set_default_and_fixed; } } |