summaryrefslogtreecommitdiff
path: root/LedgerSMB.pm
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-03-16 05:07:02 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-03-16 05:07:02 +0000
commit547e6b5f1273da8fa7ad04883cd44e061c8bd975 (patch)
tree9c32cbb15fe1c8b233e5342885c86d8350e4a54c /LedgerSMB.pm
parent119f418d6627eb0939778a5a9bcd6a64223ab225 (diff)
Adding completed LedgerSMB::redo_rows
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@915 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB.pm')
-rwxr-xr-xLedgerSMB.pm25
1 files changed, 22 insertions, 3 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index 6a11706d..2b02c052 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -69,8 +69,10 @@ This function redirects to the script and argument set determined by
$self->{callback}, and if this is not set, goes to an info screen and prints
$msg.
-=item redo_rows (fields => \@list, count => $integer);
-This function is undergoing serious redesign at the moment.
+=item redo_rows (fields => \@list, count => $integer, [index => $string);
+This function is undergoing serious redesign at the moment. If index is
+defined, that field is used for ordering the rows. If not, runningnumber is
+used.
=head1 Copyright (C) 2006, The LedgerSMB core team.
@@ -569,7 +571,24 @@ sub redo_rows {
my %args = @_;
my @flds = @{$args{fields}};
my $count = $args{count};
-
+ my $index = ($args{index}) ? $args{index} : 'runningnumber';
+
+ my @rows;
+ my $i; # incriment counter use only
+ for $i (1 .. $count){
+ my $temphash = {_inc => $i};
+ for my $fld (@flds){
+ $temphash->{$fld} = $self->{"$fld"."_$i"}
+ }
+ push @rows, $temphash;
+ }
+ $i = 1;
+ for my $row (sort {$a->{index} <=> $b->{index}} @rows){
+ for my $fld (@flds){
+ $self->{"$fld"."_$i"} = $row->{$fld};
+ }
+ ++$i;
+ }
}