[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [915] trunk/LedgerSMB.pm



Revision: 915
          http://svn.sourceforge.net/ledger-smb/?rev=915&view=rev
Author:   einhverfr
Date:     2007-03-15 22:07:02 -0700 (Thu, 15 Mar 2007)

Log Message:
-----------
Adding completed LedgerSMB::redo_rows

Modified Paths:
--------------
    trunk/LedgerSMB.pm

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-03-16 03:46:18 UTC (rev 914)
+++ trunk/LedgerSMB.pm	2007-03-16 05:07:02 UTC (rev 915)
@@ -69,8 +69,10 @@
 $self->{callback}, and if this is not set, goes to an info screen and prints
 $msg.
 
-=item redo_rows (fields => ..hidden.., count => $integer);
-This function is undergoing serious redesign at the moment.
+=item redo_rows (fields => ..hidden.., 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 @@
 	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;
+	}
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.