[freeside-commits] freeside/FS/FS cust_main.pm,1.411,1.412
Ivan,,,
ivan at wavetail.420.am
Wed Mar 25 20:53:49 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv5065
Modified Files:
cust_main.pm
Log Message:
sort packages by label of first (primary) service, RT#5041
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.411
retrieving revision 1.412
diff -u -d -r1.411 -r1.412
--- cust_main.pm 15 Mar 2009 10:46:31 -0000 1.411
+++ cust_main.pm 26 Mar 2009 03:53:45 -0000 1.412
@@ -1895,15 +1895,21 @@
# This should be generalized to use config options to determine order.
sub sort_packages {
- if ( $a->get('cancel') and $b->get('cancel') ) {
- $a->pkgnum <=> $b->pkgnum;
- } elsif ( $a->get('cancel') or $b->get('cancel') ) {
+
+ if ( $a->get('cancel') xor $b->get('cancel') ) {
return -1 if $b->get('cancel');
return 1 if $a->get('cancel');
+ #shouldn't get here...
return 0;
} else {
- $a->pkgnum <=> $b->pkgnum;
+ my @a_cust_svc = $a->cust_svc;
+ my @b_cust_svc = $b->cust_svc;
+ return 0 if !scalar(@a_cust_svc) && !scalar(@b_cust_svc);
+ return -1 if scalar(@a_cust_svc) && !scalar(@b_cust_svc);
+ return 1 if !scalar(@a_cust_svc) && scalar(@b_cust_svc);
+ $a_cust_svc[0]->svc_x->label cmp $b_cust_svc[0]->svc_x->label;
}
+
}
=item suspended_pkgs
More information about the freeside-commits
mailing list