[freeside-commits] branch master updated. 8e73bf5782dc6fe2b299ba759ad15780a8946cc4

Mark Wells mark at 420.am
Mon Mar 25 19:32:53 PDT 2013


The branch, master has been updated
       via  8e73bf5782dc6fe2b299ba759ad15780a8946cc4 (commit)
      from  97356847f631d26f42a8fe0ea7adac580e41549c (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 8e73bf5782dc6fe2b299ba759ad15780a8946cc4
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Mar 25 19:32:23 2013 -0700

    option to show payment history in reverse order, #19698

diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html
index 232664e..34ce70b 100644
--- a/httemplate/elements/change_history_common.html
+++ b/httemplate/elements/change_history_common.html
@@ -15,13 +15,7 @@
   <TH CLASS="grid" BGCOLOR="#cccccc">Description</TH>
 </TR>
 
-% foreach my $item ( sort { $a->history_date <=> $b->history_date
-%                           #|| table order
-%                           || $a->historynum <=> $b->historynum
-%                         }
-%                         @history
-%                  )
-% {
+% foreach my $item ( @history ) {
 %   my $history_other = '';
 %   my $act  = $item->history_action;
 %   if ( $act =~ /^replace/ ) {
@@ -196,4 +190,11 @@ $cust_pkg_date_format .= ' %l:%M:%S%P'
   if $conf->exists('cust_pkg-display_times')
   || $curuser->option('cust_pkg-display_times');
 
+ at history = sort { $a->history_date <=> $b->history_date
+                  || $a->historynum <=> $b->historynum } @history;
+
+if ( $curuser->option('history_order') eq 'newest' ) {
+  @history = reverse @history;
+}
+
 </%init>
diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html
index 84f0832..6b94f71 100644
--- a/httemplate/pref/pref-process.html
+++ b/httemplate/pref/pref-process.html
@@ -49,6 +49,7 @@ unless ( $error ) { # if ($access_user) {
 
   #XXX autogen
   my @paramlist = qw( locale menu_position default_customer_view 
+                      history_order
                       spreadsheet_format mobile_menu
                       enable_fuzzy_on_exact
                       disable_html_editor disable_enter_submit_onetimecharge
diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html
index 9537fed..5babb01 100644
--- a/httemplate/pref/pref.html
+++ b/httemplate/pref/pref.html
@@ -75,6 +75,21 @@ Interface
       </SELECT>
     </TD>
   </TR>
+
+% my $history_order = $curuser->option('history_order') || 'oldest';
+  <TR>
+    <TH ALIGN="right">Customer history sort order: </TH>
+    <TD COLSPAN=2>
+      <& /elements/select.html,
+        field       => 'history_order',
+        curr_value  => $history_order,
+        options     => [ 'oldest', 'newest' ],
+        labels      => { 'oldest' => 'Oldest first',
+                         'newest' => 'Newest first',
+                       },
+      &>
+    </TD>
+  </TR>
   
   <TR>
     <TH ALIGN="right">Spreadsheet download format: </TH>
@@ -92,7 +107,7 @@ Interface
   </TR>
 
  <TR>
-    <TH ALIGN="right" COLSPAN=1>Enable approximate customer searching even when an exact match is found: </TH>
+    <TH ALIGN="right" COLSPAN=1>Enable approximate customer searching <BR>even when an exact match is found: </TH>
     <TD ALIGN="left" COLSPAN=2>
       <INPUT TYPE="checkbox" NAME="enable_fuzzy_on_exact" VALUE="1" <% $curuser->option('enable_fuzzy_on_exact') ? 'CHECKED' : '' %>>
     </TD>
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index 7701cb6..66008ee 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -263,7 +263,7 @@
 %my $old_history = 0;
 %my $lastdate = 0;
 %
-%foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) {
+%foreach my $item ( @history ) {
 %
 %  $lastdate = $item->{'date'};
 %
@@ -533,6 +533,13 @@ foreach my $cust_refund ($cust_main->cust_refund) {
 
 }
 
+# sort history
+if ( $curuser->option('history_order') eq 'newest' ) {
+  @history = sort { $b->{date} <=> $a->{date} } @history;
+} else {
+  @history = sort { $a->{date} <=> $b->{date} } @history;
+} # no other sort orders for now
+
 sub translate_payby {
     my ($payby,$payinfo) = (shift,shift);
     my %payby = (

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

Summary of changes:
 httemplate/elements/change_history_common.html |   15 ++++++++-------
 httemplate/pref/pref-process.html              |    1 +
 httemplate/pref/pref.html                      |   17 ++++++++++++++++-
 httemplate/view/cust_main/payment_history.html |    9 ++++++++-
 4 files changed, 33 insertions(+), 9 deletions(-)




More information about the freeside-commits mailing list