[freeside-commits] branch FREESIDE_3_BRANCH updated. 357154e4844983731281c30a666893c60c45748e

Ivan ivan at 420.am
Mon Dec 30 22:14:27 PST 2013


The branch, FREESIDE_3_BRANCH has been updated
       via  357154e4844983731281c30a666893c60c45748e (commit)
      from  7a4df417fbc5e48c1b257f8695bcd4c2a1612d91 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 357154e4844983731281c30a666893c60c45748e
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Dec 30 22:14:26 2013 -0800

    (pkg-balances) change package of unapplied payments and credits, RT#22198

diff --git a/httemplate/edit/cust_credit-pkgnum.html b/httemplate/edit/cust_credit-pkgnum.html
new file mode 100755
index 0000000..a7c046b
--- /dev/null
+++ b/httemplate/edit/cust_credit-pkgnum.html
@@ -0,0 +1,69 @@
+<& /elements/header-popup.html, mt('Change credit package') &>
+
+<& /elements/error.html &>
+
+<FORM NAME="credit_popup" ACTION="<% popurl(1) %>process/cust_credit-pkgnum.html" METHOD=POST>
+<INPUT TYPE="hidden" NAME="crednum" VALUE="<% $cust_credit->crednum %>">
+
+<% ntable("#cccccc", 2) %>
+
+  <TR>
+    <TD ALIGN="right"><% mt('Date') |h %></TD>
+    <TD BGCOLOR="#eeeeee"><% time2str($date_format, $cust_credit->_date) |h %></TD>
+  </TR>
+
+  <TR>
+    <TD ALIGN="right"><% mt('Amount') |h %></TD>
+    <TD BGCOLOR="#eeeeee">
+      <% $money_char. $cust_credit->amount %>
+    </TD>
+  </TR>
+
+% if ( $cust_credit->addlinfo ) {
+    <TR>
+      <TD ALIGN="right"><% mt('Additional info') |h %></TD>
+      <TD BGCOLOR="#eeeeee">
+        <% $cust_credit->addlinfo |h %>
+      </TD>
+    </TR>
+% }
+
+% if ( $conf->exists('pkg-balances') ) {
+%   $cgi->param('pkgnum', $cust_credit->pkgnum);
+    <& /elements/tr-select-cust_pkg-balances.html,
+                 'custnum' => $cust_credit->custnum,
+                 'cgi'     => $cgi
+    &>
+% } else {
+  <INPUT TYPE="hidden" NAME="pkgnum" VALUE="">
+% }
+
+</TABLE>
+
+<BR>
+
+<CENTER><INPUT TYPE="submit" ID="confirm_credit_button" VALUE="<% mt('Change credit package') |h %>"></CENTER>
+
+</FORM>
+</BODY>
+</HTML>
+<%init>
+
+my $conf = new FS::Conf;
+
+my $money_char  = $conf->config('money_char')  || '$';
+my $date_format = $conf->config('date_format') || '%m/%d/%Y';
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); #own ACL?
+
+my $cust_credit = qsearchs({
+  'select'    => 'cust_credit.*',
+  'table'     => 'cust_credit',
+  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
+  'hashref'   => { crednum => scalar($cgi->param('crednum')), },
+  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+})
+  or die 'unknown credit';
+
+</%init>
diff --git a/httemplate/edit/cust_pay-pkgnum.html b/httemplate/edit/cust_pay-pkgnum.html
new file mode 100755
index 0000000..adb88ab
--- /dev/null
+++ b/httemplate/edit/cust_pay-pkgnum.html
@@ -0,0 +1,93 @@
+<& /elements/header-popup.html, 'Change payment package' &>
+
+<& /elements/error.html &>
+
+<FORM NAME="PaymentForm" ACTION="<% popurl(1) %>process/cust_pay-pkgnum.html" METHOD=POST>
+<INPUT TYPE="hidden" NAME="paynum" VALUE="<% $cust_pay->paynum %>">
+
+<BR>
+
+<% mt('Payment') |h %> 
+<% ntable("#cccccc", 2) %>
+
+<TR>
+  <TD ALIGN="right"><% mt('Date') |h %></TD>
+  <TD COLSPAN=2 BGCOLOR="#eeeeee"><% time2str($date_format.' %r',$cust_pay->_date) |h %>
+  </TD>
+</TR>
+
+<TR>
+  <TD ALIGN="right"><% mt('Amount') |h %></TD>
+  <TD COLSPAN=2 BGCOLOR="#eeeeee">
+   <% $money_char. $cust_pay->paid %>
+   <% mt('by') |h %>
+   <B><% mt(FS::payby->payname($cust_pay->payby)) |h %></B></TD>
+</TR>
+
+% if ( $cust_pay->payby eq 'BILL' ) { 
+  <TR>
+    <TD ALIGN="right"><% mt('Check #') |h %></TD>
+    <TD COLSPAN=2><% $cust_pay->payinfo |h %></TD>
+  </TR>
+% } elsif ( $cust_pay->payby eq 'CASH' and $conf->exists('require_cash_deposit_info') ) {
+  <TR>
+    <TD ALIGN="right"><% mt('Bank') |h %></TD>
+    <TD COLSPAN=3><% $cust_pay->bank |h %></TD>
+  </TR>
+  <TR>
+    <TD ALIGN="right"><% mt('Check #') |h %></TD>
+    <TD COLSPAN=2><% $cust_pay->payinfo |h %></TD>
+  </TR>
+  <TR>
+    <TD ALIGN="right"><% mt('Teller #') |h %></TD>
+    <TD COLSPAN=2><% $cust_pay->teller |h %></TD>
+  </TR>
+  <TR>
+    <TD ALIGN="right"><% mt('Depositor') |h %></TD>
+    <TD COLSPAN=3><% $cust_pay->depositor |h %></TD>
+  </TR>
+  <TR>
+    <TD ALIGN="right"><% mt('Account #') |h %></TD>
+    <TD COLSPAN=2><% $cust_pay->account |h %></TD>
+  </TR>
+% }
+
+% if ( $conf->exists('pkg-balances') ) {
+%   $cgi->param('pkgnum', $cust_pay->pkgnum);
+    <& /elements/tr-select-cust_pkg-balances.html,
+                 'custnum' => $cust_pay->custnum,
+                 'cgi'     => $cgi,
+    &>
+% } else {
+  <INPUT TYPE="hidden" NAME="pkgnum" VALUE="">
+% }
+
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="<% mt('Change payment package') |h %>">
+
+</FORM>
+</BODY>
+</HTML>
+
+<%init>
+
+my $conf = new FS::Conf;
+
+my $money_char  = $conf->config('money_char')  || '$';
+my $date_format = $conf->config('date_format') || '%m/%d/%Y';
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Apply payment'); #own ACL?
+
+my $cust_pay = qsearchs({
+  'select'    => 'cust_pay.*',
+  'table'     => 'cust_pay',
+  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
+  'hashref'   => { paynum => scalar($cgi->param('paynum')), },
+  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+})
+  or die 'unknown payment';
+
+</%init>
diff --git a/httemplate/edit/process/cust_credit-pkgnum.html b/httemplate/edit/process/cust_credit-pkgnum.html
new file mode 100755
index 0000000..8941cbc
--- /dev/null
+++ b/httemplate/edit/process/cust_credit-pkgnum.html
@@ -0,0 +1,35 @@
+%if ($error) {
+%  $cgi->param('error', $error);
+<% $cgi->redirect(popurl(2). 'cust_credit-pkgnum.html?'. $cgi->query_string ) %>
+%} else {
+<% header(emt('Credit package changed')) %>
+    <SCRIPT TYPE="text/javascript">
+      window.top.location.reload();
+    </SCRIPT>
+
+    </BODY></HTML>
+%}
+<%init>
+
+my $conf = FS::Conf->new;
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); #own ACL?
+
+$cgi->param('crednum') =~ /^(\d+)$/
+  or die "Illegal crednum: ". $cgi->param('crednum');
+my $crednum = $1;
+
+my $cust_credit = qsearchs({
+  'select'    => 'cust_credit.*',
+  'table'     => 'cust_credit',
+  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
+  'hashref'   => { crednum => scalar($cgi->param('crednum')), },
+  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+})
+  or die 'unknown credit';
+
+$cust_credit->pkgnum( $cgi->param('pkgnum') );
+my $error = $cust_credit->replace;
+
+</%init>
diff --git a/httemplate/edit/process/cust_pay-pkgnum.html b/httemplate/edit/process/cust_pay-pkgnum.html
new file mode 100755
index 0000000..d9a92a1
--- /dev/null
+++ b/httemplate/edit/process/cust_pay-pkgnum.html
@@ -0,0 +1,35 @@
+%if ($error) {
+%  $cgi->param('error', $error);
+<% $cgi->redirect(popurl(2). 'cust_pay-pkgnum.html?'. $cgi->query_string ) %>
+%} else {
+<% header(emt('Payment package changed')) %>
+    <SCRIPT TYPE="text/javascript">
+      window.top.location.reload();
+    </SCRIPT>
+
+    </BODY></HTML>
+%}
+<%init>
+
+my $conf = FS::Conf->new;
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); #own ACL?
+
+$cgi->param('paynum') =~ /^(\d+)$/
+  or die "Illegal paynum: ". $cgi->param('paynum');
+my $paynum = $1;
+
+my $cust_pay = qsearchs({
+  'select'    => 'cust_pay.*',
+  'table'     => 'cust_pay',
+  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
+  'hashref'   => { paynum => scalar($cgi->param('paynum')), },
+  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+})
+  or die 'unknown payment';
+
+$cust_pay->pkgnum( $cgi->param('pkgnum') );
+my $error = $cust_pay->replace;
+
+</%init>
diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html
index ec5041b..941180e 100644
--- a/httemplate/view/cust_main/payment_history/credit.html
+++ b/httemplate/view/cust_main/payment_history/credit.html
@@ -1,5 +1,4 @@
-<% $credit %>
-<% "$reason$desc$apply$delete$unapply" %>
+<% $credit. ' '. $reason. $desc. $change_pkg. $apply. $delete. $unapply %>
 <%init>
 
 my( $cust_credit, %opt ) = @_;
