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

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



Revision: 913
          http://svn.sourceforge.net/ledger-smb/?rev=913&view=rev
Author:   einhverfr
Date:     2007-03-15 20:27:50 -0700 (Thu, 15 Mar 2007)

Log Message:
-----------
LedgerSMB::redo_rows is broken for now but unused.  All functions in LedgerSMB.pm from SQL-Ledger have attributions marked

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

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-03-16 02:05:28 UTC (rev 912)
+++ trunk/LedgerSMB.pm	2007-03-16 03:27:50 UTC (rev 913)
@@ -43,9 +43,9 @@
 This function converts fields to their appropriate representation in 
 HTML/SGML/XML or LaTeX.
 
-=item is_blank (msg=> $string, name => $string)
-This function invokes self->error($msg) if the property contains no 
-non-whitespace characters.
+=item is_blank (name => $string)
+This function returns true if $self->{$string} only consists of whitespace
+characters or is an empty string.
 
 =item num_text_rows (string => $string, cols => $number, max => $number);
 
@@ -65,7 +65,7 @@
 $self->{callback}, and if this is not set, goes to an info screen and prints
 $msg.
 
-=item redo_rows (fields =>, new =>, count =>,  rows => $integer);
+=item redo_rows (fields => ..hidden.., count => $integer);
 This function is undergoing serious redesign at the moment.
 
 =head1 Copyright (C) 2006, The LedgerSMB core team.
@@ -102,6 +102,7 @@
 
 sub new {
 	# This will probably be the last to be revised.
+	# Based on SQL-Ledger's Form::new
 
 	my $type = shift;
 
@@ -172,6 +173,7 @@
 
 
 sub unescape {
+	# Based on SQL-Ledger's Form::unescape
 	my ($self) = @_;
 	my %args = @_;
 	my $str = $args{string};
@@ -190,9 +192,13 @@
 	my $self = shift @_;
 	my %args = @_;
 	my $name = $args{name};
-	my $msg = $args{msg};
-	
-	$self->error($msg) if $self->{$name} =~ /^\s*$/;
+	my $rc;
+	if ($self->{$name} =~ /^\s*$/){
+		$rc = 1;
+	} else {
+		$rc = 0;
+	}
+	$rc;
 }
 
 sub num_text_rows {
@@ -218,7 +224,9 @@
 		++$rows;
 	}
 
-	$maxrows = $rows unless defined $maxrows;
+	if (! defined $maxrows){
+		$maxrows = $rows;
+	}
 
 	return ($rows > $maxrows) ? $maxrows : $rows;
 
@@ -240,6 +248,7 @@
 }
 
 sub format_fields {
+	# Based on SQL-Ledger's Form::format_string
 	# We should look at moving this into LedgerSMB::Template.
 	# And cleaning it up......  Chris
 
@@ -283,6 +292,7 @@
 # TODO:  Either we should have an amount class with formats and such attached
 # Or maybe we should move this into the user class...
 sub format_amount {
+	# Based on SQL-Ledger's Form::format_amount
 	my $self = shift @_;
 	my %args = @_;
 	my $myconfig = $args{user};
@@ -470,6 +480,7 @@
 
 # This should probably be moved to User too...
 sub date_to_number {
+	#based on SQL-Ledger's Form::datetonum
 	my $self = shift @_;
 	my %args = @_;
 	my $myconfig = $args{user};
@@ -533,35 +544,13 @@
 	}
 }
 
-# This needs some *real* work.
 sub redo_rows {
 
 	$self = shift @_;
 	%args = @_;
 	@flds = @{$args{fields}};
-	$new = $args{new};
 	$count = $args{count};
-	$numrows = $args{rows};
 
-	my @ndx = ();
-
-	for (1 .. $count) { 
-		push @ndx, { num => $new->[$_-1]->{runningnumber}, ndx => $_ } 
-	}
-
-	my $i = 0;
-	my $j;
-	# fill rows
-	foreach my $item (sort { $a->{num} <=> $b->{num} } @ndx) {
-		$i++;
-		$j = $item->{ndx} - 1;
-		for (@flds) { $self->{"${_}_$i"} = $new->[$j]->{$_} }
-	}
-
-	# delete empty rows
-	for $i ($count + 1 .. $numrows) {
-		for (@{$flds}) { delete $self->{"${_}_$i"} }
-	}
 }
 
 


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