From 5e5c408ded395ae70c4ce3878ed260674253cccd Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 5 Oct 2008 06:07:36 +0000 Subject: [PATCH] finish UI improvements wrt refunds: now you have to post a check or cash refund explicitly, no more implicit creation by 'applying' credits. don't show useless application links. don't enable apply button until you pick an invoice/refund. RT#3812 --- httemplate/edit/elements/ApplicationCommon.html | 13 +++- .../view/cust_main/payment_history/credit.html | 86 ++++++++++++---------- .../view/cust_main/payment_history/payment.html | 86 ++++++++++++---------- 3 files changed, 106 insertions(+), 79 deletions(-) diff --git a/httemplate/edit/elements/ApplicationCommon.html b/httemplate/edit/elements/ApplicationCommon.html index 0e6c49975..a485d37de 100644 --- a/httemplate/edit/elements/ApplicationCommon.html +++ b/httemplate/edit/elements/ApplicationCommon.html @@ -43,7 +43,7 @@ Examples: <% include('/elements/error.html') %> -
+ <% $src_thing %> #<% $src_pkeyvalue %>
@@ -79,6 +79,13 @@ Examples: function changed(what) { dst = what.options[what.selectedIndex].value; + if ( dst == '' ) { + what.form.submit.disabled=true; + return true; + } + + what.form.submit.disabled=false; + % foreach my $dst ( @dst ) { if ( dst == <% $dst->$dst_pkey %> ) { @@ -97,7 +104,7 @@ Apply to: <% $dst_thing %>: +
diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html index fd43c1ac8..2deb27564 100644 --- a/httemplate/view/cust_main/payment_history/credit.html +++ b/httemplate/view/cust_main/payment_history/credit.html @@ -16,25 +16,30 @@ if ( scalar(@cust_credit_bill) == 0 $pre = 'Unapplied '; $post = ''; if ( $curuser->access_right('Apply credit') ) { - $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', - 'action' => "${p}edit/cust_credit_bill.cgi?". - $cust_credit->crednum, - 'actionlabel' => 'Apply credit', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; - #XXX if there are any open refunds - $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', - 'action' => "${p}edit/cust_credit_refund.cgi?". - $cust_credit->crednum, - 'actionlabel' => 'Apply credit to refund', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; + if ( $cust_credit->cust_main->total_owed > 0 ) { + $apply = ' ('. + include( '/elements/popup_link.html', + 'label' => 'apply', + 'action' => "${p}edit/cust_credit_bill.cgi?". + $cust_credit->crednum, + 'actionlabel' => 'Apply credit', + 'width' => 392, + #default# 'height' => 336, + ). + ')'; + } + if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { + $apply.= ' ('. + include( '/elements/popup_link.html', + 'label' => 'apply to refund', + 'action' => "${p}edit/cust_credit_refund.cgi?". + $cust_credit->crednum, + 'actionlabel' => 'Apply credit to refund', + 'width' => 392, + #default# 'height' => 336, + ). + ')'; + } } } elsif ( scalar(@cust_credit_bill) == 1 && scalar(@cust_credit_refund) == 0 @@ -70,25 +75,30 @@ if ( scalar(@cust_credit_bill) == 0 $desc .= '  $'. $cust_credit->credited. ' unapplied'; if ( $curuser->access_right('Apply credit') ) { - $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', - 'action' => "${p}edit/cust_credit_bill.cgi?". - $cust_credit->crednum, - 'actionlabel' => 'Apply credit', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; - #XXX if there are any open refunds - $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', - 'action' => "${p}edit/cust_credit_refund.cgi?". - $cust_credit->crednum, - 'actionlabel' => 'Apply credit to refund', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; + if ( $cust_credit->cust_main->total_owed > 0 ) { + $apply = ' ('. + include( '/elements/popup_link.html', + 'label' => 'apply', + 'action' => "${p}edit/cust_credit_bill.cgi?". + $cust_credit->crednum, + 'actionlabel' => 'Apply credit', + 'width' => 392, + #default# 'height' => 336, + ). + ')'; + } + if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { + $apply.= ' ('. + include( '/elements/popup_link.html', + 'label' => 'apply to refund', + 'action' => "${p}edit/cust_credit_refund.cgi?". + $cust_credit->crednum, + 'actionlabel' => 'Apply credit to refund', + 'width' => 392, + #default# 'height' => 336, + ). + ')'; + } } $desc .= '
'; } diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html index b9a06946d..346c0d03d 100644 --- a/httemplate/view/cust_main/payment_history/payment.html +++ b/httemplate/view/cust_main/payment_history/payment.html @@ -40,25 +40,30 @@ if ( scalar(@cust_bill_pay) == 0 $pre = 'Unapplied '; $post = ''; if ( $curuser->access_right('Apply payment') ) { - $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', - 'action' => "${p}edit/cust_bill_pay.cgi?". - $cust_pay->paynum, - 'actionlabel' => 'Apply payment', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; - #XXX if there are any open refunds - $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', - 'action' => "${p}edit/cust_pay_refund.cgi?". - $cust_pay->paynum, - 'actionlabel' => 'Apply payment to refund', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; + if ( $cust_pay->cust_main->total_owed > 0 ) { + $apply = ' ('. + include( '/elements/popup_link.html', + 'label' => 'apply', + 'action' => "${p}edit/cust_bill_pay.cgi?". + $cust_pay->paynum, + 'actionlabel' => 'Apply payment', + 'width' => 392, + #default# 'height' => 336, + ). + ')'; + } + if ( $cust_pay->cust_main->total_unapplied_refunds > 0 ) { + $apply.= ' ('. + include( '/elements/popup_link.html', + 'label' => 'apply to refund', + 'action' => "${p}edit/cust_pay_refund.cgi?". + $cust_pay->paynum, + 'actionlabel' => 'Apply payment to refund', + 'width' => 392, + #default# 'height' => 336, + ). + ')'; + } } } elsif ( scalar(@cust_bill_pay) == 1 && scalar(@cust_pay_refund) == 0 @@ -95,25 +100,30 @@ if ( scalar(@cust_bill_pay) == 0 '$'. $cust_pay->unapplied. ' unapplied'; if ( $curuser->access_right('Apply payment') ) { - $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', - 'action' => "${p}edit/cust_bill_pay.cgi?". - $cust_pay->paynum, - 'actionlabel' => 'Apply payment', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; - #XXX if there are any open refunds - $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', - 'action' => "${p}edit/cust_pay_refund.cgi?". - $cust_pay->paynum, - 'actionlabel' => 'Apply payment to refund', - 'width' => 392, - #default# 'height' => 336, - ). - ')'; + if ( $cust_pay->cust_main->total_owed > 0 ) { + $apply = ' ('. + include( '/elements/popup_link.html', + 'label' => 'apply', + 'action' => "${p}edit/cust_bill_pay.cgi?". + $cust_pay->paynum, + 'actionlabel' => 'Apply payment', + 'width' => 392, + #default# 'height' => 336, + ). + ')'; + } + if ( $cust_pay->cust_main->total_unapplied_refunds > 0 ) { + $apply.= ' ('. + include( '/elements/popup_link.html', + 'label' => 'apply to refund', + 'action' => "${p}edit/cust_pay_refund.cgi?". + $cust_pay->paynum, + 'actionlabel' => 'Apply payment to refund', + 'width' => 392, + #default# 'height' => 336, + ). + ')'; + } } $desc .= '
'; } -- 2.11.0