@@ -113,7 +112,20 @@ if (    scalar(@cust_credit_bill)   == 0
     $desc .= '<BR>';
   }
 }
-#
+
+my $change_pkg = '';
+if ( $apply && $opt{'pkg-balances'} && $cust_credit->pkgnum ) {
+  $change_pkg =
+  ' ('. include('/elements/popup_link.html',
+                  'label'       => emt('change package'),
+                  'action'      => "${p}edit/cust_credit-pkgnum.html?crednum=".
+                                    $cust_credit->crednum,
+                  'actionlabel' => emt('Change credit package'),
+                  'width'       => 763,
+               ).
+   ')';
+}
+
 my $delete = '';
 $delete = areyousure_link("${p}misc/delete-cust_credit.cgi?".$cust_credit->crednum,
                             emt('Are you sure you want to delete this credit?'),
diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html
index 9379207..4ec9271 100644
--- a/httemplate/view/cust_main/payment_history/payment.html
+++ b/httemplate/view/cust_main/payment_history/payment.html
@@ -1,5 +1,6 @@
-<% $payment %>
-<% "$info$desc$view$apply$refund$void$delete$unapply" %>
+<% $payment. ' '.  $info. $desc.
+   $view. $change_pkg. $apply. $refund. $void. $delete. $unapply
+%>
 <%init>
 
 my( $cust_pay, %opt ) = @_;
@@ -143,6 +144,19 @@ my $view =
                ).
    ')';
 
