[freeside-commits] branch FREESIDE_4_BRANCH updated. 699758d489a44bddc6ce92809fd6176e2548d45f

Ivan ivan at 420.am
Fri Mar 18 18:40:25 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  699758d489a44bddc6ce92809fd6176e2548d45f (commit)
      from  9dd24df729dd13819019b87d25c1669346c49dd4 (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 699758d489a44bddc6ce92809fd6176e2548d45f
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Mar 18 18:40:24 2016 -0700

    sort customer locations in package list, RT#41119, RT#39822

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 0586a80..6d5d1d3 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -2183,8 +2183,13 @@ Returns all locations (see L<FS::cust_location>) for this customer.
 
 sub cust_location {
   my $self = shift;
-  qsearch('cust_location', { 'custnum'     => $self->custnum,
-                             'prospectnum' => '' } );
+  qsearch({
+    'table'   => 'cust_location',
+    'hashref' => { 'custnum'     => $self->custnum,
+                   'prospectnum' => '',
+                 },
+    'order_by' => 'ORDER BY country, LOWER(state), LOWER(city), LOWER(county), LOWER(address1), LOWER(address2)',
+  });
 }
 
 =item cust_contact
@@ -3592,9 +3597,12 @@ Returns all the credits (see L<FS::cust_credit>) for this customer.
 
 sub cust_credit {
   my $self = shift;
-  map { $_ } #return $self->num_cust_credit unless wantarray;
-  sort { $a->_date <=> $b->_date }
-    qsearch( 'cust_credit', { 'custnum' => $self->custnum } )
+
+  #return $self->num_cust_credit unless wantarray;
+
+  map { $_ } #behavior of sort undefined in scalar context
+    sort { $a->_date <=> $b->_date }
+      qsearch( 'cust_credit', { 'custnum' => $self->custnum } )
 }
 
 =item cust_credit_pkgnum
diff --git a/FS/FS/prospect_main.pm b/FS/FS/prospect_main.pm
index 79efa86..f600b23 100644
--- a/FS/FS/prospect_main.pm
+++ b/FS/FS/prospect_main.pm
@@ -288,8 +288,13 @@ Returns the locations (see L<FS::cust_location>) associated with this prospect.
 
 sub cust_location {
   my $self = shift;
-  qsearch( 'cust_location', { 'prospectnum' => $self->prospectnum,
-                              'custnum'     => '' } );
+  qsearch({
+    'table'   => 'cust_location',
+    'hashref' => { 'prospectnum' => $self->prospectnum,
+                   'custnum'     => '',
+                 },
+    'order_by' => 'ORDER BY country, LOWER(state), LOWER(city), LOWER(county), LOWER(address1), LOWER(address2)',
+  });
 }
 
 =item qual
diff --git a/httemplate/elements/tr-select-cust_location.html b/httemplate/elements/tr-select-cust_location.html
index 3078f2c..47a917d 100644
--- a/httemplate/elements/tr-select-cust_location.html
+++ b/httemplate/elements/tr-select-cust_location.html
@@ -271,7 +271,9 @@ my $location_sort = sub {
   #enabled w/label_prefix _location #    $a->locationname cmp $b->locationname
                                     # or 
         $a->country   cmp $b->country
+  or lc($a->state)    cmp lc($b->state)
   or lc($a->city)     cmp lc($b->city)
+  or lc($a->county)   cmp lc($b->county)
   or lc($a->address1) cmp lc($b->address1)
   or lc($a->address2) cmp lc($b->address2)
 };

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

Summary of changes:
 FS/FS/cust_main.pm                               |   18 +++++++++++++-----
 FS/FS/prospect_main.pm                           |    9 +++++++--
 httemplate/elements/tr-select-cust_location.html |    2 ++
 3 files changed, 22 insertions(+), 7 deletions(-)




More information about the freeside-commits mailing list