projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
70c8906
)
sort packages by label of first (primary) service, RT#5041
author
ivan
<ivan>
Thu, 26 Mar 2009 03:53:45 +0000
(
03:53
+0000)
committer
ivan
<ivan>
Thu, 26 Mar 2009 03:53:45 +0000
(
03:53
+0000)
FS/FS/cust_main.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
27a617e
..
73cf826
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-1895,15
+1895,21
@@
sub ncancelled_pkgs {
# This should be generalized to use config options to determine order.
sub sort_packages {
# 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');
return -1 if $b->get('cancel');
return 1 if $a->get('cancel');
+ #shouldn't get here...
return 0;
} else {
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
}
=item suspended_pkgs