From c510d88bbfea6818ffafaddb7286e88aec96d3b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 20 Oct 2009 15:53:24 +0200 Subject: [PATCH] und die restlichen .pm Module. --- SL/Auth/DB.pm | 8 +-- SL/Auth/LDAP.pm | 19 ++++--- SL/CT.pm | 2 + SL/DATEV.pm | 62 ++++++++++++++--------- SL/DATEV/KNEFile.pm | 3 ++ SL/FU.pm | 2 + SL/Form.pm | 8 +-- SL/Iconv.pm | 2 + SL/MIME.pm | 2 + SL/Mailer.pm | 2 + SL/Num2text.pm | 4 +- SL/OE.pm | 2 + SL/OP.pm | 4 +- SL/RP.pm | 6 ++- SL/Template.pm | 62 +++++++++++++++-------- SL/Template/Plugin/JavaScript.pm | 2 + SL/Template/Plugin/LxERP.pm | 2 + SL/Template/Plugin/MultiColumnIterator.pm | 51 ++++++++++--------- SL/WH.pm | 10 ++-- 19 files changed, 160 insertions(+), 93 deletions(-) diff --git a/SL/Auth/DB.pm b/SL/Auth/DB.pm index 8d92d8244..d4e4d48cc 100644 --- a/SL/Auth/DB.pm +++ b/SL/Auth/DB.pm @@ -5,6 +5,8 @@ use DBI; #use SL::Auth; use SL::DBUtils; +use strict; + sub new { $main::lxdebug->enter_sub(); @@ -32,7 +34,7 @@ sub authenticate { if (!$dbh) { $main::lxdebug->leave_sub(); - return SL::Auth::ERR_BACKEND; + return SL::Auth->ERR_BACKEND(); } my $query = qq|SELECT password FROM auth."user" WHERE login = ?|; @@ -43,7 +45,7 @@ sub authenticate { $main::lxdebug->leave_sub(); - return $password eq $stored_password ? SL::Auth::OK : SL::Auth::ERR_PASSWORD; + return $password eq $stored_password ? SL::Auth->OK() : SL::Auth->ERR_PASSWORD(); } sub can_change_password { @@ -62,7 +64,7 @@ sub change_password { if (!$dbh) { $main::lxdebug->leave_sub(); - return SL::Auth::ERR_BACKEND + return SL::Auth->ERR_BACKEND() } $password = crypt $password, substr($login, 0, 2) if (!$is_crypted); diff --git a/SL/Auth/LDAP.pm b/SL/Auth/LDAP.pm index 4caeea0c5..10d15c0b8 100644 --- a/SL/Auth/LDAP.pm +++ b/SL/Auth/LDAP.pm @@ -4,6 +4,8 @@ use English '-no_match_vars'; #use SL::Auth; +use strict; + sub new { $main::lxdebug->enter_sub(); @@ -144,32 +146,32 @@ sub authenticate { if ($is_crypted) { $main::lxdebug->leave_sub(); - return SL::Auth::ERR_BACKEND; + return SL::Auth->ERR_BACKEND(); } my $ldap = $self->_connect(); if (!$ldap) { $main::lxdebug->leave_sub(); - return SL::Auth::ERR_BACKEND; + return SL::Auth->ERR_BACKEND(); } my $dn = $self->_get_user_dn($ldap, $login); - $main::lxdebug->message(LXDebug::DEBUG2, "LDAP authenticate: dn $dn"); + $main::lxdebug->message(LXDebug->DEBUG2(), "LDAP authenticate: dn $dn"); if (!$dn) { $main::lxdebug->leave_sub(); - return SL::Auth::ERR_BACKEND; + return SL::Auth->ERR_BACKEND(); } my $mesg = $ldap->bind($dn, 'password' => $password); - $main::lxdebug->message(LXDebug::DEBUG2, "LDAP authenticate: bind mesg " . $mesg->error()); + $main::lxdebug->message(LXDebug->DEBUG2(), "LDAP authenticate: bind mesg " . $mesg->error()); $main::lxdebug->leave_sub(); - return $mesg->is_error() ? SL::Auth::ERR_PASSWORD : SL::Auth::OK; + return $mesg->is_error() ? SL::Auth->ERR_PASSWORD() : SL::Auth->OK(); } sub can_change_password { @@ -177,12 +179,15 @@ sub can_change_password { } sub change_password { - return SL::Auth::ERR_BACKEND; + return SL::Auth->ERR_BACKEND(); } sub verify_config { $main::lxdebug->enter_sub(); + my $form = $main::form; + my $locale = $main::locale; + my $self = shift; my $cfg = $self->{auth}->{LDAP_config}; diff --git a/SL/CT.pm b/SL/CT.pm index 9b2b79f13..12df265d8 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -45,6 +45,8 @@ use SL::DBUtils; use SL::FU; use SL::Notes; +use strict; + sub get_tuple { $main::lxdebug->enter_sub(); diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 407943928..1a455f3ec 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -36,6 +36,8 @@ use Data::Dumper; use File::Path; use Time::HiRes qw(gettimeofday); +use strict; + sub _get_export_path { $main::lxdebug->enter_sub(); @@ -125,11 +127,11 @@ sub get_datev_stamm { # connect to database my $dbh = $form->dbconnect($myconfig); - $query = qq|SELECT * FROM datev|; - $sth = $dbh->prepare($query); + my $query = qq|SELECT * FROM datev|; + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - my $ref = $sth->fetchrow_hashref(NAME_lc); + my $ref = $sth->fetchrow_hashref("NAME_lc"); map { $form->{$_} = $ref->{$_} } keys %$ref; @@ -146,7 +148,7 @@ sub save_datev_stamm { # connect to database my $dbh = $form->dbconnect_noauto($myconfig); - $query = qq|DELETE FROM datev|; + my $query = qq|DELETE FROM datev|; $dbh->do($query) || $form->dberror($query); $query = qq|INSERT INTO datev @@ -159,7 +161,7 @@ sub save_datev_stamm { . $dbh->quote($form->{mandantennr}) . qq|,| . $dbh->quote($form->{datentraegernr}) . qq|,| . $dbh->quote($form->{abrechnungsnr}) . qq|)|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $sth->finish; @@ -201,6 +203,9 @@ sub get_dates { $main::lxdebug->enter_sub(); my ($zeitraum, $monat, $quartal, $transdatefrom, $transdateto) = @_; + my ($fromto, $jahr, $leap); + + my $form = $main::form; $fromto = "transdate >= "; @@ -322,6 +327,7 @@ sub _get_transactions { my $dbh = $form->get_standard_dbh($myconfig); + my ($notsplitindex); my @errors = (); $fromto =~ s/transdate/ac\.transdate/g; @@ -379,7 +385,7 @@ sub _get_transactions { my $sth = prepare_execute_query($form, $dbh, $query); my $counter = 0; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { $counter++; if (($counter % 500) == 0) { print("$counter "); @@ -391,7 +397,7 @@ sub _get_transactions { my $firstrun = 1; while (abs($count) > 0.01 || $firstrun) { - my $ref2 = $sth->fetchrow_hashref(NAME_lc); + my $ref2 = $sth->fetchrow_hashref("NAME_lc"); last unless ($ref2); if ($ref2->{trans_id} != $trans->[0]->{trans_id}) { @@ -490,6 +496,7 @@ sub _get_transactions { my $idx = 0; my $correction = 0; + our @taxed; # most likely defunct while (abs($absumsatz) >= 0.01) { if ($idx >= scalar @taxed) { last if (!$correction); @@ -542,6 +549,7 @@ sub make_kne_data_header { $main::lxdebug->enter_sub(); my ($myconfig, $form, $fromto, $start_jahr) = @_; + my ($primanota); my $jahr = $start_jahr; if (!$jahr) { @@ -626,7 +634,7 @@ sub datetofour { my ($date, $six) = @_; - ($day, $month, $year) = split(/\./, $date); + my ($day, $month, $year) = split(/\./, $date); if ($day =~ /^0/) { $day = substr($day, 1, 1); @@ -668,7 +676,7 @@ sub make_ed_versionset { if ($fromto ne "") { $versionset .= "0000" . substr($header, 28, 19); } else { - $datum = " " x 16; + my $datum = " " x 16; $versionset .= $datum . "001" . substr($header, 28, 4); } @@ -711,7 +719,7 @@ sub kne_buchungsexport { my $export_path = _get_export_path() . "/"; my $filename = "ED00000"; my $evfile = "EV01"; - my @ed_versionsets; + my @ed_versionset; my $fileno = 0; $form->header; @@ -721,7 +729,7 @@ sub kne_buchungsexport { Buchungssätze verarbeitet: |; - ($fromto, $start_jahr) = + my ($fromto, $start_jahr) = &get_dates($form->{zeitraum}, $form->{monat}, $form->{quartal}, $form->{transdatefrom}, $form->{transdateto}); @@ -733,14 +741,14 @@ sub kne_buchungsexport { $filename++; my $ed_filename = $export_path . $filename; push(@filenames, $filename); - $header = &make_kne_data_header($myconfig, $form, $fromto, $start_jahr); + my $header = &make_kne_data_header($myconfig, $form, $fromto, $start_jahr); my $kne_file = SL::DATEV::KNEFile->new(); $kne_file->add_block($header); while (scalar(@{ $form->{DATEV} }) > 0) { - $transaction = shift @{ $form->{DATEV} }; - $trans_lines = scalar(@{$transaction}); + my $transaction = shift @{ $form->{DATEV} }; + my $trans_lines = scalar(@{$transaction}); $counter++; if (($counter % 500) == 0) { print("$counter "); @@ -757,6 +765,7 @@ sub kne_buchungsexport { my $datevautomatik = 0; my $taxkey = 0; my $charttax = 0; + my ($haben, $soll); my $iconv = $main::locale->{iconv_iso8859}; my %umlaute = ($iconv->convert('ä') => 'ae', $iconv->convert('ö') => 'oe', @@ -792,7 +801,7 @@ sub kne_buchungsexport { } # Umwandlung von Umlauten und Sonderzeichen in erlaubte Zeichen bei Textfeldern - foreach $umlaut (keys(%umlaute)) { + foreach my $umlaut (keys(%umlaute)) { $transaction->[$haben]->{'invnumber'} =~ s/${umlaut}/${umlaute{$umlaut}}/g; $transaction->[$haben]->{'name'} =~ s/${umlaut}/${umlaute{$umlaut}}/g; } @@ -856,13 +865,13 @@ sub kne_buchungsexport { } #Make EV Verwaltungsdatei - $ev_header = &make_ev_header($form, $fileno); - $ev_filename = $export_path . $evfile; + my $ev_header = &make_ev_header($form, $fileno); + my $ev_filename = $export_path . $evfile; push(@filenames, $evfile); open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n"; print(EV $ev_header); - foreach $file (@ed_versionset) { + foreach my $file (@ed_versionset) { print(EV $ed_versionset[$file]); } close(EV); @@ -891,7 +900,7 @@ sub kne_stammdatenexport { my $export_path = _get_export_path() . "/"; my $filename = "ED00000"; my $evfile = "EV01"; - my @ed_versionsets; + my @ed_versionset; my $fileno = 1; my $i = 0; my $blockcount = 1; @@ -902,9 +911,12 @@ sub kne_stammdatenexport { my $ed_filename = $export_path . $filename; push(@filenames, $filename); open(ED, "> $ed_filename") or die "can't open outputfile: $!\n"; - $header = &make_kne_data_header($myconfig, $form, ""); + my $header = &make_kne_data_header($myconfig, $form, ""); $remaining_bytes -= length($header); + my $fuellzeichen; + our $fromto; + # connect to database my $dbh = $form->dbconnect($myconfig); @@ -928,7 +940,7 @@ sub kne_stammdatenexport { my $sth = $dbh->prepare($query); $sth->execute(@values) || $form->dberror($query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { if (($remaining_bytes - length("t" . $ref->{'accno'})) <= 6) { $fuellzeichen = ($blockcount * 256 - length($buchungssatz . $header)); $buchungssatz .= "\x00" x $fuellzeichen; @@ -958,7 +970,7 @@ sub kne_stammdatenexport { print(ED $header); print(ED $buchungssatz); $fuellzeichen = 256 - (length($header . $buchungssatz . "z") % 256); - $dateiende = "\x00" x $fuellzeichen; + my $dateiende = "\x00" x $fuellzeichen; print(ED "z"); print(ED $dateiende); close(ED); @@ -967,13 +979,13 @@ sub kne_stammdatenexport { $ed_versionset[0] = &make_ed_versionset($header, $filename, $blockcount, $fromto); - $ev_header = &make_ev_header($form, $fileno); - $ev_filename = $export_path . $evfile; + my $ev_header = &make_ev_header($form, $fileno); + my $ev_filename = $export_path . $evfile; push(@filenames, $evfile); open(EV, "> $ev_filename") or die "can't open outputfile: EV01\n"; print(EV $ev_header); - foreach $file (@ed_versionset) { + foreach my $file (@ed_versionset) { print(EV $ed_versionset[$file]); } close(EV); diff --git a/SL/DATEV/KNEFile.pm b/SL/DATEV/KNEFile.pm index c5f60ea12..e8ad4748a 100644 --- a/SL/DATEV/KNEFile.pm +++ b/SL/DATEV/KNEFile.pm @@ -1,5 +1,7 @@ package SL::DATEV::KNEFile; +use strict; + sub new { my $type = shift; my $self = {}; @@ -69,6 +71,7 @@ sub format_amount { my $self = shift; my $amount = shift; my $width = shift; + our $stellen; $amount =~ s/-//; my ($places, $decimal_places) = split m/\./, "$amount"; diff --git a/SL/FU.pm b/SL/FU.pm index a973beb0f..ad6149d69 100644 --- a/SL/FU.pm +++ b/SL/FU.pm @@ -8,6 +8,8 @@ use SL::Common; use SL::DBUtils; use SL::Notes; +use strict; + sub save { $main::lxdebug->enter_sub(); diff --git a/SL/Form.pm b/SL/Form.pm index 68272b31c..17273ec50 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -37,8 +37,6 @@ package Form; -#use strict; - use Data::Dumper; use CGI; @@ -59,6 +57,8 @@ use Template; use List::Util qw(first max min sum); use List::MoreUtils qw(any); +use strict; + my $standard_dbh; END { @@ -314,7 +314,7 @@ sub new { _recode_recursively($iconv, $self); } - delete $self{INPUT_ENCODING}; + delete $self->{INPUT_ENCODING}; } $self->{action} = lc $self->{action}; @@ -1588,7 +1588,7 @@ sub get_standard_dbh { my ($self, $myconfig) = @_; if ($standard_dbh && !$standard_dbh->{Active}) { - $main::lxdebug->message(LXDebug::INFO, "get_standard_dbh: \$standard_dbh is defined but not Active anymore"); + $main::lxdebug->message(LXDebug->INFO(), "get_standard_dbh: \$standard_dbh is defined but not Active anymore"); undef $standard_dbh; } diff --git a/SL/Iconv.pm b/SL/Iconv.pm index 29bf99df4..be0f7c2e4 100644 --- a/SL/Iconv.pm +++ b/SL/Iconv.pm @@ -6,6 +6,8 @@ use SL::Common; use vars qw(%converters); +use strict; + sub get_converter { my ($from_charset, $to_charset) = @_; diff --git a/SL/MIME.pm b/SL/MIME.pm index 9edfe0d0e..8fc5a391f 100644 --- a/SL/MIME.pm +++ b/SL/MIME.pm @@ -1,5 +1,7 @@ package SL::MIME; +use strict; + sub mime_type_from_ext { $main::lxdebug->enter_sub(); diff --git a/SL/Mailer.pm b/SL/Mailer.pm index 2e2a60cec..02b117398 100644 --- a/SL/Mailer.pm +++ b/SL/Mailer.pm @@ -36,6 +36,8 @@ use SL::Common; use SL::MIME; use SL::Template; +use strict; + my $num_sent = 0; sub new { diff --git a/SL/Num2text.pm b/SL/Num2text.pm index f38f10849..15575c356 100644 --- a/SL/Num2text.pm +++ b/SL/Num2text.pm @@ -32,6 +32,8 @@ # #===================================================================== +use strict; + sub init { my $self = shift; @@ -129,7 +131,7 @@ sub num2text { # add thousand, million if ($i) { - $num = 10**($i * 3); + my $num = 10**($i * 3); push(@textnumber, $self->{numbername}{$num}); } diff --git a/SL/OE.pm b/SL/OE.pm index f5f439fce..b40c06a74 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -41,6 +41,8 @@ use SL::CVar; use SL::DBUtils; use SL::IC; +use strict; + =head1 NAME OE.pm - Order entry module diff --git a/SL/OP.pm b/SL/OP.pm index e2088022c..43be29bf4 100644 --- a/SL/OP.pm +++ b/SL/OP.pm @@ -36,6 +36,8 @@ package OP; use SL::DBUtils; +use strict; + sub overpayment { $main::lxdebug->enter_sub(); @@ -70,7 +72,7 @@ sub overpayment { do_query($form, $dbh, $query, @values); # add AR/AP - ($accno) = split /--/, $form->{ $form->{ARAP} }; + my ($accno) = split /--/, $form->{ $form->{ARAP} }; $query = qq|INSERT INTO acc_trans (trans_id, chart_id, transdate, amount) | . diff --git a/SL/RP.pm b/SL/RP.pm index e4fb848cf..2aa1e8d98 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -37,9 +37,9 @@ package RP; use SL::DBUtils; use Data::Dumper; use List::Util qw(sum); -# use strict; -# use warnings; +# use warnings; +use strict; # new implementation of balance sheet # readme! @@ -439,6 +439,7 @@ sub get_accounts_g { my $glwhere = ""; my $prwhere = ""; my $subwhere = ""; + my $inwhere = ""; my $item; if ($fromdate) { @@ -776,6 +777,7 @@ sub trial_balance { my $glwhere = ''; my $glsumwhere = ''; my $tofrom; + my ($fromdate, $todate); if ($form->{fromdate} || $form->{todate}) { if ($form->{fromdate}) { diff --git a/SL/Template.pm b/SL/Template.pm index fe4b24893..b112b2c72 100644 --- a/SL/Template.pm +++ b/SL/Template.pm @@ -5,9 +5,17 @@ # Web http://www.lx-office.org # #==================================================================== +# +# +# NOTE: strict checks are package global. don't check this file +# with perl -sc, it will only capture SimpleTemplate +# +# package SimpleTemplate; +use strict; + # Parameters: # 1. The template's file name # 2. A reference to the Form object @@ -219,6 +227,8 @@ use vars qw(@ISA); @ISA = qw(SimpleTemplate); +use strict; + sub new { my $type = shift; @@ -666,6 +676,8 @@ use vars qw(@ISA); @ISA = qw(LaTeXTemplate); +use strict; + sub new { my $type = shift; @@ -790,6 +802,8 @@ use vars qw(@ISA); @ISA = qw(LaTeXTemplate); +use strict; + sub new { my $type = shift; @@ -828,10 +842,12 @@ use IO::File; @ISA = qw(SimpleTemplate); +use strict; + sub new { my $type = shift; - $self = $type->SUPER::new(@_); + my $self = $type->SUPER::new(@_); foreach my $module (qw(Archive::Zip Text::Iconv)) { eval("use ${module};"); @@ -1040,7 +1056,7 @@ sub parse { } my $zip = Archive::Zip->new(); - if (Archive::Zip::AZ_OK != $zip->read($file_name)) { + if (Archive::Zip->AZ_OK != $zip->read($file_name)) { $self->{"error"} = "File not found/is not a OpenDocument file."; $main::lxdebug->leave_sub(); return 0; @@ -1117,7 +1133,7 @@ sub is_xvfb_running { my $dfname = $self->{"userspath"} . "/xvfb_display"; my $display; - $main::lxdebug->message(LXDebug::DEBUG2, " Looking for $dfname\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " Looking for $dfname\n"); if ((-f $dfname) && open(IN, $dfname)) { my $pid = ; chomp($pid); @@ -1127,10 +1143,10 @@ sub is_xvfb_running { chomp($xauthority); close(IN); - $main::lxdebug->message(LXDebug::DEBUG2, " found with $pid and $display\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " found with $pid and $display\n"); if ((! -d "/proc/$pid") || !open(IN, "/proc/$pid/cmdline")) { - $main::lxdebug->message(LXDebug::DEBUG2, " no/wrong process #1\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " no/wrong process #1\n"); unlink($dfname, $xauthority); $main::lxdebug->leave_sub(); return undef; @@ -1138,7 +1154,7 @@ sub is_xvfb_running { my $line = ; close(IN); if ($line !~ /xvfb/i) { - $main::lxdebug->message(LXDebug::DEBUG2, " no/wrong process #2\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " no/wrong process #2\n"); unlink($dfname, $xauthority); $main::lxdebug->leave_sub(); return undef; @@ -1147,7 +1163,7 @@ sub is_xvfb_running { $ENV{"XAUTHORITY"} = $xauthority; $ENV{"DISPLAY"} = $display; } else { - $main::lxdebug->message(LXDebug::DEBUG2, " not found\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " not found\n"); } $main::lxdebug->leave_sub(); @@ -1160,7 +1176,7 @@ sub spawn_xvfb { my ($self) = @_; - $main::lxdebug->message(LXDebug::DEBUG2, "spawn_xvfb()\n"); + $main::lxdebug->message(LXDebug->DEBUG2, "spawn_xvfb()\n"); my $display = $self->is_xvfb_running(); @@ -1174,18 +1190,18 @@ sub spawn_xvfb { $display++; } $display = ":${display}"; - $main::lxdebug->message(LXDebug::DEBUG2, " display $display\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " display $display\n"); my $mcookie = `mcookie`; die("Installation error: mcookie not found.") if ($? != 0); chomp($mcookie); - $main::lxdebug->message(LXDebug::DEBUG2, " mcookie $mcookie\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " mcookie $mcookie\n"); my $xauthority = "/tmp/.Xauthority-" . $$ . "-" . time() . "-" . int(rand(9999999)); $ENV{"XAUTHORITY"} = $xauthority; - $main::lxdebug->message(LXDebug::DEBUG2, " xauthority $xauthority\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " xauthority $xauthority\n"); system("xauth add \"${display}\" . \"${mcookie}\""); if ($? != 0) { @@ -1194,15 +1210,15 @@ sub spawn_xvfb { return undef; } - $main::lxdebug->message(LXDebug::DEBUG2, " about to fork()\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " about to fork()\n"); my $pid = fork(); if (0 == $pid) { - $main::lxdebug->message(LXDebug::DEBUG2, " Child execing\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n"); exec($main::xvfb_bin, $display, "-screen", "0", "640x480x8", "-nolisten", "tcp"); } sleep(3); - $main::lxdebug->message(LXDebug::DEBUG2, " parent dont sleeping\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " parent dont sleeping\n"); local *OUT; my $dfname = $self->{"userspath"} . "/xvfb_display"; @@ -1216,7 +1232,7 @@ sub spawn_xvfb { print(OUT "$pid\n$display\n$xauthority\n"); close(OUT); - $main::lxdebug->message(LXDebug::DEBUG2, " parent re-testing\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " parent re-testing\n"); if (!$self->is_xvfb_running()) { $self->{"error"} = "Conversion to PDF failed because OpenOffice could not be started."; @@ -1226,7 +1242,7 @@ sub spawn_xvfb { return undef; } - $main::lxdebug->message(LXDebug::DEBUG2, " spawn OK\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " spawn OK\n"); $main::lxdebug->leave_sub(); @@ -1239,7 +1255,7 @@ sub is_openoffice_running { system("./scripts/oo-uno-test-conn.py $main::openofficeorg_daemon_port " . "> /dev/null 2> /dev/null"); my $res = $? == 0; - $main::lxdebug->message(LXDebug::DEBUG2, " is_openoffice_running(): $?\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " is_openoffice_running(): $?\n"); $main::lxdebug->leave_sub(); @@ -1251,7 +1267,7 @@ sub spawn_openoffice { my ($self) = @_; - $main::lxdebug->message(LXDebug::DEBUG2, "spawn_openoffice()\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), "spawn_openoffice()\n"); my ($try, $spawned_oo, $res); @@ -1265,14 +1281,14 @@ sub spawn_openoffice { if (!$spawned_oo) { my $pid = fork(); if (0 == $pid) { - $main::lxdebug->message(LXDebug::DEBUG2, " Child daemonizing\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " Child daemonizing\n"); chdir('/'); open(STDIN, '/dev/null'); open(STDOUT, '>/dev/null'); my $new_pid = fork(); exit if ($new_pid); my $ssres = setsid(); - $main::lxdebug->message(LXDebug::DEBUG2, " Child execing\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n"); my @cmdline = ($main::openofficeorg_writer_bin, "-minimized", "-norestore", "-nologo", "-nolockcheck", "-headless", @@ -1281,7 +1297,7 @@ sub spawn_openoffice { exec(@cmdline); } - $main::lxdebug->message(LXDebug::DEBUG2, " Parent after fork\n"); + $main::lxdebug->message(LXDebug->DEBUG2(), " Parent after fork\n"); $spawned_oo = 1; sleep(3); } @@ -1386,6 +1402,8 @@ sub format_string { } sub get_mime_type() { + my ($self) = @_; + if ($self->{"form"}->{"format"} =~ /pdf/) { return "application/pdf"; } else { @@ -1410,6 +1428,8 @@ use vars qw(@ISA); @ISA = qw(HTMLTemplate); +use strict; + sub new { #evtl auskommentieren my $type = shift; diff --git a/SL/Template/Plugin/JavaScript.pm b/SL/Template/Plugin/JavaScript.pm index 467c59111..01e5104fa 100644 --- a/SL/Template/Plugin/JavaScript.pm +++ b/SL/Template/Plugin/JavaScript.pm @@ -3,6 +3,8 @@ package SL::Template::Plugin::JavaScript; use base qw( Template::Plugin ); use Template::Plugin; +use strict; + sub new { my $class = shift; my $context = shift; diff --git a/SL/Template/Plugin/LxERP.pm b/SL/Template/Plugin/LxERP.pm index acb3f4d2e..66f32689b 100644 --- a/SL/Template/Plugin/LxERP.pm +++ b/SL/Template/Plugin/LxERP.pm @@ -7,6 +7,8 @@ use List::Util qw(min); use SL::AM; +use strict; + sub new { my $class = shift; my $context = shift; diff --git a/SL/Template/Plugin/MultiColumnIterator.pm b/SL/Template/Plugin/MultiColumnIterator.pm index f2b9f25f6..717eae328 100644 --- a/SL/Template/Plugin/MultiColumnIterator.pm +++ b/SL/Template/Plugin/MultiColumnIterator.pm @@ -1,6 +1,5 @@ package SL::Template::Plugin::MultiColumnIterator; -#use strict; use base 'Template::Plugin'; use Template::Constants; use Template::Exception; @@ -8,10 +7,12 @@ use Template::Iterator; use SL::LXDebug; use Data::Dumper; +use strict; + our $AUTOLOAD; sub new { - $main::lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); my $class = shift; my $context = shift; my $data = shift || [ ]; @@ -36,7 +37,7 @@ sub new { $data = [ $data ] ; } - $main::lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); bless { _DATA => $data, @@ -47,7 +48,7 @@ sub new { sub get_first { - $main::lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); my $self = shift; my $data = $self->{ _DATA }; my $dim = $self->{ _DIM }; @@ -55,7 +56,7 @@ sub get_first { $self->{ _DATASET } = $self->{ _DATA }; my $size = int ((scalar @$data - 1) / $dim) + 1; my $index = 0; - + return (undef, Template::Constants::STATUS_DONE) unless $size; # initialise various counters, flags, etc. @@ -63,12 +64,12 @@ sub get_first { @$self{ qw( PREV ) } = ( undef ); $$self{ qw( NEXT ) } = [ @{ $self->{ _DATASET } }[ map { $index + 1 + $_ * $size } 0 .. ($dim - 1) ] ]; - $main::lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); return [ @{ $self->{ _DATASET } }[ map { $index + $_ * $size } 0 .. ($dim - 1) ] ]; } sub get_next { - $main::lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); my $self = shift; my ($max, $index) = @$self{ qw( MAX INDEX ) }; my $data = $self->{ _DATASET }; @@ -89,11 +90,11 @@ sub get_next { @$self{ qw( INDEX COUNT FIRST LAST ) } = ( $index, $index + 1, 0, $index == $max ? 1 : 0 ); $$self{ qw( PREV ) } = [ @{ $self->{ _DATASET } }[ map { $index - 1 + $_ * $size } 0 .. ($dim - 1) ] ]; $$self{ qw( NEXT ) } = [ @{ $self->{ _DATASET } }[ map { $index + 1 + $_ * $size } 0 .. ($dim - 1) ] ]; - $main::lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); return [ @{ $self->{ _DATASET } }[ map { $index + $_ * $size } 0 .. ($dim - 1) ] ]; } else { - $main::lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); return (undef, Template::Constants::STATUS_DONE); ## RETURN ## } } @@ -131,9 +132,9 @@ sub AUTOLOAD { } sub dump { - $main::lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); my $self = shift; - $main::lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); return join('', "
",
          "  Data: ", Dumper($self->{ _DATA  }), "\n",