+my $change_pkg = '';
+if ( $apply && $opt{'pkg-balances'} && $cust_pay->pkgnum ) {
+  $change_pkg =
+  ' ('. include('/elements/popup_link.html',
+                  'label'       => emt('change package'),
+                  'action'      => "${p}edit/cust_pay-pkgnum.html?paynum=".
+                                    $cust_pay->paynum,
+                  'actionlabel' => emt('Change payment package'),
+                  'width'       => 763,
+               ).
+   ')';
+}
+
 my $refund = '';
 my $refund_days = $opt{'card_refund-days'} || 120;
 my $refund_right = '';

-----------------------------------------------------------------------

Summary of changes:
 httemplate/edit/cust_credit-pkgnum.html            |   69 +++++++++++++++
 httemplate/edit/cust_pay-pkgnum.html               |   93 ++++++++++++++++++++
 httemplate/edit/process/cust_credit-pkgnum.html    |   35 ++++++++
 httemplate/edit/process/cust_pay-pkgnum.html       |   35 ++++++++
 .../view/cust_main/payment_history/credit.html     |   18 +++-
 .../view/cust_main/payment_history/payment.html    |   18 ++++-
 6 files changed, 263 insertions(+), 5 deletions(-)
 create mode 100755 httemplate/edit/cust_credit-pkgnum.html
 create mode 100755 httemplate/edit/cust_pay-pkgnum.html
 create mode 100755 httemplate/edit/process/cust_credit-pkgnum.html
 create mode 100755 httemplate/edit/process/cust_pay-pkgnum.html




More information about the freeside-commits mailing list