diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-03-13 05:41:18 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-03-13 05:41:18 +0000 |
commit | ab7cede7f91f48f553a86f500d2bcb7408fbb84a (patch) | |
tree | b60e950c960d8e14d9d1956d877b9fe41023d190 | |
parent | 665470fabcd881eaf1b01008866e1da84f9c073a (diff) |
LedgerSMB::DBObject LedgerSMB::Setting LedgerSMB::Employee, and LedgerSMB::Location all now use strict
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@890 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r-- | LedgerSMB/DBObject.pm | 20 | ||||
-rw-r--r-- | LedgerSMB/Employee.pm | 2 | ||||
-rw-r--r-- | LedgerSMB/Location.pm | 2 | ||||
-rw-r--r-- | LedgerSMB/Setting.pm | 10 |
4 files changed, 21 insertions, 13 deletions
diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm index 17e4e4b0..83a94d4a 100644 --- a/LedgerSMB/DBObject.pm +++ b/LedgerSMB/DBObject.pm @@ -26,7 +26,6 @@ your software. package LedgerSMB::DBObject; use LedgerSMB; use strict; -no strict 'refs'; use warnings; our @ISA = qw(LedgerSMB); @@ -86,13 +85,16 @@ sub run_custom_queries { 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 @@ sub run_custom_queries { 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 @@ sub run_custom_queries { } 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; diff --git a/LedgerSMB/Employee.pm b/LedgerSMB/Employee.pm index 0aa94961..bf22cb45 100644 --- a/LedgerSMB/Employee.pm +++ b/LedgerSMB/Employee.pm @@ -31,12 +31,14 @@ your software. 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, @_); diff --git a/LedgerSMB/Location.pm b/LedgerSMB/Location.pm index 69403a7b..05b38094 100644 --- a/LedgerSMB/Location.pm +++ b/LedgerSMB/Location.pm @@ -32,12 +32,14 @@ your software. 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, @_); diff --git a/LedgerSMB/Setting.pm b/LedgerSMB/Setting.pm index 959fcaeb..e257d63a 100644 --- a/LedgerSMB/Setting.pm +++ b/LedgerSMB/Setting.pm @@ -30,25 +30,29 @@ your software. 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. |