[freeside-commits] branch master updated. 601137d2d3d57841f50f4ab5393c2e521ada263a

Mark Wells mark at 420.am
Tue Jul 2 13:38:34 PDT 2013


The branch, master has been updated
       via  601137d2d3d57841f50f4ab5393c2e521ada263a (commit)
      from  d4f9df58cf2ba98b83b90bf0739a44bac8611abf (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 601137d2d3d57841f50f4ab5393c2e521ada263a
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Jul 2 13:38:06 2013 -0700

    more detail when selecting invoices in quick payment entry, #15861

diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html
index 04a402b..cc1a26a 100644
--- a/httemplate/misc/batch-cust_pay.html
+++ b/httemplate/misc/batch-cust_pay.html
@@ -5,6 +5,15 @@
 
 <& /elements/error.html &>
 
+<STYLE TYPE="text/css">
+.select_invnum {
+  text-align: right;
+  width: 220px;
+}
+.select_invnum * {
+  font-family: monospace;
+}
+</STYLE>
 <SCRIPT TYPE="text/javascript">
 function warnUnload() {
   if(document.getElementById("OneTrueTable").rows.length > 3 &&
@@ -185,21 +194,23 @@ function choose_app_invnum() {
 function focus_app_invnum() {
 % # invoice numbers just display as invoice numbers
   var rownum = this.getAttribute('rownum');
-  var add_opt = function(obj, value) {
+  var add_opt = function(obj, value, label) {
     var o = document.createElement('OPTION');
-    o.text = value;
+    o.text = label;
     o.value = value;
     obj.add(o);
   }
   this.options.length = 0;
   var this_invoice = this.curr_invoice;
   if ( this_invoice ) {
-    add_opt(this, this_invoice.invnum);
+    add_opt(this, this_invoice.invnum, this_invoice.label);
   } else {
-    add_opt(this, '');
+    add_opt(this, '', '');
   }
   for ( var x in invoices_for_row[rownum] ) {
-    add_opt(this, invoices_for_row[rownum][x].invnum);
+    add_opt(this,
+            invoices_for_row[rownum][x].invnum,
+            invoices_for_row[rownum][x].label);
   }
 }
 
@@ -236,8 +247,7 @@ function create_application_row(rownum, appnum) {
   select_invnum.setAttribute('appnum', appnum);
   select_invnum.setAttribute('id', 'invnum'+rownum+'.'+appnum);
   select_invnum.setAttribute('name', 'invnum'+rownum+'.'+appnum);
-  select_invnum.style.textAlign = 'right';
-  select_invnum.style.width = '50px';
+  select_invnum.className = 'select_invnum';
   select_invnum.onchange = choose_app_invnum;
   select_invnum.onfocus  = focus_app_invnum;
   
diff --git a/httemplate/misc/xmlhttp-cust_bill-search.html b/httemplate/misc/xmlhttp-cust_bill-search.html
index c60a0b0..6082dc7 100644
--- a/httemplate/misc/xmlhttp-cust_bill-search.html
+++ b/httemplate/misc/xmlhttp-cust_bill-search.html
@@ -4,17 +4,37 @@
 my $curuser = $FS::CurrentUser::CurrentUser;
 die 'access denied' unless $curuser->access_right('View invoices');
 my @return;
+my $date_format = FS::Conf->new->config('date_format') || '%m/%d/%Y';
 if ( $cgi->param('sub') eq 'custnum_search_open' ) { 
   my $custnum = $cgi->param('arg');
   if ( $custnum =~ /^(\d+)$/ ) {
 #warn "searching invoices for $custnum\n";
     my $cust_main = FS::cust_main->by_key($custnum);
-    @return = map { 
-      +{ $_->hash, 
-        'owed' => $_->owed }
-    } $cust_main->open_cust_bill
-      if $curuser->agentnums_href->{ $cust_main->agentnum };
-  }
+    if ( $curuser->agentnums_href->{ $cust_main->agentnum } ) {
+      my @open_bills = $cust_main->open_cust_bill;
+      my $invnum_len;
+      my $owed_len;
+      my $date_len;
+      foreach my $cust_bill (@open_bills) {
+        my $invnum = $cust_bill->invnum;
+        my $owed = $cust_bill->owed;
+        my $date = time2str($date_format, $cust_bill->_date);
+        $invnum_len = length($invnum) if length($invnum) > $invnum_len;
+        $owed_len   = length($owed)   if length($owed) > $owed_len;
+        $date_len   = length($date)   if length($date) > $date_len;
+
+        push @return, { $cust_bill->hash,
+                        'owed' => $owed,
+                        'date' => $date };
+      }
+      my $format = '%' . $invnum_len . 'd - %' . $date_len . 's - '.
+                    (FS::Conf->new->config('money_char') || '$') .
+                   '%' . $owed_len . '.2f';
+      foreach (@return) {
+        $_->{label} = sprintf($format, $_->{invnum}, $_->{date}, $_->{owed});
+      }
+    } #if agentnum
+  } #if $custnum
 }
 
 </%init>

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

Summary of changes:
 httemplate/misc/batch-cust_pay.html           |   24 +++++++++++++-----
 httemplate/misc/xmlhttp-cust_bill-search.html |   32 ++++++++++++++++++++----
 2 files changed, 43 insertions(+), 13 deletions(-)




More information about the freeside-commits mailing list