diff options
Diffstat (limited to 'httemplate/edit')
33 files changed, 787 insertions, 247 deletions
diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index c31213805..29c8ca63f 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -94,7 +94,7 @@ <SCRIPT TYPE="text/javascript"> Calendar.setup({ inputField: "<% $column %>_text", - ifFormat: "%m/%d/%Y", + ifFormat: "<% $date_format %>", button: "<% $column %>_button", align: "BR" }); @@ -128,21 +128,20 @@ </FORM> <% include('/elements/footer.html') %> +<%shared> -<%once> +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -#my $format = "%c %z (%Z)"; -my $format = "%m/%d/%Y %T %z (%Z)"; +my $format = $date_format. ' %T %z (%Z)'; -#false laziness w/view/cust_main/packages.html -#my( $billed_or_prepaid, - -</%once> +</%shared> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates'); + my $error = ''; my( $pkgnum, $cust_pkg ); diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html index 73488ef9a..1f52b4789 100644 --- a/httemplate/edit/access_user.html +++ b/httemplate/edit/access_user.html @@ -7,16 +7,18 @@ { field=>'_password2', type=>'password' }, 'last', 'first', + { field=>'user_custnum', type=>'search-cust_main', }, { field=>'disabled', type=>'checkbox', value=>'Y' }, ], 'labels' => { - 'usernum' => 'User number', - 'username' => 'Username', - '_password' => 'Password', - '_password2'=> 'Re-enter Password', - 'last' => 'Last name', - 'first' => 'First name', - 'disabled' => 'Disable employee', + 'usernum' => 'User number', + 'username' => 'Username', + '_password' => 'Password', + '_password2 '=> 'Re-enter Password', + 'last' => 'Last name', + 'first' => 'First name', + 'user_custnum' => 'Customer (optional)', + 'disabled' => 'Disable employee', }, 'edit_callback' => sub { my( $c, $o ) = @_; $o->set('_password', ''); diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index febf281f9..dc80847de 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -14,7 +14,7 @@ <TR> <TD ALIGN="right">Date</TD> - <TD BGCOLOR="#ffffff"><% time2str("%D",$_date) %></TD> + <TD BGCOLOR="#ffffff"><% time2str($date_format, $_date) %></TD> </TR> <TR> @@ -64,12 +64,10 @@ </FORM> </BODY> </HTML> -<%once> +<%init> my $conf = new FS::Conf; - -</%once> -<%init> +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post credit'); diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index 041050664..d1d436851 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -43,6 +43,7 @@ %if ( $cust_main->referral_custnum % and $referring_cust_main = % qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) +% and ! $curuser->access_right('Edit referring customer') %) { <TR> @@ -52,8 +53,8 @@ </TD> </TR> <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<% $cust_main->referral_custnum %>"> -% } elsif ( ! $conf->exists('disable_customer_referrals') ) { +% } elsif ( ! $conf->exists('disable_customer_referrals') ) { <TR> <TD ALIGN="right">Referring customer</TD> @@ -61,13 +62,13 @@ <!-- <INPUT TYPE="text" NAME="referral_custnum" VALUE=""> --> <% include('/elements/search-cust_main.html', 'field_name' => 'referral_custnum', + 'curr_value' => $cust_main->referral_custnum, ) %> </TD> </TR> -% } else { - +% } else { <INPUT TYPE="hidden" NAME="referral_custnum" VALUE=""> % } @@ -77,7 +78,7 @@ 'name' => 'signupdate', 'value' => $cust_main->signupdate, 'label' => 'Signup date', - 'format' => $conf->config('date_format') || "%m/%d/%Y", + 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ), }) %> % } @@ -92,6 +93,8 @@ my $custnum = $opt{'custnum'}; my $conf = new FS::Conf; +my $curuser = $FS::CurrentUser::CurrentUser; + my $r = qq!<font color="#ff0000">*</font> !; </%init> diff --git a/httemplate/edit/cust_main_note.cgi b/httemplate/edit/cust_main_note.cgi index 6c6a1a9a0..e2501cb54 100755 --- a/httemplate/edit/cust_main_note.cgi +++ b/httemplate/edit/cust_main_note.cgi @@ -6,11 +6,11 @@ <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> <INPUT TYPE="hidden" NAME="notenum" VALUE="<% $notenum %>"> - -<BR><BR> -<TEXTAREA NAME="comment" ROWS="12" COLS="60"> -<% $comment %> -</TEXTAREA> +<% include('/elements/htmlarea.html', 'field' => 'comment', + 'curr_value' => $comment) %> +% #<TEXTAREA NAME="comment" ROWS="12" COLS="60"> +% # <% $comment %> +% #</TEXTAREA> <BR><BR> <INPUT TYPE="submit" VALUE="<% $notenum ? "Apply Changes" : "Add Note" %>"> @@ -33,6 +33,8 @@ if ( $cgi->param('error') ) { $comment = $note->comments; } +$comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor + $cgi->param('custnum') =~ /^(\d+)$/ or die "illeagl custnum"; my $custnum = $1; diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 07e51989e..a6b73b13a 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -26,7 +26,7 @@ Payment <TR> <TD ALIGN="right">Date</TD> <TD COLSPAN=2> - <INPUT TYPE="text" NAME="_date" ID="_date_text" VALUE="<% time2str("%m/%d/%Y %r",$_date) %>"> + <INPUT TYPE="text" NAME="_date" ID="_date_text" VALUE="<% time2str($date_format.' %r',$_date) %>"> <IMG SRC="../images/calendar.png" ID="_date_button" STYLE="cursor: pointer" TITLE="Select date"> </TD> </TR> @@ -34,7 +34,7 @@ Payment <SCRIPT TYPE="text/javascript"> Calendar.setup({ inputField: "_date_text", - ifFormat: "%m/%d/%Y", + ifFormat: "<% $date_format %>", button: "_date_button", align: "BR" }); @@ -100,7 +100,8 @@ Payment my $conf = new FS::Conf; -my $money_char = $conf->config('money_char') || '$'; +my $money_char = $conf->config('money_char') || '$'; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post payment'); diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi index 94c0993d7..59417b4c4 100755 --- a/httemplate/edit/cust_refund.cgi +++ b/httemplate/edit/cust_refund.cgi @@ -41,14 +41,14 @@ </TR> <TR> - <TD ALIGN="right">Date</TD><TD BGCOLOR="#ffffff"><% time2str("%D",$cust_pay->_date) %></TD> + <TD ALIGN="right">Date</TD><TD BGCOLOR="#ffffff"><% time2str($date_format, $cust_pay->_date) %></TD> </TR> <TR> <TD ALIGN="right">Method</TD><TD BGCOLOR="#ffffff"><% $payby %> # <% $paymask %></TD> </TR> -% unless ( $paydate ) { # possibly other reasons: i.e. card has since expired +% unless ( $paydate || $cust_pay->payby ne 'CARD' ) { # possibly other reasons: i.e. card has since expired <TR> <TD ALIGN="right">Expiration</TD><TD BGCOLOR="#ffffff"> <% include( '/elements/select-month_year.html', @@ -93,7 +93,7 @@ <TR> <TD ALIGN="right">Date</TD> - <TD BGCOLOR="#ffffff"><% time2str("%D",$_date) %></TD> + <TD BGCOLOR="#ffffff"><% time2str($date_format, $_date) %></TD> </TR> <TR> @@ -134,6 +134,8 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Refund payment'); my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + my $custnum = $cgi->param('custnum'); my $refund = $cgi->param('refund'); my $payby = $cgi->param('payby'); diff --git a/httemplate/edit/elements/ApplicationCommon.html b/httemplate/edit/elements/ApplicationCommon.html index a485d37de..1fc8a09a9 100644 --- a/httemplate/edit/elements/ApplicationCommon.html +++ b/httemplate/edit/elements/ApplicationCommon.html @@ -52,7 +52,7 @@ Examples: <TR> <TD ALIGN="right">Date: </TD> - <TD><B><% time2str("%D", $src->_date) %></B></TD> + <TD><B><% time2str($date_format, $src->_date) %></B></TD> </TR> <TR> @@ -107,7 +107,7 @@ Apply to: <OPTION VALUE="">Select <% $dst_thing %> % foreach my $dst ( @dst ) { - <OPTION<% $dst->$dst_pkey eq $dst_pkeyvalue ? ' SELECTED' : '' %> VALUE="<% $dst->$dst_pkey %>">#<% $dst->$dst_pkey %> - <% time2str("%D", $dst->_date) %> - $<% $dst->$dst_unapplied %> + <OPTION<% $dst->$dst_pkey eq $dst_pkeyvalue ? ' SELECTED' : '' %> VALUE="<% $dst->$dst_pkey %>">#<% $dst->$dst_pkey %> - <% time2str($date_format, $dst->_date) %> - $<% $dst->$dst_unapplied %> % } </SELECT> @@ -133,7 +133,8 @@ Apply to: my %opt = @_; my $conf = new FS::Conf; -my $money_char = $conf->config('money_char') || '$'; +my $money_char = $conf->config('money_char') || '$'; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; my $src_thing = ucfirst($opt{'src_thing'}); my $src_table = $opt{'src_table'}; diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index fd73e031e..1a1023cbd 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -40,8 +40,10 @@ Example: 'disabled' => 0, 'onchange' => 'javascript_function', - #m2 stuff only tested w/selectlayers so far - #might work w/select too, dunno others + 'include_opt_callback' => sub { my $object = @_; + ( 'option' => 'value', ); + }, + 'm2name_table' => 'table_name', 'm2name_namecol' => 'name_column', #OR# @@ -276,9 +278,13 @@ Example: % $include_common{$_} = $f->{$_} % foreach grep exists($f->{$_}), qw( empty_label ); % +% #select-table +% $include_common{$_} = $f->{$_} +% foreach grep exists($f->{$_}), qw( value_col extra_sql ); +% % #select-table, checkboxes-table % $include_common{$_} = $f->{$_} -% foreach grep exists($f->{$_}), qw( table name_col ); +% foreach grep exists($f->{$_}), qw( table name_col ); % % #checkboxes-table % $include_common{$_} = $f->{$_} @@ -290,9 +296,17 @@ Example: % % if ( $type eq 'tablebreak-tr-title' ) { % $include_common{'table_id'} = 'TableNumber'. $tablenum++; +% } +% if ( $type eq 'tablebreak-tr-title' || $type eq 'title' ) { % $include_common{'colspan'} = $f->{colspan} if $f->{colspan}; % } % +% if ( $f->{include_opt_callback} ) { +% %include_common = ( %include_common, +% &{ $f->{include_opt_callback} }( $object ) +% ); +% } +% % my $layer_prefix_on = ''; % % my $include_sub = sub { diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index ef04bd04a..36950b2c9 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -34,12 +34,14 @@ 'new_hashref_callback' => sub { #my( $cgi, $svc_x ) = @_; - { svcpart => $svcpart }; + { pkgnum => $pkgnum, + svcpart => $svcpart, + }; }, 'new_callback' => sub { - my( $cgi, $svc_x, $fields, $opt ) = @_;; + my( $cgi, $svc_x, $fields, $opt ) = @_; $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart }); die "No part_svc entry!" unless $part_svc; @@ -48,12 +50,20 @@ #$svcnum=''; + if ( my $cb = $opt{'svc_new_callback'} ) { + my $cust_pkg = $pkgnum + ? qsearchs('cust_pkg', {pkgnum=>$pkgnum}) + : ''; #? + &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt); + } + $svc_x->set_default_and_fixed; }, 'field_callback' => sub { my ($cgi, $object, $f) = @_; + my $columndef = $part_svc->part_svc_column($f->{'field'}); my $flag = $columndef->columnflag; if ( $flag eq 'F' ) { @@ -61,7 +71,41 @@ ? 'fixed' : 'hidden'; $f->{'value'} = $columndef->columnvalue; + } elsif ( $flag eq 'A' ) { + $f->{'type'} = 'hidden'; + } elsif ( $flag eq 'M' ) { + $f->{'empty_label'} = 'Select inventory item'; + $f->{'type'} = 'select-table'; + $f->{'table'} = 'inventory_item'; + $f->{'name_col'} = 'item'; + $f->{'value_col'} = 'item'; + $f->{'hashref'} = { + 'classnum'=>$columndef->columnvalue, + #'svcnum' => '', + }; + $f->{'extra_sql'} = 'AND ( svcnum IS NULL '; + $f->{'extra_sql'} .= ' OR svcnum = '. $object->svcnum + if $object->svcnum; + $f->{'extra_sql'} .= ' ) '; + $f->{'disable_empty'} = $object->svcnum ? 1 : 0, + } + + if ( $f->{'type'} eq 'select-svc_pbx' + || $f->{'type'} eq 'select-svc-domain' + ) + { + $f->{'include_opt_callback'} = + sub { ( 'pkgnum' => $pkgnum, + 'svcpart' => $svcpart, + ); + }; + } + + if ( $f->{'field'} eq 'custnum' && $pkgnum ) { + my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}); + $object->set('custnum', $cust_pkg->custnum); } + }, 'html_init' => sub { @@ -111,12 +155,33 @@ sub label_fixup { my( $part_svc, $opt ) = @_; + $opt->{'name'} ||= $part_svc->svc; + + my $svcdb = $part_svc->svcdb; + require "FS/$svcdb.pm"; + + if ( UNIVERSAL::can("FS::$svcdb", 'table_info') ) { + #$opt->{'name'} ||= "FS::$svcdb"->table_info->{'name'}; + + my $fields = "FS::$svcdb"->table_info->{'fields'}; + $opt->{'fields'} ||= [ grep { $_ ne 'svcnum' } keys %$fields ]; + + $opt->{labels} ||= { + map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } + keys %$fields + }; + } + #false laziness w/view/svc_Common.html #override default labels with service-definition labels if applicable my $labels = $opt->{labels}; # with -> here - foreach my $field ( keys %$labels ) { + foreach my $field ( keys %{ $opt->{labels} } ) { my $col = $part_svc->part_svc_column($field); - $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\S*$/; + $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\s*$/; } } diff --git a/httemplate/edit/mailinglistmember.html b/httemplate/edit/mailinglistmember.html new file mode 100644 index 000000000..2391cb697 --- /dev/null +++ b/httemplate/edit/mailinglistmember.html @@ -0,0 +1,25 @@ +<% include( 'elements/edit.html', + 'name_singular' => 'member', + 'table' => 'mailinglistmember', + 'popup' => 1, + 'fields' => [ + { field=>'listnum', type=>'hidden', }, + { field=>'svcnum', type=>'hidden', }, #not yet + { field=>'contactemailnum', type=>'hidden', }, #not yet + { field=>'email', type=>'text', }, + ], + 'labels' => { 'membernum' => 'Member', + 'email' => 'Email address', + }, + 'new_callback' => $new_callback, + ) +%> +<%init> + +my $new_callback = sub { + #my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; + my( $cgi, $object ) = @_; + $object->listnum( $cgi->param('listnum') ); +}; + +</%init> diff --git a/httemplate/edit/part_device.html b/httemplate/edit/part_device.html index 4f2fe93b4..146070fd9 100644 --- a/httemplate/edit/part_device.html +++ b/httemplate/edit/part_device.html @@ -6,6 +6,7 @@ 'devicename' => 'Device name', }, 'viewall_dir' => 'browse', + 'html_bottom' => $html_bottom_sub, ) %> <%init> @@ -13,4 +14,32 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $extra_sql = + join( ' OR ', map { "exporttype = '$_'" } + keys %{FS::part_export::export_info('part_device')} + ); +$extra_sql = $extra_sql ? " WHERE ( $extra_sql ) " : " WHERE 0 = 1 "; + +my $html_bottom_sub = sub { + my $part_device = shift; + + '<BR>'. + '<FONT SIZE="+1">Exports</FONT><BR>'. + + '<TABLE BGCOLOR="#cccccc" WIDTH=100%>'. + '<TR><TD>'. + include( '/elements/checkboxes-table.html', + 'source_obj' => $part_device, + 'link_table' => 'export_device', + 'target_table' => 'part_export', + 'extra_sql' => $extra_sql, + 'name_callback' => sub { my $o = shift; + $o->exporttype. ' to '. $o->machine; + }, + ). + '</TD></TR></TABLE>'; + +}; + </%init> + diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index a02545f84..f9818c4f9 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -162,15 +162,17 @@ { type => 'columnend' }, - { 'type' => $census ? 'tablebreak-tr-title' - : 'hidden', + { 'type' => $report_option ? 'tablebreak-tr-title' + : 'hidden', 'value' => 'Optional report classes', 'field' => 'census_title', }, { 'field' => 'report_option', - 'type' => $census ? 'select-table' : 'hidden', + 'type' => $report_option ? 'select-table' + : 'hidden', 'table' => 'part_pkg_report_option', 'name_col' => 'name', + 'hashref' => { 'disabled' => '' }, 'multiple' => 1, }, @@ -256,7 +258,7 @@ my $sth = dbh->prepare("SELECT COUNT(*) FROM part_pkg_report_option". " WHERE disabled IS NULL OR disabled = '' ") or die dbh->errstr; $sth->execute or die $sth->errstr; -my $census = $sth->fetchrow_arrayref->[0]; +my $report_option = $sth->fetchrow_arrayref->[0]; #XXX # - tr-part_pkg_freq: month_increments_only (from price plans) @@ -409,7 +411,6 @@ my $m2_error_callback_maker = sub { my $link_type = shift; #yay closures return sub { my( $cgi, $object ) = @_; - my $num; map { if ( /^${link_type}_dst_pkgpart(\d+)$/ && diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 79703435c..98ed9fec1 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -15,10 +15,12 @@ Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref-> 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_forward - Mail forwarding + <LI>svc_mailinglist - Mailing list <LI>svc_www - Virtual domain website <LI>svc_broadband - Broadband/High-speed Internet service (always-on) <LI>svc_phone - Customer phone numbers + <LI>svc_pbx - Customer PBXs <LI>svc_external - Externally-tracked service <!-- <LI>svc_charge - One-time charges (Partially unimplemented) <LI>svc_wo - Work orders (Partially unimplemented) @@ -64,10 +66,9 @@ that field. % 'condition' => % sub { !ref($_[0]) || $_[0]->{disable_select} }, % }, -%# need to template-ize httemplate/edit/svc_* first -%# 'M' => { 'desc' => 'Manual selection from inventory', -%# 'condition' => $inv_sub, -%# }, +% 'M' => { 'desc' => 'Manual selection from inventory', +% 'condition' => $inv_sub, +% }, % 'A' => { 'desc' => 'Automatically fill in from inventory', % 'condition' => $inv_sub, % }, @@ -184,6 +185,9 @@ that field. % % foreach my $f ( keys %flag ) { % +% # need to template-ize more httemplate/edit/svc_* first +% next if $f eq 'M' and $layer !~ /^svc_(broadband|external|phone)$/; +% % #here is where the SUB from above is called, to skip some choices % next if $flag{$f}->{condition} % && &{ $flag{$f}->{condition} }( $def, $layer, $field ); @@ -265,6 +269,14 @@ that field. % 'empty_label' => 'Select inventory class', % ); % +% } elsif ( $def->{type} eq 'checkbox' ) { +% +% $html .= include('/elements/checkbox.html', +% 'field' => $layer.'__'.$field, +% 'curr_value' => $value, +% 'value' => 'Y', +% ); +% % } elsif ( $def->{type} eq 'select' ) { % % $html .= qq!<SELECT NAME="${layer}__${field}" $disabled!; @@ -288,6 +300,15 @@ that field. % } #endif % $html .= '</SELECT>'; % +% } elsif ( $def->{type} eq 'select-svc_pbx.html' ) { +% +% $html .= include('/elements/select-svc_pbx.html', +% 'curr_value' => $value, +% 'element_name' => "${layer}__${field}", +% 'element_etc' => $disabled, +% 'multiple' => ($flag eq 'S'), +% ); +% % } elsif ( $def->{type} eq 'radius_usergroup_selector' ) { % % #XXX disable the RADIUS usergroup selector? ugh it sure does need @@ -296,6 +317,14 @@ that field. % $html .= FS::svc_acct::radius_usergroup_selector( % [ split(',', $value) ], "${layer}__${field}" ); % +% } elsif ( $def->{type} eq 'communigate_pro-accessmodes' ) { +% +% $html .= include('/elements/communigate_pro-accessmodes.html', +% 'element_name_prefix' => "${layer}__${field}_", +% 'curr_value' => $value, +% #doesn't work#'element_etc' => $disabled, +% ); +% % } elsif ( $def->{type} eq 'disabled' ) { % % $html .= @@ -303,7 +332,7 @@ that field. % % } else { % -% $html .= '<font color="#ff0000">unknown type'. $def->{type}; +% $html .= '<font color="#ff0000">unknown type '. $def->{type}; % % } % diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index 22aab44e8..b5796ebf5 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -39,14 +39,15 @@ push @errors, '_setup_areyousure' && ! $cgi->param('setup_areyousure'); # and it wasn't confirmed push @errors, '_start' - if $hash{'start_date'} && $old->start_date # if a start date was added - && $hash{'setup'}; # but there's a setup date + if $hash{'start_date'} && !$old->start_date # if a start date was added + && $hash{'setup'}; # but there's a setup date my $new; my $error; if ( @errors ) { $error = join(',', @errors); } else { + warn join(',',%hash); $new = new FS::cust_pkg \%hash; $error = $new->replace($old); } diff --git a/httemplate/edit/process/mailinglistmember.html b/httemplate/edit/process/mailinglistmember.html new file mode 100644 index 000000000..f1842b8ef --- /dev/null +++ b/httemplate/edit/process/mailinglistmember.html @@ -0,0 +1,6 @@ +<% include( 'elements/process.html', + 'table' => 'mailinglistmember', + 'popup_reload' => 'Member added', + ) +%> +%#XXX ACL diff --git a/httemplate/edit/process/rate_region.cgi b/httemplate/edit/process/rate_region.cgi index 882991e9d..8036f7388 100755 --- a/httemplate/edit/process/rate_region.cgi +++ b/httemplate/edit/process/rate_region.cgi @@ -39,7 +39,7 @@ my @dest_detail = map { new FS::rate_detail { 'ratenum' => $ratenum, map { $_ => $cgi->param("$_$ratenum") } - qw( min_included min_charge sec_granularity classnum ) + qw( min_included conn_charge conn_sec min_charge sec_granularity classnum ) }; } qsearch('rate', {} ); diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 515d89e91..0d2c007f1 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -11,7 +11,6 @@ die "access denied" $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; my $svcnum = $1; -my $error; my $old; if ( $svcnum ) { @@ -32,6 +31,18 @@ foreach (map { $_,$_."_threshold" } qw( upbytes downbytes totalbytes )) { $cgi->param($_, FS::UI::bytecount::parse_bytecount($cgi->param($_)) ); } +#unmunge cgp_accessmodes (falze laziness-ish w/part_svc.pm::process &svc_domain) +unless ( $cgi->param('cgp_accessmodes') ) { + $cgi->param('cgp_accessmodes', + join(' ', + sort map { /^cgp_accessmodes_([\w\/]+)$/ or die "no way"; $1; } + grep $cgi->param($_), + grep /^cgp_accessmodes_([\w\/]+)$/, + $cgi->param() + ) + ); +} + my %hash = $svcnum ? $old->hash : (); map { $hash{$_} = scalar($cgi->param($_)); @@ -40,27 +51,31 @@ map { } (fields('svc_acct'), qw ( pkgnum svcpart usergroup )); my $new = new FS::svc_acct ( \%hash ); +my $error = ''; + $new->_password($old->_password) if $old; -if( $cgi->param('clear_password') eq '*HIDDEN*' - or $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) { +if ( $cgi->param('clear_password') eq '*HIDDEN*' + || $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) { die "fatal: no previous account to recall hidden password from!" unless $old; -} -else { +} else { $error = $new->set_password($cgi->param('clear_password')); } if ( $svcnum ) { - foreach (grep { $old->$_ != $new->$_ } qw( seconds upbytes downbytes totalbytes )) { + foreach ( grep { $old->$_ != $new->$_ } + qw( seconds upbytes downbytes totalbytes ) + ) + { my %hash = map { $_ => $new->$_ } grep { $new->$_ } qw( seconds upbytes downbytes totalbytes ); - $error = $new->set_usage(\%hash); #unoverlimit and trigger radius changes - last; #once is enough + $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes + last; #once is enough } $error ||= $new->replace($old); } else { - $error = $new->insert; + $error ||= $new->insert; $svcnum = $new->svcnum; } diff --git a/httemplate/edit/process/svc_domain.cgi b/httemplate/edit/process/svc_domain.cgi index 59b518097..381339bc8 100755 --- a/httemplate/edit/process/svc_domain.cgi +++ b/httemplate/edit/process/svc_domain.cgi @@ -15,6 +15,30 @@ $FS::svc_domain::whois_hack = 1; $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; my $svcnum = $1; +#unmunge cgp_accessmodes (falze laziness-ish w/part_svc.pm::process & svc_acct) +unless ( $cgi->param('cgp_accessmodes') ) { + $cgi->param('cgp_accessmodes', + join(' ', + sort map { /^cgp_accessmodes_([\w\/]+)$/ or die "no way"; $1; } + grep $cgi->param($_), + grep /^cgp_accessmodes_([\w\/]+)$/, + $cgi->param() + ) + ); +} + +#unmunge acct_def_cgp_accessmodes (falze laziness-ahoy) +unless ( $cgi->param('acct_def_cgp_accessmodes') ) { + $cgi->param('acct_def_cgp_accessmodes', + join(' ', + sort map { /^acct_def_cgp_accessmodes_([\w\/]+)$/ or die "no way"; $1; } + grep $cgi->param($_), + grep /^acct_def_cgp_accessmodes_([\w\/]+)$/, + $cgi->param() + ) + ); +} + my $new = new FS::svc_domain ( { map { $_, scalar($cgi->param($_)); @@ -24,10 +48,10 @@ my $new = new FS::svc_domain ( { my $error = ''; if ($cgi->param('svcnum')) { - $error="Can't modify a domain!"; + $error = $new->replace(); } else { - $error=$new->insert; - $svcnum=$new->svcnum; + $error = $new->insert; + $svcnum = $new->svcnum; } </%init> diff --git a/httemplate/edit/process/svc_external.html b/httemplate/edit/process/svc_external.html new file mode 100644 index 000000000..3515afc4b --- /dev/null +++ b/httemplate/edit/process/svc_external.html @@ -0,0 +1,10 @@ +<% include( 'elements/svc_Common.html', + 'table' => 'svc_external', + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +</%init> diff --git a/httemplate/edit/process/svc_mailinglist.html b/httemplate/edit/process/svc_mailinglist.html new file mode 100644 index 000000000..580f6ccbd --- /dev/null +++ b/httemplate/edit/process/svc_mailinglist.html @@ -0,0 +1,11 @@ +<% include( 'elements/svc_Common.html', + 'table' => 'svc_mailinglist', + 'fields' => [ fields('svc_mailinglist'), 'listname' ], + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +</%init> diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html index 27a703cdf..e02ec5ccc 100644 --- a/httemplate/edit/process/svc_phone.html +++ b/httemplate/edit/process/svc_phone.html @@ -1,5 +1,6 @@ <% include( 'elements/svc_Common.html', 'table' => 'svc_phone', + 'args_callback' => $args_callback, ) %> <%init> @@ -7,4 +8,22 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? +my $args_callback = sub { + my( $cgi, $object ) = @_; + + my %opt = (); + if ( $cgi->param('locationnum') == -1 ) { + my $cust_location = new FS::cust_location { + map { $_ => scalar($cgi->param($_)) } + qw( custnum address1 address2 city county state zip country ) + }; + $opt{'cust_location'} = $cust_location; + } + + %opt; + +}; + + + </%init> diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index c96fa6c81..64ad3a289 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -147,7 +147,7 @@ function bill_now_changed (what) { <SCRIPT TYPE="text/javascript"> Calendar.setup({ inputField: "start_date_text", - ifFormat: "%m/%d/%Y", + ifFormat: "<% $date_format %>", button: "start_date_button", align: "BR" }); @@ -250,6 +250,7 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('One-time charge'); my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; my $custnum = $1; diff --git a/httemplate/edit/rate_detail.html b/httemplate/edit/rate_detail.html index dd8c3f6b3..869ace8d4 100644 --- a/httemplate/edit/rate_detail.html +++ b/httemplate/edit/rate_detail.html @@ -6,6 +6,8 @@ 'dest_regionname' => 'Region', 'dest_prefixes_short' => 'Prefix(es)', 'min_included' => 'Included minutes/calls', + 'conn_charge' => 'Connection charge', + 'conn_sec' => 'For', 'min_charge' => 'Charge per minute/call', 'sec_granularity' => 'Granularity', 'classnum' => 'Usage class', @@ -17,6 +19,13 @@ { field=>'dest_regionname', type=>'fixed', }, { field=>'dest_prefixes_short', type=>'fixed', }, { field=>'min_included', type=>'text', size=>5 }, + { field=>'conn_charge', type=>'money', size=>4 }, + { field =>'conn_sec', + type =>'select', + options => [ keys %conn_secs ], + labels => \%conn_secs, + disable_empty => 1, + }, { field=>'min_charge', type=>'money', size=>4 }, { field =>'sec_granularity', type =>'select', @@ -38,9 +47,9 @@ <%once> tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); </%once> - <%init> my $conf = new FS::Conf; diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index 9ca3a3569..f77c0dbe7 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -52,6 +52,12 @@ <FONT SIZE=-1>Included<BR>minutes/calls</FONT> </TH> <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Connection<BR>charge</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> + <FONT SIZE=-1>Connection<BR>charge for</FONT> + </TH> + <TH CLASS="grid" BGCOLOR="#cccccc"> <FONT SIZE=-1>Charge per<BR>minute/call</FONT> </TH> <TH CLASS="grid" BGCOLOR="#cccccc"> @@ -88,7 +94,20 @@ </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - $<INPUT TYPE="text" SIZE=6 NAME="min_charge<%$n%>" VALUE="<% $cgi->param("min_charge$n") || $rate_detail->min_charge |h %>"> + <%$money_char%><INPUT TYPE="text" SIZE=9 NAME="conn_charge<%$n%>" VALUE="<% $cgi->param("conn_charge$n") || $rate_detail->conn_charge |h %>"> + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <SELECT NAME="conn_sec<%$n%>"> +% foreach my $conn_sec ( keys %conn_secs ) { +% my $curr_value = $cgi->param("conn_sec$n") || $rate_detail->conn_sec; +% my $selected = ($conn_sec==$curr_value) ? ' SELECTED' : ''; + <OPTION VALUE="<% $conn_sec %>" <%$selected%>><% $conn_secs{$conn_sec} %></OPTION> +% } + </TD> + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <%$money_char%><INPUT TYPE="text" SIZE=6 NAME="min_charge<%$n%>" VALUE="<% $cgi->param("min_charge$n") || $rate_detail->min_charge |h %>"> </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> @@ -125,12 +144,19 @@ </FORM> <% include('/elements/footer.html') %> +<%once> + +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); +</%once> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + my $rate_region; if ( $cgi->param('error') ) { $rate_region = new FS::rate_region ( { diff --git a/httemplate/edit/svc_Common.html b/httemplate/edit/svc_Common.html index 6666d9720..3da72d2e8 100644 --- a/httemplate/edit/svc_Common.html +++ b/httemplate/edit/svc_Common.html @@ -1,7 +1,7 @@ <% include('elements/svc_Common.html', 'table' => $table, 'post_url' => popurl(1). "process/svc_Common.html", - %opt, + %opt, ) %> <%init> diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index afbd002c1..99e4b74a4 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -54,7 +54,7 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> %}else{ <INPUT TYPE="hidden" NAME="clear_password" VALUE="<% $password %>"> %} -<INPUT TYPE="hidden" NAME="_password_encoding" VALUE="<% $password_encoding %>"> +<INPUT TYPE="hidden" NAME="_password_encoding" VALUE="<% $svc_acct->_password_encoding %>"> % %my $sec_phrase = $svc_acct->sec_phrase; %if ( $conf->exists('security_phrase') @@ -122,7 +122,27 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> </TD> </TR> % } -% + + +% if ( $communigate ) { + + <TR> + <TD ALIGN="right">Aliases</TD> + <TD><INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_acct->cgp_aliases %>"></TD> + </TR> + +% } else { + <INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_acct->cgp_aliases %>"> +% } + + +<% include('/elements/tr-select-svc_pbx.html', + 'curr_value' => $svc_acct->pbxsvc, + 'part_svc' => $part_svc, + 'cust_pkg' => $cust_pkg, + ) +%> + %#pop %my $popnum = $svc_acct->popnum || 0; %if ( $part_svc->part_svc_column('popnum')->columnflag eq 'F' ) { @@ -234,31 +254,119 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> </TD> </TR> % } -% if ( $part_svc->part_svc_column('quota')->columnflag eq 'F' ) { +% if ( $communigate +% && $part_svc->part_svc_column('cgp_type')->columnflag ne 'F' ) +% { + + <TR> + <TD ALIGN="right">Mailbox type</TD> + <TD> + <SELECT NAME="cgp_type"> +% foreach my $option (qw( MultiMailbox TextMailbox MailDirMailbox +% AGrade BGrade CGrade )) { + <OPTION VALUE="<% $option %>" + <% $option eq $svc_acct->cgp_type() ? 'SELECTED' : '' %> + ><% $option %> +% } + </SELECT> + </TD> + </TR> + +% } else { + <INPUT TYPE="hidden" NAME="cgp_type" VALUE="<% $svc_acct->cgp_type() %>"> +% } + + +% #false laziness w/svc_domain +% if ( $communigate +% && $part_svc->part_svc_column('cgp_accessmodes')->columnflag ne 'F' ) +% { + + <TR> + <TD ALIGN="right">Enabled services</TD> + <TD> + <% include( '/elements/communigate_pro-accessmodes.html', + 'curr_value' => $svc_acct->cgp_accessmodes, + ) + %> + </TD> + </TR> + +% } else { + <INPUT TYPE="hidden" NAME="cgp_accessmodes" VALUE="<% $svc_acct->cgp_accessmodes() |h %>"> +% } + + +% if ( $part_svc->part_svc_column('quota')->columnflag eq 'F' ) { <INPUT TYPE="hidden" NAME="quota" VALUE="<% $svc_acct->quota %>"> -% } else { +% } else { +% my $quota_label = $communigate ? 'Mail storage limit' : 'Quota'; + <TR> + <TD ALIGN="right"><% $quota_label %></TD> + <TD><INPUT TYPE="text" NAME="quota" VALUE="<% $svc_acct->quota %>"></TD> + </TR> +% } + +% tie my %cgp_label, 'Tie::IxHash', +% 'file_quota' => 'File storage limit', +% 'file_maxnum' => 'Number of files limit', +% 'file_maxsize' => 'File size limit', +% ; +% +% foreach my $key (keys %cgp_label) { +% +% if ( !$communigate || $part_svc->part_svc_column($key)->columnflag eq 'F' ){ + <INPUT TYPE="hidden" NAME="<%$key%>" VALUE="<% $svc_acct->$key() |h %>"> +% } else { + + <TR> + <TD ALIGN="right"><% $cgp_label{$key} %></TD> + <TD><INPUT TYPE="text" NAME="<% $key %>" VALUE="<% $svc_acct->$key() |h %>"></TD> + </TR> + +% } +% } +% if ( $communigate ) { +%# false laziness w/svc_domain acct_def <TR> - <TD ALIGN="right">Quota:</TD> - <TD><INPUT TYPE="text" NAME="quota" VALUE="<% $svc_acct->quota %>"></TD> + <TD ALIGN="right">Message delete method</TD> + <TD> + <SELECT NAME="cgp_deletemode"> +% for ( 'Move To Trash', 'Immediately', 'Mark' ) { + <OPTION VALUE="<% $_ %>" + <% $_ eq $svc_acct->cgp_deletemode ? 'SELECTED' : '' %> + ><% $_ %> +% } + </SELECT> + </TD> + </TR> + + <TR> + <TD ALIGN="right">On logout remove trash</TD> + <TD><INPUT TYPE="text" NAME="cgp_emptytrash" VALUE="<% $svc_acct->cgp_emptytrash %>"></TD> </TR> -% } -% if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) { +% } else { - <INPUT TYPE="hidden" NAME="slipip" VALUE="<% $svc_acct->slipip %>"> -% } else { + <INPUT TYPE="hidden" NAME="cgp_deletemode" VALUE="<% $svc_acct->cgp_deletemode %>"> + <INPUT TYPE="hidden" NAME="cgp_emptytrash" VALUE="<% $svc_acct->cgp_emptytrash %>"> + +% } +% if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) { + <INPUT TYPE="hidden" NAME="slipip" VALUE="<% $svc_acct->slipip %>"> +% } else { <TR> <TD ALIGN="right">IP</TD> <TD><INPUT TYPE="text" NAME="slipip" VALUE="<% $svc_acct->slipip %>"></TD> </TR> % } -% + % my %label = ( seconds => 'Time', % upbytes => 'Upload bytes', % downbytes => 'Download bytes', @@ -392,6 +500,9 @@ if ( $cgi->param('error') ) { } +my $communigate = scalar($part_svc->part_export('communigate_pro')); + # || scalar($part_svc->part_export('communigate_pro_singledomain')); + my( $cust_pkg, $cust_main ) = ( '', '' ); if ( $pkgnum ) { $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum } ); @@ -440,22 +551,17 @@ my $svc = $part_svc->getfield('svc'); my $otaker = getotaker; my $username = $svc_acct->username; -my $password; -my $password_encryption = $svc_acct->_password_encryption; -my $password_encoding = $svc_acct->_password_encoding; - -if($svcnum) { - if($password = $svc_acct->get_cleartext_password) { - if (! $conf->exists('showpasswords')) { - $password = '*HIDDEN*'; - } - } - elsif($svc_acct->_password and $password_encryption ne 'plain') { + +my $password = ''; +if ( $cgi->param('error') ) { + $password = $cgi->param('clear_password'); +} elsif ( $svcnum ) { + my $password_encryption = $svc_acct->_password_encryption; + if ( $password = $svc_acct->get_cleartext_password ) { + $password = '*HIDDEN*' unless $conf->exists('showpasswords'); + } elsif( $svc_acct->_password and $password_encryption ne 'plain' ) { $password = "(".uc($password_encryption)." encrypted)"; } - else { - $password = ''; - } } my $ulen = diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index 8a108f891..b11fec7a7 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -63,12 +63,12 @@ my $callback = sub { if $fieldref->{field} eq 'blocknum'; $fieldref->{value} = $object->addr_block->label - if $fieldref->{field} eq 'block_label'; + if $fieldref->{field} eq 'block_label' && $object->addr_block; } else { if ($fieldref->{field} eq 'block_label') { - if ($fixedblock) { + if ($fixedblock && $object->addr_block) { $object->blocknum($fixedblock); $fieldref->{value} = $object->addr_block->label; }else{ @@ -93,7 +93,8 @@ my $callback = sub { && $FS::CurrentUser::CurrentUser->agentnum($_->agentnum) } map { $_->addr_block } $object->allowed_routers; - my @options = map { $_->blocknum } @addr_block; + my @options = map { $_->blocknum } + sort { $a->label cmp $b->label } @addr_block; my %option_labels = map { ( $_->blocknum => $_->label ) } @addr_block; $fieldref->{type} = 'select'; $fieldref->{options} = \@options; diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index 10079ce98..78faf12b2 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -8,10 +8,18 @@ <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>"> <% ntable("#cccccc",2) %> + <TR> -<P>Domain <INPUT TYPE="text" NAME="domain" VALUE="<% $domain %>" SIZE=28 MAXLENGTH=63> -<BR> + <TD ALIGN="right">Domain</TD> + <TD> +% if ( !$svcnum || $conf->exists('svc_domain-edit_domain') ) { + <INPUT TYPE="text" NAME="domain" VALUE="<% $domain %>" SIZE=28 MAXLENGTH=63> +% } else { + <B><% $domain %></B> +% } + % if ($export) { +<BR> Available top-level domains: <% $export->option('tlds') %> </TR> @@ -27,11 +35,161 @@ Available top-level domains: <% $export->option('tlds') %> </TR> % } - -<TR> -<P><INPUT TYPE="submit" VALUE="Submit"> + </TD> </TR> + +% if ( $communigate ) { + <TR> + <TD ALIGN="right">Administrator domain</TD> + <TD> + <% include('/elements/select-domain.html', + 'element_name' => 'parent_svcnum', + 'curr_value' => $svc_domain->parent_svcnum, + 'empty_label' => '(none)', + ) + %> + </TD> + </TR> +% } else { + <INPUT TYPE="hidden" NAME="parent_svcnum" VALUE="<% $svc_domain->parent_svcnum %>"> +% } + +% if ( $communigate +% && $part_svc->part_svc_column('max_accounts')->columnflag !~ /^[FA]$/ ) { + + <TR> + <TD ALIGN="right">Aliases</TD> + <TD><INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_domain->cgp_aliases %>"></TD> + </TR> + +% } else { + <INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_domain->cgp_aliases %>"> +% } + +% if ( $part_svc->part_svc_column('max_accounts')->columnflag =~ /^[FA]$/ ) { + <INPUT TYPE="hidden" NAME="max_accounts" VALUE="<% $svc_domain->max_accounts %>"> +% } else { + <TR> + <TD ALIGN="right">Maximum number of accounts</TD> + <TD> + <INPUT TYPE="text" NAME="max_accounts" SIZE=5 MAXLENGTH=6 VALUE="<% $svc_domain->max_accounts %>"> + </TD> + </TR> +% } + +% if ( $communigate +% && $part_svc->part_svc_column('cgp_accessmodes')->columnflag ne 'F' ) +% { + + <TR> + <TD ALIGN="right">Enabled services</TD> + <TD> + <% include( '/elements/communigate_pro-accessmodes.html', + 'curr_value' => $svc_domain->cgp_accessmodes, + ) + %> + </TD> + </TR> + +% } else { + <INPUT TYPE="hidden" NAME="cgp_accessmodes" VALUE="<% $svc_domain->cgp_accessmodes() |h %>"> +% } + </TABLE> +<BR> + +% if ( $communigate ) { + +Account defaults +<% ntable("#cccccc",2) %> + + <% include('/elements/tr-checkbox.html', + 'label' =>'Password modification', + 'field' => 'acct_def_password_selfchange', + 'curr_value' => $svc_domain->acct_def_password_selfchange, + 'value' => 'Y', + ) + %> + <% include('/elements/tr-checkbox.html', + 'label' =>'Password recovery', + 'field' => 'acct_def_password_recover', + 'curr_value' => $svc_domain->acct_def_password_recover, + 'value' => 'Y', + ) + %> + + <TR> + <TD ALIGN="right">Enabled services + </TD> + <TD><% include('/elements/communigate_pro-accessmodes.html', + 'element_name_prefix' => 'acct_def_cgp_accessmodes_', + 'curr_value' => $svc_domain->acct_def_cgp_accessmodes, + ) + %> + </TD> + </TR> + + <% include('/elements/tr-input-text.html', + 'label' => 'Mail storage limit', + 'field' => 'acct_def_quota', + 'curr_value' => $svc_domain->acct_def_quota, + ) + %> + <% include('/elements/tr-input-text.html', + 'label' => 'File storage limit', + 'field' => 'acct_def_file_quota', + 'curr_value' => $svc_domain->acct_def_file_quota, + ) + %> + <% include('/elements/tr-input-text.html', + 'label' => 'Files limit', + 'field' => 'acct_def_file_maxnum', + 'curr_value' => $svc_domain->acct_def_file_maxnum, + ) + %> + <% include('/elements/tr-input-text.html', + 'label' => 'File size limit', + 'field' => 'acct_def_file_maxsize', + 'curr_value' => $svc_domain->acct_def_file_maxsize, + ) + %> + +%# false laziness w/svc_acct acct_def + <TR> + <TD ALIGN="right">Message delete method</TD> + <TD> + <SELECT NAME="acct_def_cgp_deletemode"> +% for ( 'Move To Trash', 'Immediately', 'Mark' ) { + <OPTION VALUE="<% $_ %>" + <% $_ eq $svc_domain->acct_def_cgp_deletemode ? 'SELECTED' : '' %> + ><% $_ %> +% } + </SELECT> + </TD> + </TR> + + <% include('/elements/tr-input-text.html', + 'label' => 'On logout remove trash', + 'curr_value' => $svc_domain->acct_def_cgp_emptytrash, + ) + %> + +</TABLE> +<BR> + +% } else { + +% foreach my $f (qw( password_selfchange password_recover cgp_accessmodes +% quota file_quota file_maxnum file_maxsize +% cgp_deletemode cgp_emptytrash +% )) { + <INPUT TYPE="hidden" NAME="acct_def_<%$f%>" VALUE="<% $svc_domain->get("acct_def_$f") %>"> +% } + +% } + +<INPUT TYPE="submit" VALUE="Submit"> + </FORM> <% include('/elements/footer.html') %> @@ -41,6 +199,8 @@ Available top-level domains: <% $export->option('tlds') %> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? +my $conf = new FS::Conf; + my($svcnum, $pkgnum, $svcpart, $kludge_action, $part_svc, $svc_domain); if ( $cgi->param('error') ) { @@ -94,19 +254,14 @@ my $action = $svcnum ? 'Edit' : 'Add'; my $svc = $part_svc->getfield('svc'); -my @exports = $part_svc->part_export(); - -my $registrar; -my $export; +my $communigate = scalar($part_svc->part_export('communigate_pro')); + # || scalar($part_svc->part_export('communigate_pro_singledomain')); # Find the first export that does domain registration -foreach (@exports) { - $export = $_ if $_->can('registrar'); -} +my @exports = grep $_->can('registrar'), $part_svc->part_export; +my $export = $exports[0]; # If we have a domain registration export, get the registrar object -if ($export) { - $registrar = $export->registrar; -} +my $registrar = $export ? $export->registrar : ''; my $otaker = getotaker; diff --git a/httemplate/edit/svc_external.cgi b/httemplate/edit/svc_external.cgi index 0df842b21..54aa11f42 100644 --- a/httemplate/edit/svc_external.cgi +++ b/httemplate/edit/svc_external.cgi @@ -1,102 +1 @@ -<% include('/elements/header.html', "External service $action") %> - -<% include('/elements/error.html') %> - -<FORM ACTION="<%$p1%>process/svc_external.cgi" METHOD=POST> - -<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>"> -Service #<B><% $svcnum ? $svcnum : "(NEW)" %></B> -<BR><BR> - -<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>"> - -<INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>"> - -% my $id = $svc_external->id; -% my $title = $svc_external->title; -% -<% &ntable("#cccccc",2) %> - <TR> - <TD ALIGN="right">External ID</TD> - <TD><INPUT TYPE="text" NAME="id" VALUE="<% $id %>"></TD> - </TR> - <TR> - <TD ALIGN="right">Title</TD> - <TD><INPUT TYPE="text" NAME="title" VALUE="<% $title %>"></TD> - </TR> - -% foreach my $field ($svc_external->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. - <% $svc_external->pvf($field)->widget( 'HTML', - 'edit', - $svc_external->getfield($field) - ) - %> -% } -% } - -</TABLE> -<BR> - -<INPUT TYPE="submit" VALUE="Submit"> -</FORM> - -<% include('/elements/footer.html') %> - -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? - -my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_external ); -if ( $cgi->param('error') ) { - - $svc_external = new FS::svc_external ( { - map { $_, scalar($cgi->param($_)) } fields('svc_external') - } ); - $svcnum = $svc_external->svcnum; - $pkgnum = $cgi->param('pkgnum'); - $svcpart = $cgi->param('svcpart'); - $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - die "No part_svc entry!" unless $part_svc; - -} elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding - - $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; - $pkgnum = $1; - $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; - $svcpart = $1; - - $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - die "No part_svc entry!" unless $part_svc; - - $svc_external = new FS::svc_external { svcpart => $svcpart }; - - $svcnum=''; - - $svc_external->set_default_and_fixed; - -} else { #adding - - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/ or die "unparsable svcnum"; - $svcnum=$1; - $svc_external=qsearchs('svc_external',{'svcnum'=>$svcnum}) - or die "Unknown (svc_external) svcnum!"; - - my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) - 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; - -} -my $action = $svc_external->svcnum ? 'Edit' : 'Add'; - -my $p1 = popurl(1); - -</%init> +<% include( 'elements/svc_Common.html', 'table'=>'svc_external' ) %> diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index 96a00a5aa..73f6465b9 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -32,24 +32,35 @@ function dstchanged(what) { </SCRIPT> <% ntable("#cccccc",2) %> -<TR><TD ALIGN="right">Email to</TD> -<TD><SELECT NAME="srcsvc" SIZE=1 onChange="srcchanged(this)"> -% foreach $_ (keys %email) { - - <OPTION<% $_ eq $srcsvc ? " SELECTED" : "" %> VALUE="<% $_ %>"><% $email{$_} %></OPTION> -% } -% if ( $svc_forward->dbdef_table->column('src') ) { - - <OPTION <% $src ? 'SELECTED' : '' %> VALUE="0">(other email address)</OPTION> -% } -</SELECT> -% if ( $svc_forward->dbdef_table->column('src') ) { - -<INPUT TYPE="text" NAME="src" VALUE="<% $src %>" <% ( $src || !scalar(%email) ) ? '' : 'DISABLED STYLE="background-color: lightgrey"' %>> -% } - -</TD></TR> +<TR> + <TD ALIGN="right">Email to</TD> + <TD> +% if ( $conf->exists('svc_forward-no_srcsvc') ) { + <INPUT NAME="srcsrc" TYPE="hidden" VALUE="0"> +% } else { + <SELECT NAME="srcsvc" SIZE=1 onChange="srcchanged(this)"> +% foreach $_ (keys %email) { + <OPTION VALUE="<% $_ %>" + <% $_ eq $srcsvc ? 'SELECTED' : '' %> + ><% $email{$_} %></OPTION> +% } + <OPTION VALUE="0" <% $src ? 'SELECTED' : '' %> + >(other email address)</OPTION> + </SELECT> +% } + +% my $src_disabled = $src +% || $conf->exists('svc_forward-no_srcsvc') +% || !scalar(%email); + <INPUT NAME = "src" + TYPE = "text" + VALUE = "<% $src %>" + <% $src_disabled ? '' : 'DISABLED STYLE="background-color: lightgrey"' %> + > + + </TD> +</TR> <TR><TD ALIGN="right">Forwards to</TD> <TD><SELECT NAME="dstsvc" SIZE=1 onChange="dstchanged(this)"> diff --git a/httemplate/edit/svc_mailinglist.cgi b/httemplate/edit/svc_mailinglist.cgi new file mode 100644 index 000000000..c7c739daa --- /dev/null +++ b/httemplate/edit/svc_mailinglist.cgi @@ -0,0 +1,25 @@ +<% include( 'elements/svc_Common.html', + 'table' => 'svc_mailinglist', + 'fields' => \@fields, + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? + +my @fields = ( + 'username', + { field=>'domsvc', type=>'select-svc-domain', + #label => 'List address domain', + }, + { field=>'listnum', type=>'hidden', }, + { field=>'listname', type=>'text', }, + { field=>'reply_to', type=>'checkbox', value=>'Y' }, + { field=>'remove_from', type=>'checkbox', value=>'Y' }, + { field=>'reject_auto', type=>'checkbox', value=>'Y' }, + { field=>'remove_to_and_cc', type=>'checkbox', value=>'Y' }, + +); + +</%init> diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi index d7629ab6f..b77d96233 100644 --- a/httemplate/edit/svc_phone.cgi +++ b/httemplate/edit/svc_phone.cgi @@ -1,22 +1,21 @@ <% include( 'elements/svc_Common.html', - 'name' => 'Phone number', 'table' => 'svc_phone', - 'fields' => [ 'countrycode', - { field => 'phonenum', - type => 'select-did', - label => 'Phone number', - }, - 'sip_password', - 'pin', - 'phone_name', - ], + 'fields' => \@fields, 'labels' => { + 'svcnum' => 'Service', 'countrycode' => 'Country code', 'phonenum' => 'Phone number', + 'domsvc' => 'Domain', 'sip_password' => 'SIP password', 'pin' => 'Voicemail PIN', 'phone_name' => 'Name', + 'pbxsvc' => 'PBX', + 'locationnum' => 'E911 location', }, + 'svc_new_callback' => sub { + my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_; + $svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg; + }, ) %> <%init> @@ -24,4 +23,55 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? +my $conf = new FS::Conf; + +my @fields = ( 'countrycode', + { field => 'phonenum', + type => 'select-did', + label => 'Phone number', + }, + ); + +push @fields, { field => 'domsvc', + type => 'select-svc-domain', + label => 'Domain', + } + if $conf->exists('svc_phone-domain'); + +push @fields, { field => 'pbxsvc', + type => 'select-svc_pbx', + label => 'PBX', + }, + 'sip_password', + 'pin', + { field => 'phone_name', + type => 'text', + maxlength => $conf->config('svc_phone-phone_name-max_length'), + }, + + { value => 'E911 Information', + type => 'tablebreak-tr-title', + colspan => 7, + }, + { field => 'locationnum', + type => 'select-cust_location', + label => 'E911 location', + include_opt_callback => sub { + my $svc_phone = shift; + my $pkgnum = $svc_phone->get('pkgnum') + || $cgi->param('pkgnum') + || $svc_phone->cust_svc->pkgnum; #hua? + #cross agent location exposure? sheesh + my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}); + my $cust_main = $cust_pkg ? $cust_pkg->cust_main : ''; + ( 'no_bold' => 1, + 'cust_pkg' => $cust_pkg, + 'cust_main' => $cust_main, + ); + }, + }, + { field => 'custnum', type=> 'hidden' }, #for new cust_locations +; + + </%init> |