@@ -149,50 +150,50 @@ sub dump {
 }
 
 sub index {
-  $main::lxdebug->enter_sub(); 
+  $main::lxdebug->enter_sub();
   my ($self) = @_;
-  $main::lxdebug->leave_sub(); 
+  $main::lxdebug->leave_sub();
   return $self->{ INDEX };
 }
 
 sub number {
-  $main::lxdebug->enter_sub(); 
+  $main::lxdebug->enter_sub();
   my ($self) = @_;
-  $main::lxdebug->leave_sub(); 
+  $main::lxdebug->leave_sub();
   return $self->{ NUMBER };
 }
 
 sub count {
-  $main::lxdebug->enter_sub(); 
+  $main::lxdebug->enter_sub();
   my ($self) = @_;
-  $main::lxdebug->leave_sub(); 
+  $main::lxdebug->leave_sub();
   return $self->{ COUNT };
 }
 sub max {
-  $main::lxdebug->enter_sub(); 
+  $main::lxdebug->enter_sub();
   my ($self) = @_;
-  $main::lxdebug->leave_sub(); 
+  $main::lxdebug->leave_sub();
   return $self->{ MAX };
 }
 
 sub size {
-  $main::lxdebug->enter_sub(); 
+  $main::lxdebug->enter_sub();
   my ($self) = @_;
-  $main::lxdebug->leave_sub(); 
+  $main::lxdebug->leave_sub();
   return $self->{ SIZE };
 }
 
 sub first {
-  $main::lxdebug->enter_sub(); 
+  $main::lxdebug->enter_sub();
   my ($self) = @_;
-  $main::lxdebug->leave_sub(); 
+  $main::lxdebug->leave_sub();
   return $self->{ FIRST };
 }
 
 sub last {
-  $main::lxdebug->enter_sub(); 
+  $main::lxdebug->enter_sub();
   my ($self) = @_;
-  $main::lxdebug->leave_sub(); 
+  $main::lxdebug->leave_sub();
   return $self->{ LAST};
 }
 
