From 847c27d7683856f420ed5306cb0ca395f1a6eb60 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 12 Aug 2014 16:52:09 -0700 Subject: popup view for collapsed packages, #25130, #27305 --- httemplate/view/cust_main/packages/contact.html | 2 ++ httemplate/view/cust_main/packages/hidden.html | 14 +++++++++++-- httemplate/view/cust_main/packages/section.html | 11 ++++++++-- httemplate/view/cust_pkg-popup.html | 27 +++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 httemplate/view/cust_pkg-popup.html (limited to 'httemplate') diff --git a/httemplate/view/cust_main/packages/contact.html b/httemplate/view/cust_main/packages/contact.html index 0f0cde71f..10c584c8c 100644 --- a/httemplate/view/cust_main/packages/contact.html +++ b/httemplate/view/cust_main/packages/contact.html @@ -10,10 +10,12 @@ ( <%pkg_detach_link($cust_pkg)%> ) % } +
% } elsif ( $show_contact_link && ! $opt{no_links} ) { ( <%pkg_add_contact_link($cust_pkg)%> ) +
% } <%init> diff --git a/httemplate/view/cust_main/packages/hidden.html b/httemplate/view/cust_main/packages/hidden.html index e3bd0fabf..35eda8c46 100644 --- a/httemplate/view/cust_main/packages/hidden.html +++ b/httemplate/view/cust_main/packages/hidden.html @@ -18,13 +18,13 @@ <% time2str('%b %o, %Y', $cust_pkg->get('cancel')) %> % if ( $pkgpart_change ) { - from <% $part_pkg->pkg |h %> - <% $part_pkg->custom_comment |h %> + from <% $popup_link |n %><% $part_pkg->pkg |h %> - <% $part_pkg->custom_comment |h %> % } % if ( $pkgpart_change and $location_change ) {
% } % if ( $location_change ) { - from <% $cust_pkg->location_label %> + from <% $popup_link |n %><% $cust_pkg->location_label %> % } @@ -52,4 +52,14 @@ my $pkgpart_change = ($next->pkgpart != $cust_pkg->pkgpart); my $location_change = ($next->locationnum != $cust_pkg->locationnum); my $both_change = $pkgpart_change && $location_change; +my $onclick = + include('/elements/popup_link_onclick.html', + 'action' => $fsurl.'view/cust_pkg-popup.html?' . $cust_pkg->pkgnum, + 'actionlabel' => 'Package #'.$cust_pkg->pkgnum, + 'width' => '1000', + 'height' => '310', + 'color' => $cust_pkg->statuscolor, + ); +my $popup_link = qq(); + diff --git a/httemplate/view/cust_main/packages/section.html b/httemplate/view/cust_main/packages/section.html index 4980feeac..217e8c556 100755 --- a/httemplate/view/cust_main/packages/section.html +++ b/httemplate/view/cust_main/packages/section.html @@ -4,17 +4,22 @@ <% mt('Package') |h %> <% mt('Status') |h %> <% mt('Contact/Location') |h %> +% if (!$opt{no_services}) { <% mt('Services') |h %> +% } % #$FS::cust_pkg::DEBUG = 2; % foreach my $cust_pkg (@$packages) { +% # if requested, this can override cust_pkg-group_by_location <& .packagerow, $cust_pkg, + %conf_opt, ( map { $_ => $opt{$_} } qw( cust_main bgcolor no_links cust_location_cache before_pkg_callback before_svc_callback after_svc_callback + cust_pkg-group_by_location + no_services )), - %conf_opt &> % } % } else { # there are no packages @@ -30,10 +35,12 @@ <& package.html, %iopt &> <& status.html, %iopt &> - <& contact.html, %iopt &>
+ <& contact.html, %iopt &> <& location.html, %iopt &> +% if (!$iopt{no_services}) { <& services.html, %iopt &> +% } % # insert hidden predecessors to this package, if any % # and a rolldown button to show them diff --git a/httemplate/view/cust_pkg-popup.html b/httemplate/view/cust_pkg-popup.html new file mode 100644 index 000000000..96956c732 --- /dev/null +++ b/httemplate/view/cust_pkg-popup.html @@ -0,0 +1,27 @@ +<& /elements/header-popup.html &> + +<& cust_main/packages/section.html, + 'cust_main' => $cust_main, + 'packages' => [ $cust_pkg ], + 'cust_pkg-group_by_location' => 0, + 'no_services' => 1, +&> +
+ + +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +my ($pkgnum) = $cgi->keywords; +$pkgnum =~ /^\d+$/ or die "bad pkgnum $pkgnum"; + +my $cust_pkg = qsearchs({ + 'table' => 'cust_pkg', + 'addl_from' => 'JOIN cust_main USING (custnum)', + 'hashref' => { 'pkgnum' => $pkgnum }, + 'extra_sql' => ' AND '.$curuser->agentnums_sql, +}); +die "Package not found" unless $cust_pkg; +my $cust_main = $cust_pkg->cust_main; + +my $title = mt('Package [_1]', $pkgnum); + -- cgit v1.2.1 From e5770f1c578ba47f730488df7fb5a03307ac71ab Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Wed, 13 Aug 2014 19:19:18 -0700 Subject: avoid counting location-changed packages in total canceled packages --- httemplate/browse/part_pkg.cgi | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 63822c7c9..1eb55c88a 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -108,6 +108,14 @@ my $count_cust_pkg = " WHERE cust_pkg.pkgpart = part_pkg.pkgpart AND $agentnums_sql "; +my $count_cust_pkg_cancel = " + SELECT COUNT(*) FROM cust_pkg LEFT JOIN cust_main USING ( custnum ) + LEFT JOIN cust_pkg AS cust_pkg_next + ON (cust_pkg.pkgnum = cust_pkg_next.change_pkgnum) + WHERE cust_pkg.pkgpart = part_pkg.pkgpart + AND $agentnums_sql + AND cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0 +"; $select = " @@ -137,11 +145,16 @@ $select = " AND ( setup IS NULL OR setup = 0 ) ) AS num_on_hold, - ( $count_cust_pkg - AND cancel IS NOT NULL AND cancel != 0 + ( $count_cust_pkg_cancel + AND (cust_pkg_next.pkgnum IS NULL + OR cust_pkg_next.pkgpart != cust_pkg.pkgpart) ) AS num_cancelled "; +# About the num_cancelled expression: packages that were changed, but +# kept the same pkgpart, are considered "moved", not "canceled" (because +# this is the part_pkg UI). We could show the count of those but it's +# probably not interesting. my $html_init = qq! One or more service definitions are grouped together into a package -- cgit v1.2.1 From a8aacbc2ef8cc36bcdae327be7d0f59a1b1f3666 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 14 Aug 2014 19:42:39 -0700 Subject: adjust EFT Canada processing delay based on time of day, and warn the user, #20384 --- httemplate/misc/xmlhttp-pay_batch-note.html | 18 ++++ httemplate/search/elements/cust_pay_batch_top.html | 105 ++++++++++++--------- 2 files changed, 79 insertions(+), 44 deletions(-) create mode 100644 httemplate/misc/xmlhttp-pay_batch-note.html (limited to 'httemplate') diff --git a/httemplate/misc/xmlhttp-pay_batch-note.html b/httemplate/misc/xmlhttp-pay_batch-note.html new file mode 100644 index 000000000..ef5901631 --- /dev/null +++ b/httemplate/misc/xmlhttp-pay_batch-note.html @@ -0,0 +1,18 @@ +<% $note %>\ +<%init> + +my ($batchnum, $format) = $cgi->param('arg'); + +my $note = ''; +if ( $batchnum =~ /^(\d+)$/ ) { + my $pay_batch = FS::pay_batch->by_key($batchnum); + if ( $pay_batch and $format =~ /^(\w+)$/ ) { + my $class = "FS::pay_batch::$format"; + if ( $class->can('download_note') ) { + # now we can actually do something + $note = $class->download_note($pay_batch); + } + } +} + + diff --git a/httemplate/search/elements/cust_pay_batch_top.html b/httemplate/search/elements/cust_pay_batch_top.html index bf3047769..c502aa9a3 100644 --- a/httemplate/search/elements/cust_pay_batch_top.html +++ b/httemplate/search/elements/cust_pay_batch_top.html @@ -1,24 +1,42 @@ +<& /elements/xmlhttp.html, + 'url' => $p.'misc/xmlhttp-pay_batch-note.html', + 'subs' => [ 'get_note' ] +&> + % # Download batch % if ( $status eq 'O' % or ( $status eq 'I' and $curuser->access_right('Reprocess batches') ) % or ( $status eq 'R' and $curuser->access_right('Redownload resolved batches') ) % ) { - - - + + % if ( $fixed ) { - + % } % else { -Download batch in format % foreach ( keys %download_formats ) { - + % } - -<& .select_gateway &> + +
+
+ <& .select_gateway &> % } -

