diff options
Diffstat (limited to 'httemplate/misc')
41 files changed, 421 insertions, 96 deletions
diff --git a/httemplate/misc/areacodes.cgi b/httemplate/misc/areacodes.cgi index 4b31deb00..afbe93e91 100644 --- a/httemplate/misc/areacodes.cgi +++ b/httemplate/misc/areacodes.cgi @@ -1,4 +1,4 @@ -<% encode_json(\@areacodes) %>\ +<% encode_json({ error => $error, areacodes => \@areacodes}) %>\ <%init> my( $state, $svcpart ) = $cgi->param('arg'); @@ -7,6 +7,8 @@ my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } ); die "unknown svcpart $svcpart" unless $part_svc; my @areacodes = (); +my $error; + if ( $state ) { my @exports = $part_svc->part_export_did; @@ -17,9 +19,12 @@ if ( $state ) { } my $export = $exports[0]; - my $something = $export->get_dids('state'=>$state); + local $@; + local $SIG{__DIE__}; + my $something = eval { $export->get_dids('state'=>$state) }; + $error = $@; - @areacodes = @{ $something }; + @areacodes = @{ $something } if $something; } diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html index c80b2b278..d3ca9964f 100755 --- a/httemplate/misc/cancel_pkg.html +++ b/httemplate/misc/cancel_pkg.html @@ -45,12 +45,41 @@ } &> <& /elements/tr-checkbox.html, - 'label' => mt("Uncancel even if a service can't be re-provisioned"), + 'label' => mt("Uncancel even if service reprovisioning fails"), 'field' => 'svc_not_fatal', 'value' => 'Y', &> % $date_init = 1; +% my @uncancel_svcs = sort { $b->{'reprovisionable'} <=> $a->{'reprovisionable'} } +% sort { $a->{'svcpart'} <=> $b->{'svcpart'} } +% $cust_pkg->uncancel_svc_summary(); +% if (@uncancel_svcs) { +<TR><TD COLSPAN="2"> </TD></TR> +<TR><TH ALIGN="right"><% emt("Re-provision the following services") %></TH><TD></TD> +% foreach my $uncancel_svc (@uncancel_svcs) { +% my $uncancel_curr_value = $uncancel_svc->{'uncancel_svcnum'}; +% my $uncancel_disabled = ''; +% my $uncancel_postfix = ''; +% if ($cgi->param('error')) { +% $uncancel_curr_value = '' unless grep { $_ == $uncancel_svc->{'uncancel_svcnum'} } $cgi->param('only_svcnum'); +% } +% unless ($uncancel_svc->{'reprovisionable'}) { +% $uncancel_curr_value = ''; +% $uncancel_disabled = 1; +% $uncancel_postfix = '<I>(' . emt('Cannot be reprovisioned') . ')</I>'; +% } + <& /elements/tr-checkbox.html, + 'label' => $uncancel_svc->{'svc'} . ': ' . $uncancel_svc->{'label'}, + 'field' => 'only_svcnum', + 'value' => $uncancel_svc->{'uncancel_svcnum'}, + 'curr_value' => $uncancel_curr_value, + 'disabled' => $uncancel_disabled, + 'cell_style' => 'font-weight: normal', + 'postfix' => $uncancel_postfix, + &> +% } +% } % } % unless ( $method eq 'resume' || $method eq 'uncancel' ) { @@ -62,7 +91,7 @@ &> % } -% if ( $method eq 'adjourn' || $method eq 'suspend' ) { +% if (( $method eq 'adjourn' || $method eq 'suspend' ) && $curuser->access_right('Customize billing during suspension')) { <TR><TD COLSPAN=2> % if ( $part_pkg->option('suspend_bill', 1) ) { <& /elements/checkbox.html, name=>'no_suspend_bill', value=>'Y' &> diff --git a/httemplate/misc/change_pkg_start.html b/httemplate/misc/change_pkg_date.html index 5a890c86e..642a5b89e 100755 --- a/httemplate/misc/change_pkg_start.html +++ b/httemplate/misc/change_pkg_date.html @@ -3,11 +3,12 @@ <& /elements/error.html &> % # only slightly different from unhold_pkg. -<FORM NAME="MyForm" ACTION="process/change_pkg_start.html" METHOD=POST> +<FORM NAME="MyForm" ACTION="process/change_pkg_date.html" METHOD=POST> <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>"> +<INPUT TYPE="hidden" NAME="field" VALUE="<% $field %>"> <BR> -<% emt('Start billing [_1]', $part_pkg->pkg_comment(cust_pkg => $cust_pkg)) %> +<% emt(($isstart ? 'Start billing' : 'Set contract end for').' [_1]', $part_pkg->pkg_comment(cust_pkg => $cust_pkg)) %> <UL STYLE="padding-left: 3ex; list-style: none; background-color: #cccccc"> <LI> <& /elements/radio.html, @@ -16,7 +17,7 @@ value => 'now', curr_value => $when, &> - <label for="when_now"><% emt('Immediately') %></label> + <label for="when_now"><% emt($isstart ? 'Now' : 'Never') %></label> </LI> % if ( $next_bill_date ) { <LI> @@ -41,13 +42,13 @@ &> <label for="when_date"> <% emt('On this date:') %> </label> <& /elements/input-date-field.html, - { name => 'start_date', - value => $cgi->param('start_date') || $cust_pkg->start_date, + { name => 'date_value', + value => $cgi->param('date_value') || $cust_pkg->get($field), } &> </LI> </UL> -<INPUT TYPE="submit" NAME="submit" VALUE="<% emt('Set start date') %>"> +<INPUT TYPE="submit" NAME="submit" VALUE="<% emt('Set '.($isstart ? 'start date' : 'contract end')) %>"> </FORM> </BODY> @@ -55,9 +56,21 @@ <%init> +my $field = $cgi->param('field'); + +my ($acl, $isstart); +if ($field eq 'start_date') { + $acl = 'Change package start date'; + $isstart = 1; +} elsif ($field eq 'contract_end') { + $acl = 'Change package contract end date'; +} else { + die "Unknown date field"; +} + my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" - unless $curuser->access_right('Change package start date'); + unless $curuser->access_right($acl); my $pkgnum; if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { @@ -69,7 +82,7 @@ if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { my $conf = new FS::Conf; my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -my $title = 'Start billing package'; +my $title = $isstart ? 'Start billing package' : 'Change contract end'; my $cust_pkg = qsearchs({ table => 'cust_pkg', @@ -83,12 +96,12 @@ my $next_bill_date = $cust_pkg->cust_main->next_bill_date; my $part_pkg = $cust_pkg->part_pkg; # defaults: -# sticky on error, then the existing start date if any, then the customer's +# sticky on error, then the existing date if any, then the customer's # next bill date, and if none of those, default to now my $when = $cgi->param('when'); if (!$when) { - if ($cust_pkg->start_date) { + if ($cust_pkg->get($field)) { $when = 'date'; } elsif ($next_bill_date) { $when = 'next_bill_date'; diff --git a/httemplate/misc/confirm-address_standardize.html b/httemplate/misc/confirm-address_standardize.html index 9d1a5c135..8bd43ca54 100644 --- a/httemplate/misc/confirm-address_standardize.html +++ b/httemplate/misc/confirm-address_standardize.html @@ -7,6 +7,9 @@ th { line-height: 150%; vertical-align: middle; text-align: center; } +button { + width: 215px; +} </STYLE> <CENTER><BR><B> % if ( $is_error ) { @@ -23,9 +26,13 @@ Confirm address standardization % my $name = $pre eq 'bill_' ? 'billing' : 'service'; % my $rows = 5; % if ( $new{$pre.'error'} ) { +% # Standardization returned an error, so the user can either "continue +% # without replacing" (replace = "") or "abort". <TR> <TD ROWSPAN=<% $rows %> CLASS="td_radio"> +% if ( $show_radio ) { <INPUT TYPE="radio" NAME="<% $pre %>replace" VALUE="" CHECKED="Y"> +% } # else confirm_manual_address will be called </TD> <TH>Entered <%$name%> address </TH> @@ -51,15 +58,19 @@ Confirm address standardization % $rows++ if !$new{$pre.'addr_clean'}; <TR> <TD ROWSPAN=<% $rows %> CLASS="td_radio"> +% if ( $show_radio ) { <INPUT TYPE="radio" NAME="<% $pre %>replace" VALUE=""> +% } </TD> <TH>Entered <%$name%> address</TH> <TH>Standardized <%$name%> address</TH> <TD ROWSPAN=<% $rows %> CLASS="td_radio"> +% if ( $show_radio ) { <INPUT TYPE="radio" NAME="<% $pre %>replace" VALUE="Y" CHECKED="Y"> +% } </TD> </TR> -% if ( !$new{$pre.'addr_clean'} ) { +% if ( !$new{$pre.'addr_clean'} ) { # we incremented $rows to fit this in <TR> <TD></TD> <TH STYLE="font-size:smaller;color:#ff0000">(unverified)</TH> @@ -88,18 +99,24 @@ Confirm address standardization % } # if error % } # for $pre -%# only do this part if address standardization provided a censustract -% my $pre = $old{same} ? 'bill_' : 'ship_'; +% # the prefix for the censustract +% my $pre = $old{billship} ? +% ( $old{same} ? 'bill_' : 'ship_' ) : +% ''; % my $censustract = $new{$pre.'censustract'}; % if ( $censustract ) { <TR> <TD ROWSPAN=2 CLASS="td_radio"> +% if ( $show_radio ) { <INPUT TYPE="radio" NAME="census_replace" VALUE="" <% $census_error ? 'CHECKED="Y"' : '' %>> +% } </TD> <TH>Entered census tract</TH> <TH>Calculated census tract</TH> <TD ROWSPAN=2 CLASS="td_radio"> +% if ( $show_radio ) { <INPUT TYPE="radio" NAME="census_replace" VALUE="Y" <% $census_error ? '' : 'CHECKED="Y"' %>> +% } </TD> </TR> <TR> @@ -115,17 +132,40 @@ Confirm address standardization % } #if censustract <TR> +% if ( $show_radio ) { +% # One button: "use selected address(es)". + <TD ALIGN="center" COLSPAN=4> + <BUTTON TYPE="button" onclick="replace_address();"> + <IMG SRC="<%$p%>images/<% $is_error ? 'error.png' : 'tick.png' %>" + ALT=""> + Use selected <%$addresses%> + </BUTTON> + </TD> +% } else { +% # Two buttons: "use entered address", and "use selected address" +% # and empty columns before and after <TD> </TD> <TD ALIGN="center"> - <BUTTON TYPE="button" STYLE="width:205px" onclick="replace_address();"> - <IMG SRC="<%$p%>images/<% $is_error ? 'error.png' : 'tick.png' %>" - ALT=""> Use selected <%$addresses%> - </BUTTON></TD> + <BUTTON TYPE="button" onclick="confirm_manual_address();"> + <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered <%$addresses%> + </BUTTON> + </TD> +% # disable the button if standardization completely failed <TD ALIGN="center"> - <BUTTON TYPE="button" STYLE="width:205px" onclick="submit_abort();"> - <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission - </BUTTON></TD> + <BUTTON TYPE="button" onclick="replace_address();" <% $failed ? 'DISABLED' : '' %>> + <IMG SRC="<%$p%>images/tick.png" ALT=""> Use standardized <%$addresses%> + </BUTTON> + </TD> <TD> </TD> +% } + </TR> +% # always provide a cancel button + <TR> + <TD ALIGN="center" COLSPAN=4> + <BUTTON TYPE="button" onclick="submit_abort();"> + <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission + </BUTTON> + </TD> </TR> </TABLE> </FORM> @@ -138,15 +178,43 @@ my %old = %{ $q->{old} }; my %new = %{ $q->{new} }; my $addresses = $old{billship} ? 'addresses' : 'address'; +my $show_radio = 0; +my $failed = 0; # true if standardization returned no addresses my @prefixes = (''); + if ( $old{same} ) { + + # Then there are bill and ship addresses and they're the same. Treat + # bill_error as a failure, and let the user accept or reject the whole + # standardization. + @prefixes = ('bill_'); + $failed = 1 if $new{'bill_error'}; + } elsif ( $old{billship} ) { + + # There are separate bill and ship addresses. Treat error in both as a + # failure. Otherwise, at least one of them has a choice between entered + # and standardized address, so let the user choose. + @prefixes = ('bill_', 'ship_'); + if ( $new{'bill_error'} and $new{'ship_error'} ) { + $failed = 1; + } else { + $show_radio = 1; + } + +} else { + + # There are no bill/ship addresses (this is used for package locations). + # Treat like the first case but without the bill_ prefix. + @prefixes = (''); + $failed = 1 if $new{'error'}; + } -my $census_error = $new{'census_error'}; +my $census_error = $new{'census_error'}; # seems to be unused my $is_error = $census_error || grep { $new{$_.'error'} } @prefixes; </%init> diff --git a/httemplate/misc/cust_credit-import.html b/httemplate/misc/cust_credit-import.html index 937010dd6..a124c9591 100644 --- a/httemplate/misc/cust_credit-import.html +++ b/httemplate/misc/cust_credit-import.html @@ -62,15 +62,16 @@ Import a file containing credits. Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. The file should have a .CSV or .XLS extension. <BR><BR> - <b>Default</b> format has the following field order: <i>custnum, amount, reasonnum, invnum</i><br> + <b>Default</b> format has the following field order: <i>custnum, amount, reasonnum, invnum, agent_custid</i><br> <BR><BR> Field information: <ul> - <li><i>custnum</i>: Customer number - <li><i>amount</i>: - <li><i>reasonnum</i>: <A HREF="<%$p%>browse/reason_type.html?class=R">Credit reason</A> - <li><i>invnum</i>: Invoice number + <li><i>custnum</i>: This is the freeside customer number. It may be left blank. If specified, agent_custid must be blank.</li> + <li><i>amount</i>:</li> + <li><i>reasonnum</i>: <A HREF="<%$p%>browse/reason_type.html?class=R">Credit reason</A></li> + <li><i>invnum</i>: Invoice number</li> + <li><i>agent_custid</i>: This is the reseller's idea of the customer number or identifier. It may be left blank. If specified, custnum must be blank.</li> </ul> <BR><BR> diff --git a/httemplate/misc/cust_main-cancel.cgi b/httemplate/misc/cust_main-cancel.cgi index f6fd1e915..73c4deb7a 100755 --- a/httemplate/misc/cust_main-cancel.cgi +++ b/httemplate/misc/cust_main-cancel.cgi @@ -1,6 +1,6 @@ <& /elements/header-popup.html, mt("Customer cancelled") &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/cust_main-suspend.cgi b/httemplate/misc/cust_main-suspend.cgi index 7a501d61a..e81e2b490 100755 --- a/httemplate/misc/cust_main-suspend.cgi +++ b/httemplate/misc/cust_main-suspend.cgi @@ -1,6 +1,6 @@ <& /elements/header-popup.html, mt("Customer suspended") &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/cust_main-unsuspend.cgi b/httemplate/misc/cust_main-unsuspend.cgi index e8ac8d31e..99ec70a23 100755 --- a/httemplate/misc/cust_main-unsuspend.cgi +++ b/httemplate/misc/cust_main-unsuspend.cgi @@ -1,6 +1,6 @@ <& /elements/header-popup.html, mt("Customer unsuspended") &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/delete-addr_range.html b/httemplate/misc/delete-addr_range.html index c6310e9b1..239332d23 100644 --- a/httemplate/misc/delete-addr_range.html +++ b/httemplate/misc/delete-addr_range.html @@ -3,7 +3,7 @@ % } else { <& /elements/header-popup.html, "Address range deleted" &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/delete-rate_detail.html b/httemplate/misc/delete-rate_detail.html index 30856a73a..b4d31b379 100755 --- a/httemplate/misc/delete-rate_detail.html +++ b/httemplate/misc/delete-rate_detail.html @@ -3,7 +3,7 @@ % } else { <% header('Rate deleted') %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> % } diff --git a/httemplate/misc/did_order_confirmed.html b/httemplate/misc/did_order_confirmed.html index 53dbb2f3a..3cc121c6f 100644 --- a/httemplate/misc/did_order_confirmed.html +++ b/httemplate/misc/did_order_confirmed.html @@ -14,7 +14,7 @@ die "access denied" my $action = $1; my $header = ''; my $popup = ''; -my $js = 'window.top.location.reload();'; +my $js = 'topreload();'; $cgi->param('ordernum') =~ /^(\d+)$/ or die 'illegal ordernum'; my $ordernum = $1; diff --git a/httemplate/misc/disable-cust_location.cgi b/httemplate/misc/disable-cust_location.cgi index ee7ba1dbc..677f0b891 100755 --- a/httemplate/misc/disable-cust_location.cgi +++ b/httemplate/misc/disable-cust_location.cgi @@ -1,6 +1,6 @@ <% header("Location disabled") %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/disable-msg_template.cgi b/httemplate/misc/disable-msg_template.cgi index 1eb4d25e5..565eb2cee 100644 --- a/httemplate/misc/disable-msg_template.cgi +++ b/httemplate/misc/disable-msg_template.cgi @@ -3,7 +3,7 @@ % } else { <& /elements/header-popup.html, "Template ${actioned}" &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html index 8e2863455..d086c676d 100644 --- a/httemplate/misc/email-customers.html +++ b/httemplate/misc/email-customers.html @@ -7,8 +7,8 @@ selecting an existing msg_template, or creating a custom message, and shows a preview of the message before sending. If linked to as a popup, include the cgi parameter 'popup' for proper header handling. -This may also be used as an element in other pages, enabling you to provide an -alternate initial form while using this for search freezing/thawing and +This may also be used as an element in other pages, enabling you to provide +an alternate initial form while using this for search freezing/thawing and preview/send actions, with the following options: acl - the access right to use (defaults to 'Bulk send customer notices') @@ -48,6 +48,7 @@ from/subject/body cgi params <INPUT TYPE="hidden" NAME="search" VALUE="<% encode_base64(nfreeze(\%search)) %>"> <INPUT TYPE="hidden" NAME="popup" VALUE="<% $popup %>"> <INPUT TYPE="hidden" NAME="url" VALUE="<% $url | h %>"> +<INPUT TYPE="hidden" NAME="to_contact_classnum" VALUE="<% join(',', @contact_classnum) %>"> % if ( $cgi->param('preview') ) { % # preview mode: at this point we have a msg_template (either "real" or @@ -57,7 +58,7 @@ from/subject/body cgi params <FONT SIZE="+2">Preview notice</FONT> <& /elements/progress-init.html, 'OneTrueForm', - [ qw( search table msgnum ) ], + [ qw( search table msgnum to_contact_classnum ) ], $process_url, $pdest, &> @@ -79,6 +80,10 @@ from/subject/body cgi params <td><% $from |h %></td> </tr> + <& /elements/tr-td-label.html, 'label' => 'To contacts:' &> + <td><% join('<BR>', @contact_classname) %></td> + </tr> + <& /elements/tr-td-label.html, 'label' => 'Subject:' &> <td><% $subject |h %></td> </tr> @@ -158,6 +163,20 @@ Template: &> <BR> % } +% # select destination contact classes +Send to contacts: + <& /elements/checkboxes.html, + 'style' => 'display: inline; vertical-align: top', + 'disable_links' => 1, + 'names_list' => \@contact_checkboxes, + 'element_name_prefix' => 'contact_class_', + 'checked_callback' => sub { + my($cgi, $name) = @_; + $name eq 'invoice' #others default to unchecked + }, + &> +<BR> +% # if sending a one-off message, show a form to edit it <TABLE BGCOLOR="#cccccc" CELLSPACING=0 WIDTH="100%" id="table_no_template"> <& /elements/tr-td-label.html, 'label' => 'From:' &> <TD><& /elements/input-text.html, @@ -262,6 +281,9 @@ if ( $cgi->param('msgnum') =~ /^(\d+)$/ ) { or die "template not found: ".$cgi->param('msgnum'); } +my @contact_classnum; +my @contact_classname; + my $subject = $cgi->param('subject'); my $body = $cgi->param('body'); my ($html_body, $text_body); @@ -337,6 +359,28 @@ if ( !$cgi->param('preview') ) { $subject = $1; } } + + # contact_class_X params + foreach my $param ( $cgi->multi_param ) { + if ( $param =~ /^contact_class_(\w+)$/ ) { + push @contact_classnum, $1; + if ( $1 eq 'invoice' ) { + push @contact_classname, 'Invoice recipients'; + } else { + my $contact_class = FS::contact_class->by_key($1); + push @contact_classname, encode_entities($contact_class->classname); + } + } + } } +my @contact_checkboxes = ( + [ 'invoice' => { label => 'Invoice recipients' } ] +); +foreach my $class (qsearch('contact_class', { disabled => '' })) { + push @contact_checkboxes, [ + $class->classnum, + { label => $class->classname } + ]; +} </%init> diff --git a/httemplate/misc/exchanges.cgi b/httemplate/misc/exchanges.cgi index 0de4ace25..d62679191 100644 --- a/httemplate/misc/exchanges.cgi +++ b/httemplate/misc/exchanges.cgi @@ -1,4 +1,4 @@ -<% encode_json(\@exchanges) %>\ +<% encode_json({ error => $error, exchanges => \@exchanges}) %>\ <%init> my( $areacode, $svcpart ) = $cgi->param('arg'); @@ -7,6 +7,8 @@ my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } ); die "unknown svcpart $svcpart" unless $part_svc; my @exchanges = (); +my $error; + if ( $areacode ) { my @exports = $part_svc->part_export_did; @@ -17,9 +19,12 @@ if ( $areacode ) { } my $export = $exports[0]; - my $something = $export->get_dids('areacode'=>$areacode); + local $@; + local $SIG{__DIE__}; + my $something = eval { $export->get_dids('areacode'=>$areacode) }; + $error = $@; - @exchanges = @{ $something }; + @exchanges = @{ $something } if $something; } diff --git a/httemplate/misc/make_appointment.html b/httemplate/misc/make_appointment.html index 6f308e0a8..79c3c2c89 100644 --- a/httemplate/misc/make_appointment.html +++ b/httemplate/misc/make_appointment.html @@ -6,13 +6,10 @@ <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cgi->param('custnum') |h %>"> -% my @sched_item = qsearch('sched_item', { 'disabled' => '', }); -% my @username = map $_->access_user->username, @sched_item; -% foreach my $username (@username) { - <INPUT TYPE="hidden" NAME="username" VALUE="<% $username |h %>"> -% } - -Length: +<TABLE> +<TR> +<TD STYLE="text-align: right">Length:</TD> +<TD> <SELECT NAME="LengthMin"> % for ( my $hours = .5; $hours < 10.5; $hours += .5 ) { % my $min = $hours * 60; @@ -21,9 +18,26 @@ Length: ><% $hours %> hour<% $hours > 1 ? 's' : '' %> % } </SELECT> -<BR> -<BR> +</TD> +</TR> + +% my @sched_item = qsearch('sched_item', { 'disabled' => '', }); +% my @username = map $_->access_user->username, @sched_item; + +<TR> +<TD STYLE="text-align: right">Installer:</TD> +<TD> +<SELECT NAME="username" ID="username_select" MULTIPLE> +% foreach my $username (@username) { + <OPTION SELECTED><% $username |h %></OPTION> +% } +</SELECT> +</TD> +</TR> +</TABLE> + +<BR> <INPUT TYPE="submit" VALUE="Schedule appointment"> </FORM> diff --git a/httemplate/misc/phonenums.cgi b/httemplate/misc/phonenums.cgi index 62923ac62..aae04f5d1 100644 --- a/httemplate/misc/phonenums.cgi +++ b/httemplate/misc/phonenums.cgi @@ -1,4 +1,4 @@ -<% encode_json(\@phonenums) %>\ +<% encode_json({ error => $error, phonenums => \@phonenums}) %>\ <%init> my( $exchangestring, $svcpart ) = $cgi->param('arg'); @@ -7,6 +7,7 @@ my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } ); die "unknown svcpart $svcpart" unless $part_svc; my @phonenums = (); +my $error; if ( $exchangestring ) { @@ -35,8 +36,12 @@ if ( $exchangestring ) { $opts{'exchange'} = $exchange; } - my $something = $export->get_dids(%opts); - @phonenums = @{ $something }; + local $@; + local $SIG{__DIE__}; + my $something = eval { $export->get_dids(%opts) }; + $error = $@; + + @phonenums = @{ $something } if $something; } diff --git a/httemplate/misc/post_fsinc-invoice.cgi b/httemplate/misc/post_fsinc-invoice.cgi new file mode 100644 index 000000000..94eaf667e --- /dev/null +++ b/httemplate/misc/post_fsinc-invoice.cgi @@ -0,0 +1,43 @@ +% my $title = $error ? 'Error printing and mailing invoice' : 'Invoice printed and mailed'; +<% include('/elements/header-popup.html', $title ) %> +<DIV STYLE="text-align: center;"> +<SPAN STYLE="color: red; font-weight: bold;"><% $error %></SPAN><BR> +<BUTTON TYPE="button" onClick="parent.cClick();">Close</BUTTON> +</DIV> +<% include('/elements/footer-popup.html') %> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Print and mail invoices'); + +my $invnum = $cgi->param('invnum'); + +my $template = $cgi->param('template'); +my $notice_name = $cgi->param('notice_name') if $cgi->param('notice_name'); +my $no_coupon = $cgi->param('no_coupon'); + +#XXX agent-virt +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}) + or die "Unknown invnum\n"; + +my $mode; +if ( $cgi->param('mode') =~ /^(\d+)$/ ) { + $mode = $1; +} +$cust_bill->set('mode' => $mode) if $mode; + +#these methods die instead of return errors, so, handle that without a backtrace +local $@; +my $letter_id = + eval { $cust_bill->postal_mail_fsinc( 'template' => $template, + 'notice_name' => $notice_name, + 'no_coupon' => $no_coupon, + ); + }; +my $error = "$@"; + +$error ||= 'Unknown print and mail error: no letter ID returned' + unless $letter_id; + +</%init> diff --git a/httemplate/misc/process/bulk_pkg_increment_bill.cgi b/httemplate/misc/process/bulk_pkg_increment_bill.cgi index 0d8417b26..8da849508 100755 --- a/httemplate/misc/process/bulk_pkg_increment_bill.cgi +++ b/httemplate/misc/process/bulk_pkg_increment_bill.cgi @@ -4,7 +4,7 @@ %} else { <% header('Packages Adjusted') %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> % } diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html index c7a43979d..46ba06a6d 100755 --- a/httemplate/misc/process/cancel_pkg.html +++ b/httemplate/misc/process/cancel_pkg.html @@ -1,6 +1,6 @@ <% header(emt("Package $past_method")) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> @@ -33,8 +33,10 @@ $method =~ /^(cancel|expire|suspend|adjourn|resume|uncancel)$/ $method = $1; my $past_method = $past{$method}; +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right($right{$method}); + unless $curuser->access_right($right{$method}); #untaint pkgnum my $pkgnum = $cgi->param('pkgnum'); @@ -60,7 +62,8 @@ if ( $method eq 'suspend' ) { #or 'adjourn' $options = { map { $_ => scalar($cgi->param($_)) } qw( suspend_bill no_suspend_bill ) - }; + } + if $curuser->access_right('Customize billing during suspension'); } my $cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} ); @@ -82,6 +85,8 @@ my $bill = my $svc_fatal = ( $cgi->param('svc_not_fatal') ne 'Y' ); +my $only_svcnum = ($method eq 'uncancel') ? [ $cgi->param('only_svcnum') ] : undef; + $error ||= $cust_pkg->$method( 'reason' => $reasonnum, 'date' => $date, 'resume_date' => $resume_date, @@ -89,6 +94,7 @@ $error ||= $cust_pkg->$method( 'reason' => $reasonnum, 'bill' => $bill, 'svc_fatal' => $svc_fatal, 'options' => $options, + 'only_svcnum' => $only_svcnum, ); if ($error) { diff --git a/httemplate/misc/process/change_pkg_contact.html b/httemplate/misc/process/change_pkg_contact.html index 2795c1197..5bf896200 100644 --- a/httemplate/misc/process/change_pkg_contact.html +++ b/httemplate/misc/process/change_pkg_contact.html @@ -1,6 +1,6 @@ <% header(emt("Package contact $past_method")) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/process/change_pkg_start.html b/httemplate/misc/process/change_pkg_date.html index 17a8518f9..3084ec538 100755 --- a/httemplate/misc/process/change_pkg_start.html +++ b/httemplate/misc/process/change_pkg_date.html @@ -6,9 +6,21 @@ </HTML> <%init> +my $field = $cgi->param('field'); + +my ($acl, $isstart); +if ($field eq 'start_date') { + $acl = 'Change package start date'; + $isstart = 1; +} elsif ($field eq 'contract_end') { + $acl = 'Change package contract end date'; +} else { + die "Unknown date field"; +} + my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" - unless $curuser->access_right('Change package start date'); + unless $curuser->access_right($acl); $cgi->param('pkgnum') =~ /^(\d+)$/ or die "illegal pkgnum"; @@ -24,23 +36,25 @@ my $cust_pkg = qsearchs({ my $cust_main = $cust_pkg->cust_main; my $error; -my $start_date; +my $date_value; if ( $cgi->param('when') eq 'now' ) { - # start it the next time billing runs - $start_date = ''; + # blank start means start it the next time billing runs ("Now") + # blank contract end means it never ends ("Never") + $date_value = ''; } elsif ( $cgi->param('when') eq 'next_bill_date' ) { - $start_date = $cust_main->next_bill_date; + $date_value = $cust_main->next_bill_date; } elsif ( $cgi->param('when') eq 'date' ) { - $start_date = parse_datetime($cgi->param('start_date')); + $date_value = parse_datetime($cgi->param('date_value')); } -if ( $cust_pkg->setup ) { +if ( $isstart && $cust_pkg->setup ) { # shouldn't happen $error = 'This package has already started billing.'; } else { local $FS::UID::AutoCommit = 0; foreach my $pkg ($cust_pkg, $cust_pkg->supplemental_pkgs) { - $pkg->set('start_date', $start_date); + last if $error; + $pkg->set($field, $date_value); $error ||= $pkg->replace; } $error ? dbh->rollback : dbh->commit; @@ -48,6 +62,6 @@ if ( $cust_pkg->setup ) { if ( $error ) { $cgi->param('error', $error); - print $cgi->redirect($fsurl.'misc/change_pkg_start.html?', $cgi->query_string); + print $cgi->redirect($fsurl.'misc/change_pkg_date.html?', $cgi->query_string); } </%init> diff --git a/httemplate/misc/process/cust_bill-promised_date.html b/httemplate/misc/process/cust_bill-promised_date.html index 721a763eb..f390609c7 100644 --- a/httemplate/misc/process/cust_bill-promised_date.html +++ b/httemplate/misc/process/cust_bill-promised_date.html @@ -1,4 +1,4 @@ -<SCRIPT TYPE="text/javascript">window.top.location.reload()</SCRIPT> +<SCRIPT TYPE="text/javascript">topreload()</SCRIPT> <%init> # XXX ACL? die "access denied" diff --git a/httemplate/misc/process/delay_susp_pkg.html b/httemplate/misc/process/delay_susp_pkg.html index 675da0496..15a3c963c 100755 --- a/httemplate/misc/process/delay_susp_pkg.html +++ b/httemplate/misc/process/delay_susp_pkg.html @@ -1,6 +1,6 @@ <% header($msg) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/process/enable_or_disable_tax.html b/httemplate/misc/process/enable_or_disable_tax.html index 9b7324b0d..8a7a559a0 100755 --- a/httemplate/misc/process/enable_or_disable_tax.html +++ b/httemplate/misc/process/enable_or_disable_tax.html @@ -4,7 +4,7 @@ <% include('/elements/header-popup.html', $title) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> diff --git a/httemplate/misc/process/nms-add_iface.html b/httemplate/misc/process/nms-add_iface.html index 79e685686..cbd0fc048 100644 --- a/httemplate/misc/process/nms-add_iface.html +++ b/httemplate/misc/process/nms-add_iface.html @@ -1,6 +1,6 @@ <& /elements/header-popup.html, 'Interface added' &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> <%init> diff --git a/httemplate/misc/process/nms-add_router.html b/httemplate/misc/process/nms-add_router.html index c3b42a8d3..a4c3423da 100644 --- a/httemplate/misc/process/nms-add_router.html +++ b/httemplate/misc/process/nms-add_router.html @@ -1,6 +1,6 @@ <& /elements/header-popup.html, 'Router added' &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> <%init> diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index d232fe729..7768f921f 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -86,7 +86,7 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { $payinfo = $cust_payby->payinfo; $paymask = $cust_payby->paymask; - $paycvv = ''; + $paycvv = $cust_payby->paycvv; # pass it if we got it, running a transaction will clear it ( $month, $year ) = $cust_payby->paydate_mon_year; $payname = $cust_payby->payname; diff --git a/httemplate/misc/process/recharge_svc.html b/httemplate/misc/process/recharge_svc.html index 2d49f6b06..88a1f7f36 100755 --- a/httemplate/misc/process/recharge_svc.html +++ b/httemplate/misc/process/recharge_svc.html @@ -4,7 +4,7 @@ %} else { <% header("Package recharged") %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> %} diff --git a/httemplate/misc/process/set_page_pref.html b/httemplate/misc/process/set_page_pref.html new file mode 100644 index 000000000..a7f123116 --- /dev/null +++ b/httemplate/misc/process/set_page_pref.html @@ -0,0 +1,12 @@ +<%init> +my $path = $cgi->param('path'); +my $name = $cgi->param('name'); +my $tablenum = $cgi->param('num') || ''; +my $value = $cgi->param('value'); + +my $error = $FS::CurrentUser::CurrentUser->set_page_pref($path, $name, $tablenum, $value); +my $result = { 'error' => $error }; # in case someone cares + +http_header('Content-Type', 'application/json'); +</%init> +<% encode_json($result) %> diff --git a/httemplate/misc/process/unhold_pkg.html b/httemplate/misc/process/unhold_pkg.html index 694048023..7e54262c6 100755 --- a/httemplate/misc/process/unhold_pkg.html +++ b/httemplate/misc/process/unhold_pkg.html @@ -1,6 +1,6 @@ <& /elements/header-popup.html &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/process/void-cust_bill.html b/httemplate/misc/process/void-cust_bill.html index 7773b0ba9..32a2fc591 100755 --- a/httemplate/misc/process/void-cust_bill.html +++ b/httemplate/misc/process/void-cust_bill.html @@ -4,7 +4,7 @@ %} else { <& /elements/header-popup.html, 'Invoice voided' &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> %} diff --git a/httemplate/misc/reason-merge.html b/httemplate/misc/reason-merge.html index 14f5ebb84..b7e4df454 100644 --- a/httemplate/misc/reason-merge.html +++ b/httemplate/misc/reason-merge.html @@ -1,7 +1,7 @@ % if ($success) { <% include('/elements/header-popup.html', 'Reason Merge Success') %> <SCRIPT> -window.top.location.reload() +topreload() </SCRIPT> % } else { <% include('/elements/header-popup.html', 'Merge Reasons') %> diff --git a/httemplate/misc/regions.cgi b/httemplate/misc/regions.cgi index 31538b08e..882dd48df 100644 --- a/httemplate/misc/regions.cgi +++ b/httemplate/misc/regions.cgi @@ -1,4 +1,4 @@ -<% encode_json(\@regions) %>\ +<% encode_json({ error => $error, regions => \@regions}) %>\ <%init> my( $state, $svcpart ) = $cgi->param('arg'); @@ -7,6 +7,8 @@ my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } ); die "unknown svcpart $svcpart" unless $part_svc; my @regions = (); +my $error; + if ( $state ) { my @exports = $part_svc->part_export_did; @@ -17,9 +19,12 @@ if ( $state ) { } my $export = $exports[0]; - my $something = $export->get_dids('state'=>$state); + local $@; + local $SIG{__DIE__}; + my $something = eval { $export->get_dids('state'=>$state) }; + $error = $@; - @regions = @{ $something }; + @regions = @{ $something } if $something; } diff --git a/httemplate/misc/sector-create_map.html b/httemplate/misc/sector-create_map.html new file mode 100644 index 000000000..6af5fddbe --- /dev/null +++ b/httemplate/misc/sector-create_map.html @@ -0,0 +1,10 @@ +<% $server->process %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); # ??? + +my $server = + new FS::UI::Web::JSRPC 'FS::tower_sector::process_generate_coverage', $cgi; + +</%init> diff --git a/httemplate/misc/tax-fetch_and_import.cgi b/httemplate/misc/tax-fetch_and_import.cgi index 33a6c9b01..970d47c32 100644 --- a/httemplate/misc/tax-fetch_and_import.cgi +++ b/httemplate/misc/tax-fetch_and_import.cgi @@ -29,8 +29,9 @@ Import a tax data update. <TR> <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px"> <INPUT TYPE = "submit" + NAME = "submitButton" VALUE = "Download and Import" - onClick = "document.TaxRateImport.submit.disabled=true; process();" + onClick = "document.TaxRateImport.submitButton.disabled=true; process();" > </TD> </TR> diff --git a/httemplate/misc/tax-fetch_and_replace.cgi b/httemplate/misc/tax-fetch_and_replace.cgi index 3290a3c44..ff64e6320 100644 --- a/httemplate/misc/tax-fetch_and_replace.cgi +++ b/httemplate/misc/tax-fetch_and_replace.cgi @@ -29,8 +29,9 @@ Replace tax data. <TR> <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px"> <INPUT TYPE = "submit" + NAME = "submitButton" VALUE = "Download and Import" - onClick = "document.TaxRateImport.submit.disabled=true; process();" + onClick = "document.TaxRateImport.submitButton.disabled=true; process();" > </TD> </TR> diff --git a/httemplate/misc/tower-export.html b/httemplate/misc/tower-export.html new file mode 100644 index 000000000..9d63640f0 --- /dev/null +++ b/httemplate/misc/tower-export.html @@ -0,0 +1,36 @@ +<%init> +# currently, browse/tower just shows all towers, so do the same here +my @towers = qsearch({ table => 'tower' }); +http_header('Content-Type' => 'text/csv'); +http_header('Content-Disposition' => 'attachment;filename=towers.csv'); +if ( $cgi->param('format') eq 'tc' ) { + # towercoverage.com format: not a true CSV, no quoting (so no way to include + # commas in any field, so we strip them) + + # lat/long are signed decimals, northeast positive + # height is in meters + # Description/Group are not necessary + # sector/antenna information (orientation, beamwidth, gain, frequency, + # etc.) is in what TC calls a "Coverage", which can't be edited this way. + my $text = "SiteName,Latitude,Longitude,Description,Group,Height\n"; + + foreach my $tower (@towers) { + next if ( !$tower->latitude or !$tower->longitude ); + + my $name = $tower->towername; + my $height = ($tower->height || 0) / 3.28; + $name =~ s(,)( )g; + $text .= join(',', + $name, + $tower->latitude, + $tower->longitude, + '', + '', + $height, + ) . "\n"; + } + $m->print($text); +} else { + die('unknown format '.$cgi->param('format')); +} +</%init> diff --git a/httemplate/misc/void-cust_credit.html b/httemplate/misc/void-cust_credit.html index 1e71f0030..81ba31d54 100755 --- a/httemplate/misc/void-cust_credit.html +++ b/httemplate/misc/void-cust_credit.html @@ -1,7 +1,7 @@ %if ( $success ) { <& /elements/header-popup.html, mt("Credit voided") &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/misc/xmlhttp-address_standardize.html b/httemplate/misc/xmlhttp-address_standardize.html index d0255a02a..be58618d0 100644 --- a/httemplate/misc/xmlhttp-address_standardize.html +++ b/httemplate/misc/xmlhttp-address_standardize.html @@ -23,6 +23,7 @@ if ( $old{same} ) { @prefixes = ('bill_', 'ship_'); } my $all_same = 1; +my $all_clean = 1; foreach my $pre ( @prefixes ) { my $location = { @@ -48,8 +49,13 @@ foreach my $pre ( @prefixes ) { $old{$pre.'censustract'} ne $new{$pre.'censustract'} ); $all_same = 0 if $new{$pre.'error'}; + + $all_clean = 0 if !$new{$pre.'addr_clean'}; } -my $return = { old => \%old, new => \%new, all_same => $all_same }; +my $return = { old => \%old, + new => \%new, + all_same => $all_same, + all_clean => $all_clean }; warn "result:\n".encode_json($return) if $DEBUG; </%init> diff --git a/httemplate/misc/xmlhttp-ticket-update.html b/httemplate/misc/xmlhttp-ticket-update.html index bd58b95c6..01fb1b44d 100644 --- a/httemplate/misc/xmlhttp-ticket-update.html +++ b/httemplate/misc/xmlhttp-ticket-update.html @@ -8,14 +8,18 @@ my $username = $cgi->param('username'); my $ticket = FS::TicketSystem->get_ticket_object( \%session, ticket_id=>$id ); -#hmm, this should happen in a single transaction and either commit or rollback, -# but in reality failures "Don't Happen" so its not like a ticket gets -# half changed +#hmm, this should happen in a single transaction and either commit or rollback my $return; if ( $ticket ) { - my($orv, $omsg) = $ticket->SetOwner( $username, 'Steal' ); + my $curowner = $ticket->OwnerObj->Name; + my($orv, $omsg); + if (( $curowner eq $FS::CurrentUser::CurrentUser->username ) or ( $curowner eq 'nobody' )) { + ($orv, $omsg) = $ticket->SetOwner( $username ); + } else { + ($orv, $omsg) = $ticket->SetOwner( $username, 'Steal' ); + } $orv = 1 if ! $orv && $omsg =~ /already own/i; if ( $orv ) { @@ -42,15 +46,18 @@ if ( $ticket ) { my %hash = $m->comp('/rt/Ticket/Elements/Customers', Ticket => $ticket); my @cust_main = values( %{$hash{cust_main}} ); + my $timelabel = FS::sched_avail::pretty_time($sh*60+$sm). '-'. + FS::sched_avail::pretty_time($eh*60+$em); + my $titlelabel = encode_entities($cust_main[0]->_FreesideURILabel); + $return = { 'error' => '', #'starts' => $starts, #'due' => $due, #'username' => $username, #false laziness w/CalendarSlotSchedule - 'sched_label' => - FS::sched_avail::pretty_time($sh*60+$sm). '-'. - FS::sched_avail::pretty_time($eh*60+$em). ': '. - encode_entities($cust_main[0]->_FreesideURILabel), + 'sched_label' => $timelabel . ': ' . $titlelabel, + 'sched_label_time' => $timelabel, + 'sched_label_title' => $titlelabel, }; } else { $return = { 'error' => $smsg }; |
