From 24c164b829dce551badd130dba51b011342676f2 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Wed, 7 Sep 2016 21:36:07 -0500 Subject: [PATCH 1/1] RT#72157: Monthly recurring field is missing --- .../misc/xmlhttp-cust_main-display_recurring.html | 29 +++++++++++ httemplate/view/cust_main/billing.html | 57 +++++++++++++++++----- 2 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 httemplate/misc/xmlhttp-cust_main-display_recurring.html diff --git a/httemplate/misc/xmlhttp-cust_main-display_recurring.html b/httemplate/misc/xmlhttp-cust_main-display_recurring.html new file mode 100644 index 000000000..dd9ed3bb5 --- /dev/null +++ b/httemplate/misc/xmlhttp-cust_main-display_recurring.html @@ -0,0 +1,29 @@ +<% encode_json($return) %>\ +<%init> + +my %arg = $cgi->param('arg'); +my $custnum = delete($arg{'custnum'}); + +my $error; +my $return; + +$error = "No customer specified" unless $custnum =~ /^\d+$/; + +my $curuser = $FS::CurrentUser::CurrentUser; + +$error = "access denied" + unless $error or $curuser->access_right('View customer'); + +my $cust_main; +$cust_main = qsearchs( { + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $custnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, +}) unless $error; +$error = "Customer not found!" unless $error or $cust_main; + +$return = $error + ? { 'error' => $error } + : { 'display_recurring' => [ $cust_main->display_recurring ] }; + + diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 894b2dfc0..a94b5c15a 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -21,18 +21,51 @@ <% $balance %> -% #54: just an arbitrary number i pulled out of my goober. ideally we'd like -% # to consider e.g. a histogram of num_ncancelled_packages for the entire -% # customer base, and compare it to a graph of the overhead for generating this -% # information. (and optimize it better, we could get it more from SQL) -% if ( $cust_main->num_ncancelled_pkgs < 54 ) { -% foreach my $freq_info ($cust_main->display_recurring) { - - <% emt( ucfirst($freq_info->{'freq_pretty'}). ' recurring' ) %> - <% $money_char. sprintf('%.2f', $freq_info->{'amount'}) %> - -% } -% } + + <% emt( 'Recurring' ) %> + + + +<& '/elements/xmlhttp.html', + 'url' => $fsurl.'misc/xmlhttp-cust_main-display_recurring.html', + 'subs' => [ 'get_display_recurring'] &> + + % if ( $conf->exists('cust_main-select-prorate_day') ) { -- 2.11.0