diff --git a/SL/WH.pm b/SL/WH.pm
index 7ef012d91..1dab107a2 100644
--- a/SL/WH.pm
+++ b/SL/WH.pm
@@ -37,8 +37,10 @@ package WH;
 use SL::AM;
 use SL::DBUtils;
 use SL::Form;
+
 use warnings;
-#use strict;
+use strict;
+
 sub transfer {
   $main::lxdebug->enter_sub();
 
@@ -242,7 +244,7 @@ sub get_warehouse_journal {
   my $dbh = $form->get_standard_dbh($myconfig);
 
   # filters
-  my (@filter_ary, @filter_vars, $joins);
+  my (@filter_ary, @filter_vars, $joins, %select_tokens, %select);
 
   if ($filter{warehouse_id} ne '') {
     push @filter_ary, "w1.id = ? OR w2.id = ?";
@@ -448,7 +450,7 @@ SQL
   }
 
   my @contents = ();
-  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
     map { /^r_/; $ref->{"$'"} = $ref->{$_} } keys %$ref;
     my $qty = $ref->{"qty"} * 1;
 
@@ -628,7 +630,7 @@ sub get_warehouse_report {
 
   my (%non_empty_bins, @all_fields, @contents);
 
-  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
     $ref->{qty} *= 1;
     my $qty      = $ref->{qty};
 
-- 
2.20.1