+ % } # end of download + +
% # Upload batch % if ( $pay_batch->status eq 'I' @@ -27,44 +45,42 @@ Download batch in format -<% include('/elements/form-file_upload.html', +<& /elements/form-file_upload.html, 'name' => 'FileUpload', 'action' => "${p}misc/upload-batch.cgi", 'num_files' => 1, 'fields' => [ 'batchnum', 'format', 'gatewaynum' ], 'url' => $cgi->self_url, 'message' => 'Batch results uploaded.', -) %> -Upload results
- -<% include('/elements/file-upload.html', +&> + Upload results
+ <& /elements/file-upload.html, 'field' => 'file', 'label' => 'Filename', 'no_table' => 1, -) %> - -
+ &> + +
% if ( $fixed ) { % if ( $fixed eq 'td_eft1464' ) { # special case -Upload in format + Upload in format % } % else { - + % } % } % else { -Upload in format % foreach ( keys(%upload_formats) ) { - + % } - -<& .select_gateway &> + + <& .select_gateway &> % } # if $fixed - +
% } # end upload @@ -74,12 +90,12 @@ Upload results
% and $payby eq 'CHEK' % and $conf->exists('batch-manual_approval') % ) { - +"> +
% } # end manual approval -
% # summary info Batch is <% $statustext{$status} %>
@@ -119,19 +135,19 @@ my $batchnum = $pay_batch->batchnum; my $fixed = $conf->config("batch-fixed_format-$payby"); tie my %download_formats, 'Tie::IxHash', ( -'' => 'Default batch mode', -'NACHA' => '94 byte NACHA', -'csv-td_canada_trust-merchant_pc_batch' => - 'CSV file for TD Canada Trust Merchant PC Batch', -'csv-chase_canada-E-xactBatch' => - 'CSV file for Chase Canada E-xactBatch', -'PAP' => '80 byte file for TD Canada Trust PAP Batch', -'BoM' => 'Bank of Montreal ECA batch', -'ach-spiritone' => 'Spiritone ACH batch', -'paymentech' => 'XML file for Chase Paymentech', -'RBC' => 'Royal Bank of Canada PDS batch', -'td_eft1464' => '1464 byte file for TD Commercial Banking EFT', -'eft_canada' => 'EFT Canada CSV batch', + '' => 'Default batch mode', + 'NACHA' => '94 byte NACHA', + 'csv-td_canada_trust-merchant_pc_batch' => + 'CSV file for TD Canada Trust Merchant PC Batch', + 'csv-chase_canada-E-xactBatch' => + 'CSV file for Chase Canada E-xactBatch', + 'PAP' => '80 byte file for TD Canada Trust PAP Batch', + 'BoM' => 'Bank of Montreal ECA batch', + 'ach-spiritone' => 'Spiritone ACH batch', + 'paymentech' => 'XML file for Chase Paymentech', + 'RBC' => 'Royal Bank of Canada PDS batch', + 'td_eft1464' => '1464 byte file for TD Commercial Banking EFT', + 'eft_canada' => 'EFT Canada CSV batch', # insert new batch formats here ); @@ -150,4 +166,5 @@ my $count_query = "SELECT COUNT(*) FROM cust_pay_batch WHERE batchnum=$batchnum" my $count = FS::Record->scalar_sql($count_query); my $sum_query = "SELECT SUM(amount) FROM cust_pay_batch WHERE batchnum=$batchnum"; my $total = sprintf("%.2f", FS::Record->scalar_sql($sum_query)); + -- cgit v1.2.1 From 2aa9fa43c09a1ce4474785dbdc3d462e7b23ea15 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 14 Aug 2014 19:48:28 -0700 Subject: and show the warning in the batch-fixed_format case, #20384 --- httemplate/search/elements/cust_pay_batch_top.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/elements/cust_pay_batch_top.html b/httemplate/search/elements/cust_pay_batch_top.html index c502aa9a3..a773dd009 100644 --- a/httemplate/search/elements/cust_pay_batch_top.html +++ b/httemplate/search/elements/cust_pay_batch_top.html @@ -12,6 +12,7 @@ function format_changed() { } ); } +<&| /elements/onload.js &>format_changed() % # Download batch % if ( $status eq 'O' @@ -29,10 +30,10 @@ function format_changed() { % } -
-
<& .select_gateway &> % } +
+
% } # end of download -- cgit v1.2.1 From d87c9f804b0cb7b6798bf770f753fb83022f5e6a Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 15 Aug 2014 16:08:24 -0700 Subject: SNMP export: allow manually entering OIDs, #20945 --- httemplate/edit/elements/part_export/broadband_snmp.html | 7 ++++--- httemplate/edit/process/part_export.cgi | 2 +- httemplate/elements/select-mib-popup.html | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/elements/part_export/broadband_snmp.html b/httemplate/edit/elements/part_export/broadband_snmp.html index 4c0367c5a..ebb765dee 100644 --- a/httemplate/edit/elements/part_export/broadband_snmp.html +++ b/httemplate/edit/elements/part_export/broadband_snmp.html @@ -29,7 +29,7 @@ function open_select_mib(obj) { nd(1); // if there's already one open, close it var rownum = obj.rownum; - var curr_oid = obj.value || ''; + var curr_oid = obj.form.elements['oid' + rownum].value || ''; var url = '<%$fsurl%>/elements/select-mib-popup.html?' + 'callback=receive_mib;' + 'arg=' + rownum + @@ -66,10 +66,11 @@ function receive_mib(obj, rownum) { - + + - + diff --git a/httemplate/edit/process/part_export.cgi b/httemplate/edit/process/part_export.cgi index e0c470675..7fe3d0369 100644 --- a/httemplate/edit/process/part_export.cgi +++ b/httemplate/edit/process/part_export.cgi @@ -41,7 +41,7 @@ foreach my $option (split(',', $cgi->param('multi_options'))) { foreach my $option (split(',', $cgi->param('multi_options'))) { my $value = ''; foreach my $row (sort keys %{$optionrows{_ALL_}}) { - $value .= ($optionrows{$option}{$row} || '') . "\n"; + $value .= ($optionrows{$option}{$row} // '') . "\n"; } chomp($value); $options{$option} = $value; diff --git a/httemplate/elements/select-mib-popup.html b/httemplate/elements/select-mib-popup.html index bd485ef65..f95ce2b97 100644 --- a/httemplate/elements/select-mib-popup.html +++ b/httemplate/elements/select-mib-popup.html @@ -7,7 +7,7 @@ Object: - + -- cgit v1.2.1