summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-10-05 06:07:36 +0000
committerivan <ivan>2008-10-05 06:07:36 +0000
commit5e5c408ded395ae70c4ce3878ed260674253cccd (patch)
tree6a0eef801b4ae6c23f5f894f8f2893f775976796
parentaa8d3305bddaca26d9222ebfa48af191d28f8230 (diff)
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
-rw-r--r--httemplate/edit/elements/ApplicationCommon.html13
-rw-r--r--httemplate/view/cust_main/payment_history/credit.html86
-rw-r--r--httemplate/view/cust_main/payment_history/payment.html86
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') %>
-<FORM ACTION="<% $p1. $opt{'form_action'} %>" METHOD=POST>
+<FORM ACTION="<% $p1. $opt{'form_action'} %>" NAME="ApplicationForm" ID="ApplicationForm" METHOD=POST>
<% $src_thing %> #<B><% $src_pkeyvalue %></B><BR>
<INPUT TYPE="hidden" NAME="<% $src_pkey %>" VALUE="<% $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:
<TR>
<TD ALIGN="right"><% $dst_thing %>: </TD>
<TD><SELECT NAME="<% $dst_pkey %>" SIZE=1 onChange="changed(this)">
-<OPTION VALUE="">
+<OPTION VALUE="">Select <% $dst_thing %>
% foreach my $dst ( @dst ) {
<OPTION<% $dst->$dst_pkey eq $dst_pkeyvalue ? ' SELECTED' : '' %> VALUE="<% $dst->$dst_pkey %>">#<% $dst->$dst_pkey %> - <% time2str("%D", $dst->_date) %> - $<% $dst->$dst_unapplied %>
@@ -115,7 +122,7 @@ Apply to:
</TABLE>
<BR>
-<CENTER><INPUT TYPE="submit" VALUE="Apply"></CENTER>
+<CENTER><INPUT TYPE="submit" VALUE="Apply" NAME="submit" ID="submit" DISABLED></CENTER>
</FORM>
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 = '<B><FONT COLOR="#FF0000">Unapplied ';
$post = '</FONT></B>';
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 .= '&nbsp;&nbsp;<B><FONT COLOR="#FF0000">$'.
$cust_credit->credited. ' unapplied</FONT></B>';
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 .= '<BR>';
}
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 = '<B><FONT COLOR="#FF0000">Unapplied ';
$post = '</FONT></B>';
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
'<B><FONT COLOR="#FF0000">$'.
$cust_pay->unapplied. ' unapplied</FONT></B>';
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 .= '<BR>';
}