From 3d967be3d2f32e2b00f5f55769edcbf5be866ce6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 20 Oct 2009 11:20:33 +0200 Subject: [PATCH] weitere stricts --- SL/AR.pm | 7 +++++-- SL/DBUtils.pm | 2 ++ SL/InstallationCheck.pm | 2 ++ SL/PE.pm | 9 ++++++--- SL/User.pm | 10 +++++----- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/SL/AR.pm b/SL/AR.pm index a211b1fcf..3364c864e 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -38,6 +38,8 @@ use Data::Dumper; use SL::DBUtils; use SL::MoreCommon; +use strict; + our (%myconfig, $form); sub post_transaction { @@ -252,7 +254,7 @@ sub post_transaction { $amount = $form->round_amount( $form->{"paid_$i"} * ($form->{exchangerate} - $form->{"exchangerate_$i"}) * -1, 2); if ($amount != 0) { - $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}; + my $accno = ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno}; $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, fx_transaction, cleared, project_id, taxkey) VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, 't', 'f', ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|; @values = (conv_i($form->{id}), $accno, $amount, conv_date($form->{"datepaid_$i"}), $project_id, $accno); @@ -524,7 +526,8 @@ sub setup_form { my ($self, $form) = @_; - my ($exchangerate, $key, $akey, $i, $j, $k, $index, $taxamount, $totaltax, $taxrate, $diff); + my ($exchangerate, $key, $akey, $i, $j, $k, $index, $taxamount, $totaltax, $taxrate, $diff, $totalwithholding, $withholdingrate, + $totalamount, $taxincluded, $tax); # forex $form->{forex} = $form->{exchangerate}; diff --git a/SL/DBUtils.pm b/SL/DBUtils.pm index 000bc1bdb..6d20a695c 100644 --- a/SL/DBUtils.pm +++ b/SL/DBUtils.pm @@ -12,6 +12,8 @@ our @EXPORT = qw(conv_i conv_date conv_dateq do_query selectrow_query do_stateme create_sort_spec does_table_exist add_token); +use strict; + sub conv_i { my ($value, $default) = @_; return (defined($value) && "$value" ne "") ? $value * 1 : $default; diff --git a/SL/InstallationCheck.pm b/SL/InstallationCheck.pm index 96c8a0694..0c1591662 100644 --- a/SL/InstallationCheck.pm +++ b/SL/InstallationCheck.pm @@ -5,6 +5,8 @@ use IO::File; use vars qw(@required_modules @optional_modules); +use strict; + @required_modules = ( { "name" => "Class::Accessor", "url" => "http://search.cpan.org/~kasei/" }, { "name" => "CGI", "url" => "http://search.cpan.org/~lds/" }, diff --git a/SL/PE.pm b/SL/PE.pm index d165a2f9a..31a8bd507 100644 --- a/SL/PE.pm +++ b/SL/PE.pm @@ -38,6 +38,8 @@ use Data::Dumper; use SL::DBUtils; +use strict; + sub partsgroups { $main::lxdebug->enter_sub(); @@ -90,6 +92,7 @@ sub save_partsgroup { $form->{discount} /= 100; my @values = ($form->{partsgroup}); + my $query; if ($form->{id}) { $query = qq|UPDATE partsgroup SET partsgroup = ? WHERE id = ?|; @@ -119,7 +122,7 @@ sub get_partsgroup { qq|WHERE pg.id = ?|; my $sth = prepare_execute_query($form, $dbh, $query, $form->{id}, $form->{id}); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map({ $form->{$_} = $ref->{$_} } keys(%{$ref})); $sth->finish; @@ -139,7 +142,7 @@ sub delete_tuple { my $table = $form->{type} eq "pricegroup" ? "pricegroup" : "partsgroup"; - $query = qq|DELETE FROM $table WHERE id = ?|; + my $query = qq|DELETE FROM $table WHERE id = ?|; do_query($form, $dbh, $query, $form->{id}); $dbh->disconnect; @@ -240,7 +243,7 @@ sub get_pricegroup { my $query = qq|SELECT id, pricegroup FROM pricegroup WHERE id = ?|; my $sth = prepare_execute_query($form, $dbh, $query, $form->{id}); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map({ $form->{$_} = $ref->{$_} } keys(%{$ref})); diff --git a/SL/User.pm b/SL/User.pm index cde96f949..2115ddc76 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -34,8 +34,6 @@ package User; -#use strict; - use IO::File; use Fcntl qw(:seek); @@ -45,6 +43,8 @@ use SL::DBUtils; use SL::Iconv; use SL::Inifile; +use strict; + sub new { $main::lxdebug->enter_sub(); @@ -107,7 +107,7 @@ sub login { my $dbh = DBI->connect($myconfig{dbconnect}, $myconfig{dbuser}, $myconfig{dbpasswd}) - or $self->error(DBI::errstr); + or $self->error($DBI::errstr); # we got a connection, check the version my $query = qq|SELECT version FROM defaults|; @@ -802,7 +802,7 @@ sub dbupdate { last if ($version < $mindb); # apply upgrade - $main::lxdebug->message(LXDebug::DEBUG2, "Applying Update $upgradescript"); + $main::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $upgradescript"); if ($file_type eq "sql") { $self->process_query($form, $dbh, "sql/" . $form->{"dbdriver"} . "-upgrade/$upgradescript", $str_maxdb, $db_charset); @@ -886,7 +886,7 @@ sub dbupdate2 { my $file_type = $1; # apply upgrade - $main::lxdebug->message(LXDebug::DEBUG2, "Applying Update $control->{file}"); + $main::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $control->{file}"); print $form->parse_html_template("dbupgrade/upgrade_message2", $control); if ($file_type eq "sql") { -- 2.20.1