run exports in weight order, #14924
authormark <mark>
Fri, 28 Oct 2011 06:44:52 +0000 (06:44 +0000)
committermark <mark>
Fri, 28 Oct 2011 06:44:52 +0000 (06:44 +0000)
FS/FS/part_export.pm
FS/FS/part_svc.pm

index 890c522..9a479b7 100644 (file)
@@ -401,6 +401,18 @@ or hidden by default).
 
 =cut
 
+=item weight
+
+Returns the 'weight' element from the export's %info hash, or 0 if there is 
+no weight defined.
+
+=cut
+
+sub weight {
+  my $self = shift;
+  export_info()->{$self->exporttype}->{'weight'} || 0;
+}
+
 =back
 
 =head1 SUBROUTINES
index 3ae79a6..4a1b308 100644 (file)
@@ -434,6 +434,7 @@ sub part_export {
   my $self = shift;
   my %search;
   $search{'exporttype'} = shift if @_;
+  sort { $a->weight <=> $b->weight }
   map { qsearchs('part_export', { 'exportnum' => $_->exportnum, %search } ) }
     qsearch('export_svc', { 'svcpart' => $self->svcpart } );
 }