From b401f6d9ec5b5cd5f19ecd46a678ad8fea0ede6d Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Thu, 21 Dec 2017 12:31:40 -0500 Subject: RT# 29974 - Added ability to show invoice_pay_by_message on total new charges line rather than balance due line --- FS/FS/Template_Mixin.pm | 23 ++++++++++++++++++----- FS/FS/cust_bill.pm | 9 ++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 7d92d21af..b9f3e9274 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -1955,6 +1955,23 @@ sub due_date2str { $self->due_date ? $self->time2str_local(shift, $self->due_date) : ''; } +=item invoice_pay_by_msg + + displays the invoice_pay_by_msg or default Please pay by [_1] if empty. + +=cut + +sub invoice_pay_by_msg { + my $self = shift; + my $msg = ''; + my $please_pay_by = + $self->conf->config('invoice_pay_by_msg', $self->agentnum) + || 'Please pay by [_1]'; + $msg .= ' - ' . $self->mt($please_pay_by, $self->due_date2str('short')) . ' '; + + $msg; +} + =item balance_due_msg =cut @@ -1969,11 +1986,7 @@ sub balance_due_msg { # _items_total) and not here # (yes, or if invoice_sections is enabled; this is just for compatibility) if ( $self->due_date ) { - my $please_pay_by = - $self->conf->config('invoice_pay_by_msg', $self->agentnum) - || 'Please pay by [_1]'; - $msg .= ' - ' . $self->mt($please_pay_by, $self->due_date2str('short')). - ' ' + $msg .= $self->invoice_pay_by_msg unless $self->conf->config_bool('invoice_omit_due_date',$self->agentnum); } elsif ( $self->terms ) { $msg .= ' - '. $self->mt($self->terms); diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 5ae4f3686..8b94dcc87 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -3450,17 +3450,12 @@ sub _items_total { $total_descr = $self->mt('Total Charges'); } - if ( $conf->exists('invoice_show_prior_due_date') ) { + if ( $conf->exists('invoice_show_prior_due_date') && !$conf->exists('invoice_omit_due_date') ) { # then the due date should be shown with Total New Charges, # and should NOT be shown with the Balance Due message. if ( $self->due_date ) { - $total_descr = join(' ', - $total_descr, - '-', - $self->mt('Please pay by'), - $self->due_date2str('short') - ); + $total_descr .= $self->invoice_pay_by_msg; } elsif ( $self->terms ) { $total_descr = join(' ', $total_descr, -- cgit v1.2.1 From 4d873df8a99f87a6427a58ccd3e69b1c9474f44a Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Thu, 21 Dec 2017 18:16:33 -0500 Subject: RT# 76878 - Fixed installer checkbox to be sticky on error. --- httemplate/edit/elements/edit.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 25568745d..113f611e1 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -871,7 +871,9 @@ my $pkey = dbdef->table($table)->primary_key; #? $opt{'primary_key'} || my $fields = $opt{'fields'} #|| [ grep { $_ ne $pkey } dbdef->table($table)->columns ]; || [ grep { $_ ne $pkey } fields($table) ]; -#my @actualfields = map { ref($_) ? $_->{'field'} : $_ } @$fields; +my @actualfields = map { ref($_) ? $_->{'field'} : $_ } @$fields; + +push @actualfields, $pkey; my $js_form_validate = {}; @@ -914,7 +916,7 @@ if ( $opt{'embed'} ) { $mode = 'error'; $object = $class->new( { - map { $_ => scalar($cgi->param($_)) } fields($table) + map { $_ => scalar($cgi->param($_)) } @actualfields }); &{$opt{'error_callback'}}( $cgi, $object, $fields, \%opt ) -- cgit v1.2.1 From ca2f12276eb88b2e71762c76974ae564f008b8c1 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 2 Jan 2018 19:47:44 -0500 Subject: RT# 34134 - removed payment amount field from payment screen, added 3 payment options (pay full balance, pay specific invoice, pay another amount) which will prefill the payment amount field. --- httemplate/elements/tr-amount_fee.html | 4 +- httemplate/elements/tr-select-invoice.html | 25 ++++++++ httemplate/elements/tr-select-payment_options.html | 68 ++++++++++++++++++++++ httemplate/misc/payment.cgi | 3 +- 4 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 httemplate/elements/tr-select-invoice.html create mode 100644 httemplate/elements/tr-select-payment_options.html diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html index 12488521a..426957a80 100644 --- a/httemplate/elements/tr-amount_fee.html +++ b/httemplate/elements/tr-amount_fee.html @@ -1,4 +1,4 @@ - + <% mt('Payment amount') |h %> + + + + +<%init> + +my %opt = @_; + + diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html new file mode 100644 index 000000000..5197c3706 --- /dev/null +++ b/httemplate/elements/tr-select-payment_options.html @@ -0,0 +1,68 @@ + + + + + + + <& /elements/tr-select-invoice.html, + %opt + &> + + <& /elements/tr-amount_fee.html, + %opt + &> + + + +<%init> + +my %opt = @_; + + \ No newline at end of file diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 35f57e8d6..7bf1713ff 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -12,7 +12,8 @@
@@ -15,7 +15,7 @@ onKeyPress = "amount_changed(this)" % } > - + % if ( $fee ) { diff --git a/httemplate/elements/tr-select-invoice.html b/httemplate/elements/tr-select-invoice.html new file mode 100644 index 000000000..03625b659 --- /dev/null +++ b/httemplate/elements/tr-select-invoice.html @@ -0,0 +1,25 @@ + +
<% mt('Payment options') |h %> + +
- <& /elements/tr-amount_fee.html, + <& /elements/tr-select-payment_options.html, + 'custnum' => $cust_main->custnum, 'amount' => $amount, 'process-pkgpart' => scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)), -- cgit v1.2.1 From 8f20806ac6eb7487c97f7d1c6d1b44acf0ad7674 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 2 Jan 2018 19:52:46 -0500 Subject: RT# 34134 - added open invoices selection when selecting pay specific invoice --- httemplate/elements/tr-select-invoice.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/httemplate/elements/tr-select-invoice.html b/httemplate/elements/tr-select-invoice.html index 03625b659..70923b633 100644 --- a/httemplate/elements/tr-select-invoice.html +++ b/httemplate/elements/tr-select-invoice.html @@ -22,4 +22,11 @@ my %opt = @_; +my @records = qsearch( { + 'select' => '*', + 'table' => 'cust_bill', + 'hashref' => { 'custnum' => $opt{custnum} }, + 'order_by' => 'ORDER BY _date', +}); + -- cgit v1.2.1 From 814e5db9cd3953afad6ee1901574180fa0890062 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Wed, 3 Jan 2018 09:49:58 -0500 Subject: RT# 34134 - removed config option manual_process-single_invoice_amount from config and payment page that used it. --- FS/FS/Conf.pm | 7 ------- httemplate/misc/payment.cgi | 11 +---------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 59f9b69fc..9b891879b 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2752,13 +2752,6 @@ and customer address. Include units.', 'type' => 'checkbox', }, - { - 'key' => 'manual_process-single_invoice_amount', - 'section' => 'payments', - 'description' => 'When entering manual credit card and ACH payments, amount will not autofill if the customer has more than one open invoice', - 'type' => 'checkbox', - }, - { 'key' => 'manual_process-pkgpart', 'section' => 'payments', diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 7bf1713ff..5bfa29d70 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -14,7 +14,7 @@ <& /elements/tr-select-payment_options.html, 'custnum' => $cust_main->custnum, - 'amount' => $amount, + 'amount' => $balance, 'process-pkgpart' => scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)), 'process-display' => scalar($conf->config('manual_process-display')), @@ -357,15 +357,6 @@ my %states = map { $_->state => 1 } } ); my @states = sort { $a cmp $b } keys %states; -my $amount = ''; -if ( $balance > 0 ) { - # when configured to do so, amount will only auto-fill with balance - # if balance represents a single invoice - $amount = $balance - unless $conf->exists('manual_process-single_invoice_amount') - && ($cust_main->open_cust_bill != 1); -} - my $payunique = "webui-payment-". time. "-$$-". rand() * 2**32; -- cgit v1.2.1 From 9d90ce6a6d2c107c0a3bcb7451932b7108466c27 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Wed, 3 Jan 2018 10:43:28 -0500 Subject: RT# 34134 - added documentation for new feature --- httemplate/elements/tr-select-invoice.html | 13 ++++++++++- httemplate/elements/tr-select-payment_options.html | 27 +++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/httemplate/elements/tr-select-invoice.html b/httemplate/elements/tr-select-invoice.html index 70923b633..3728d348d 100644 --- a/httemplate/elements/tr-select-invoice.html +++ b/httemplate/elements/tr-select-invoice.html @@ -1,3 +1,15 @@ +<%doc> + +Example: + + include( '/elements/tr-select-invoice.html', + + #opt - most get used in /elements/tr-amount-fee + 'custnum' => 4, # customer number, + 'prefix' => 'pre', # prefix to fields and row ID's + ) + + @@ -6,7 +18,6 @@ ID = "<% $opt{prefix} %>invoice" NAME = "<% $opt{prefix} %>invoice" onChange = "<% $opt{prefix} %>invoice_select_changed(this)" - <% $opt{disabled} %> > % foreach my $record (@records) { diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html index 5197c3706..3c50e88d8 100644 --- a/httemplate/elements/tr-select-payment_options.html +++ b/httemplate/elements/tr-select-payment_options.html @@ -1,3 +1,25 @@ +<%doc> + +Example: + + include( '/elements/tr-select-payment_options.html', + + #opt - most get used in /elements/tr-amount-fee + 'custnum' => 4, # customer number needed for selecting invoices + 'prefix' => 'pre', # prefix to fields and row ID's + 'amount' => 1, # payment amount + 'process-pkgpart' => scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)), + 'process-display' => scalar($conf->config('manual_process-display')), + 'process-skip_first' => $conf->exists('manual_process-skip_first'), + 'num_payments' => scalar($cust_main->cust_pay), + 'surcharge_percentage' => + ( $payby eq 'CARD' + ? scalar($conf->config('credit-card-surcharge-percentage', $cust_main->agentnum)) + : 0 + ), + ) + + @@ -17,7 +39,8 @@ <& /elements/tr-select-invoice.html, - %opt + 'custnum' => $opt{custnum}, + 'prefix' => $opt{prefix}, &> <& /elements/tr-amount_fee.html, @@ -31,6 +54,7 @@ if ( what.value == 'select' ) { document.getElementById('payment_amount_row').style.display = 'none'; document.getElementById('invoice_row').style.display = 'none'; + document.getElementById('<% $opt{prefix} %>invoice').value = 'select'; document.getElementById('amount').value = ''; } else if ( what.value == 'invoice' ) { @@ -41,6 +65,7 @@ else { document.getElementById('payment_amount_row').style.display = 'block'; document.getElementById('invoice_row').style.display = 'none'; + document.getElementById('<% $opt{prefix} %>invoice').value = 'select'; document.getElementById('amount').value = what.value; } -- cgit v1.2.1 From 5136b6e7f17e6d86911f7feb520dd5b4248532bb Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Wed, 3 Jan 2018 14:09:38 -0500 Subject: RT# 34134 - fixed error where payment amount field is hidden in self service. --- httemplate/elements/tr-amount_fee.html | 2 +- httemplate/elements/tr-select-payment_options.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html index 426957a80..9c13f5952 100644 --- a/httemplate/elements/tr-amount_fee.html +++ b/httemplate/elements/tr-amount_fee.html @@ -1,4 +1,4 @@ - + >
<% mt('Payment options') |h %>
<% mt('Payment amount') |h %>
diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html index 3c50e88d8..2304c22d0 100644 --- a/httemplate/elements/tr-select-payment_options.html +++ b/httemplate/elements/tr-select-payment_options.html @@ -44,6 +44,7 @@ Example: &> <& /elements/tr-amount_fee.html, + 'row_style' => 'STYLE="display:none;"', %opt &> -- cgit v1.2.1