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

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



Revision: 890
          http://svn.sourceforge.net/ledger-smb/?rev=890&view=rev
Author:   einhverfr
Date:     2007-03-12 22:41:18 -0700 (Mon, 12 Mar 2007)

Log Message:
-----------
LedgerSMB::DBObject LedgerSMB::Setting LedgerSMB::Employee, and LedgerSMB::Location all now use strict

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject.pm
    trunk/LedgerSMB/Employee.pm
    trunk/LedgerSMB/Location.pm
    trunk/LedgerSMB/Setting.pm

Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm	2007-03-13 05:17:23 UTC (rev 889)
+++ trunk/LedgerSMB/DBObject.pm	2007-03-13 05:41:18 UTC (rev 890)
@@ -26,7 +26,6 @@
 package LedgerSMB::DBObject;
 use LedgerSMB;
 use strict;
-no strict 'refs';
 use warnings;
 
 our @ISA = qw(LedgerSMB);
@@ -86,13 +85,16 @@
 	my ($self, $tablename, $query_type, $linenum) = @_;
 	my $dbh = $self->{dbh};
 	if ($query_type !~ /^(select|insert|update)$/i){
-		$self->error($locale->text(
-			"Passed incorrect query type to run_custom_queries."
-		));
+		# Commenting out this next bit until we figure out how the locale object
+		# will operate.  Chris
+		#$self->error($locale->text(
+		#	"Passed incorrect query type to run_custom_queries."
+		#));
 	}
 	my @rc;
 	my %temphash;
 	my @templist;
+	my $did_insert;
 	my @elements;
 	my $query;
 	my $ins_values;
@@ -152,7 +154,7 @@
 	if ($query_type eq 'INSERT'){
 		for (@rc){
 			$query = shift (@{$_});
-			$sth = $dbh->prepare($query) 
+			my $sth = $dbh->prepare($query) 
 				|| $self->db_error($query);
 			$sth->execute(@{$_}, $self->{id})
 				|| $self->dberror($query);;
@@ -165,12 +167,10 @@
 	} elsif ($query_type eq 'SELECT'){
 		for (@rc){
 			$query = shift @{$_};
-			$sth = $self->{dbh}->prepare($query);
+			my $sth = $self->{dbh}->prepare($query);
 			$sth->execute($self->{id});
-			$ref = $sth->fetchrow_hashref(NAME_lc);
-			for (keys %{$ref}){
-				$self->{$_} = $ref->{$_};
-			}
+			my $ref = $sth->fetchrow_hashref('NAME_lc');
+			$self->merge($ref, keys(%$ref));
 		}
 	}
 	@rc;

Modified: trunk/LedgerSMB/Employee.pm
===================================================================
--- trunk/LedgerSMB/Employee.pm	2007-03-13 05:17:23 UTC (rev 889)
+++ trunk/LedgerSMB/Employee.pm	2007-03-13 05:41:18 UTC (rev 890)
@@ -31,12 +31,14 @@
 package LedgerSMB::Employee;
 use LedgerSMB;
 use LedgerSMB::DBObject;
+use strict;
 our $VERSION = '1.0.0';
 
 our @ISA = qw(LedgerSMB::DBObject);
 
 sub AUTOLOAD {
 	my $self = shift;
+	my $AUTOLOAD = $LedgerSMB::Employee::AUTOLOAD;
 	$AUTOLOAD =~ s/^.*:://;
 	my $procname = "employee_$AUTOLOAD";
 	$self->exec_method($procname, @_);

Modified: trunk/LedgerSMB/Location.pm
===================================================================
--- trunk/LedgerSMB/Location.pm	2007-03-13 05:17:23 UTC (rev 889)
+++ trunk/LedgerSMB/Location.pm	2007-03-13 05:41:18 UTC (rev 890)
@@ -32,12 +32,14 @@
 package LedgerSMB::Location;
 use LedgerSMB;
 use LedgerSMB::DBObject;
+use strict;
 our $VERSION = '1.0.0';
 
 our @ISA = qw(LedgerSMB::DBObject);
 
 sub AUTOLOAD {
 	my $self = shift;
+	my $AUTOLOAD = $LedgerSMB::Location::AUTOLOAD;
 	$AUTOLOAD =~ s/^.*:://;
 	my $procname = "location_$AUTOLOAD";
 	$self->exec_method($procname, @_);

Modified: trunk/LedgerSMB/Setting.pm
===================================================================
--- trunk/LedgerSMB/Setting.pm	2007-03-13 05:17:23 UTC (rev 889)
+++ trunk/LedgerSMB/Setting.pm	2007-03-13 05:41:18 UTC (rev 890)
@@ -30,25 +30,29 @@
 package LedgerSMB::Setting;
 use LedgerSMB;
 use LedgerSMB::DBObject;
+use strict;
 our $VERSION = '1.0.0';
 
 our @ISA = qw(LedgerSMB::DBObject);
 
 sub AUTOLOAD {
 	my $self = shift;
+	my $AUTOLOAD = $LedgerSMB::Setting::AUTOLOAD;
 	$AUTOLOAD =~ s/^.*:://;
 	my $procname = "setting_$AUTOLOAD";
 	$self->exec_method($procname, @_);
 }
 
 sub get {
-	$self = shift;
-	$hashref = @{$self->exec_method('setting_get');
+	my $self = shift;
+	my $hashref = shift @{$self->exec_method('setting_get')};
 	$self->merge($hashref, 'value');
+}
 
 sub parse {
 
-	$self = shift;
+	my $self = shift;
+	my $myconfig = shift;
 
 	# Long-run, we may want to run this via Parse::RecDescent, but this is
 	# at least a start for here.  Chris T.


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