From 76c486e3bf157e844b0cf11828d55dae2cb7e439 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 20 Oct 2009 14:14:56 +0200 Subject: [PATCH] Und wieder ein Schwung strict. --- SL/ARAP.pm | 2 + SL/Auth.pm | 8 +- SL/BP.pm | 16 +-- SL/Common.pm | 4 +- SL/DBUpgrade2.pm | 6 +- SL/GL.pm | 25 +++-- SL/IR.pm | 37 ++++--- SL/IS.pm | 4 +- SL/Inifile.pm | 2 + SL/LICENSES.pm | 16 +-- SL/Locale.pm | 5 + SL/MoreCommon.pm | 8 +- SL/Projects.pm | 4 +- SL/RC.pm | 2 + SL/RecordLinks.pm | 2 + SL/ReportGenerator.pm | 22 ++-- SL/TODO.pm | 2 + SL/USTVA.pm | 102 ++++++++++-------- SL/User.pm | 1 + SL/Watchdog.pm | 4 +- sql/Pg-upgrade2/USTVA_abstraction.pl | 5 + sql/Pg-upgrade2/USTVA_at.pl | 43 ++++---- sql/Pg-upgrade2/cp_greeting_migration.pl | 22 ++-- .../globalprojectnumber_ap_ar_oe.pl | 5 + sql/Pg-upgrade2/warehouse.pl | 19 ++-- 25 files changed, 224 insertions(+), 142 deletions(-) diff --git a/SL/ARAP.pm b/SL/ARAP.pm index 299c32f16..6b75114fb 100644 --- a/SL/ARAP.pm +++ b/SL/ARAP.pm @@ -6,6 +6,8 @@ use SL::DBUtils; use SL::MoreCommon; use Data::Dumper; +use strict; + sub close_orders_if_billed { $main::lxdebug->enter_sub(); diff --git a/SL/Auth.pm b/SL/Auth.pm index 0c8e3b340..af19e71d5 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -19,6 +19,8 @@ use SL::Auth::LDAP; use SL::User; use SL::DBUtils; +use strict; + sub new { $main::lxdebug->enter_sub(); @@ -140,7 +142,7 @@ sub dbconnect { $dsn .= ';port=' . $cfg->{port}; } - $main::lxdebug->message(LXDebug::DEBUG1, "Auth::dbconnect DSN: $dsn"); + $main::lxdebug->message(LXDebug->DEBUG1, "Auth::dbconnect DSN: $dsn"); $self->{dbh} = DBI->connect($dsn, $cfg->{user}, $cfg->{password}, { 'AutoCommit' => 0 }); @@ -215,7 +217,7 @@ sub create_database { $dsn .= ';port=' . $cfg->{port}; } - $main::lxdebug->message(LXDebug::DEBUG1, "Auth::create_database DSN: $dsn"); + $main::lxdebug->message(LXDebug->DEBUG1(), "Auth::create_database DSN: $dsn"); my $dbh = DBI->connect($dsn, $params{superuser}, $params{superuser_password}); @@ -230,7 +232,7 @@ sub create_database { my $query = qq|CREATE DATABASE "$cfg->{db}" OWNER "$cfg->{user}" TEMPLATE "$params{template}" ENCODING '$encoding'|; - $main::lxdebug->message(LXDebug::DEBUG1, "Auth::create_database query: $query"); + $main::lxdebug->message(LXDebug->DEBUG1(), "Auth::create_database query: $query"); $dbh->do($query); diff --git a/SL/BP.pm b/SL/BP.pm index 9365d2307..b981f1842 100644 --- a/SL/BP.pm +++ b/SL/BP.pm @@ -36,6 +36,8 @@ package BP; use SL::DBUtils; +use strict; + sub get_vc { $main::lxdebug->enter_sub(); @@ -56,7 +58,7 @@ sub get_vc { my $vc = $form->{vc} eq "customer" ? "customer" : "vendor"; my $arap_type = defined($arap{$form->{type}}) ? $arap{$form->{type}} : 'ar'; - $query = + my $query = qq|SELECT count(*) | . qq|FROM (SELECT DISTINCT ON (vc.id) vc.id FROM $vc vc, $arap_type a, status s | . qq| WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | . @@ -72,11 +74,11 @@ sub get_vc { qq|WHERE a.${vc}_id = vc.id AND s.trans_id = a.id AND s.formname = ? | . qq| AND s.spoolfile IS NOT NULL|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute($form->{type}) || $form->dberror($query . " ($form->{type})"); $form->{"all_${vc}"} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{"all_${vc}"} }, $ref; } $sth->finish; @@ -103,7 +105,7 @@ sub payment_accounts { $sth->execute($form->{type}) || $form->dberror($query . " ($form->{type})"); $form->{accounts} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{accounts} }, $ref; } @@ -192,7 +194,7 @@ sub get_spoolfiles { } } - my @a = (transdate, $invnumber, name); + my @a = ("transdate", $invnumber, "name"); my $sortorder = join ', ', $form->sort_columns(@a); if (grep({ $_ eq $form->{sort} } @@ -207,7 +209,7 @@ sub get_spoolfiles { $form->dberror($query . " (" . join(", ", @values) . ")"); $form->{SPOOL} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { push @{ $form->{SPOOL} }, $ref; } @@ -279,7 +281,7 @@ sub print_spool { open(OUT, $output) or $form->error("$output : $!"); $form->{"spoolfile_$i"} =~ s|.*/||; - $spoolfile = qq|$spool/$form->{"spoolfile_$i"}|; + my $spoolfile = qq|$spool/$form->{"spoolfile_$i"}|; # send file to printer open(IN, $spoolfile) or $form->error("$spoolfile : $!"); diff --git a/SL/Common.pm b/SL/Common.pm index 5cc79c472..7462d8b93 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -13,7 +13,9 @@ use Data::Dumper; use SL::DBUtils; -use vars qw(@db_encodings %db_encoding_to_charset); +use vars qw(@db_encodings %db_encoding_to_charset %charset_to_db_encoding); + +use strict; @db_encodings = ( { "label" => "ASCII", "dbencoding" => "SQL_ASCII", "charset" => "ASCII" }, diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index 6d8129c7e..ae07d1c08 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -3,9 +3,11 @@ package SL::DBUpgrade2; use SL::Common; require Exporter; -@ISA = qw(Exporter); +our @ISA = qw(Exporter); -@EXPORT = qw(parse_dbupdate_controls sort_dbupdate_controls); +our @EXPORT = qw(parse_dbupdate_controls sort_dbupdate_controls); + +use strict; sub parse_dbupdate_controls { $main::lxdebug->enter_sub(); diff --git a/SL/GL.pm b/SL/GL.pm index db9d9aec9..320be1e7e 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -41,6 +41,8 @@ package GL; use Data::Dumper; use SL::DBUtils; +use strict; + sub delete_transaction { my ($self, $myconfig, $form) = @_; $main::lxdebug->enter_sub(); @@ -86,7 +88,7 @@ sub post_transaction { $form->{taxincluded} = 0; } - my ($query, $sth); + my ($query, $sth, @values, $taxkey, $rate, $posted); if ($form->{id}) { @@ -196,7 +198,7 @@ sub all_transactions { # connect to database my $dbh = $form->dbconnect($myconfig); - my ($query, $sth, $source, $null); + my ($query, $sth, $source, $null, $space); my ($glwhere, $arwhere, $apwhere) = ("1 = 1", "1 = 1", "1 = 1"); my (@glvalues, @arvalues, @apvalues); @@ -294,7 +296,7 @@ sub all_transactions { push(@apvalues, $project_id, $project_id); } - my ($project_columns, %project_join); + my ($project_columns, $project_join); if ($form->{"l_projectnumbers"}) { $project_columns = qq|, ac.project_id, pr.projectnumber|; $project_join = qq|LEFT JOIN project pr ON (ac.project_id = pr.id)|; @@ -315,7 +317,7 @@ sub all_transactions { } } - my $false = ($myconfig->{dbdriver} eq 'Pg') ? FALSE: q|'0'|; + my $false = ($myconfig->{dbdriver} eq 'Pg') ? "FALSE" : q|'0'|; my %sort_columns = ( 'id' => [ qw(id) ], @@ -342,7 +344,7 @@ sub all_transactions { map { $columns_for_sorting{$_} .= sprintf(', lower(%s) AS lower_%s', $lowered_columns{$column}->{$_}, $column) } qw(gl arap); } - my $query = + $query = qq|SELECT ac.acc_trans_id, g.id, 'gl' AS type, $false AS invoice, g.reference, ac.taxkey, c.link, g.description, ac.transdate, ac.source, ac.trans_id, @@ -388,17 +390,18 @@ sub all_transactions { my @values = (@glvalues, @arvalues, @apvalues); # Show all $query in Debuglevel LXDebug::QUERY - $callingdetails = (caller (0))[3]; - dump_query(LXDebug::QUERY, "$callingdetails", $query, @values); + my $callingdetails = (caller (0))[3]; + dump_query(LXDebug->QUERY(), "$callingdetails", $query, @values); $sth = prepare_execute_query($form, $dbh, $query, @values); my $trans_id = ""; my $trans_id2 = ""; + my $balance; my ($i, $j, $k, $l, $ref, $ref2); $form->{GL} = []; - while (my $ref0 = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref0 = $sth->fetchrow_hashref("NAME_lc")) { $trans_id = $ref0->{id}; @@ -489,7 +492,7 @@ sub all_transactions { } else { # following lines of a booking, line increasing $ref2 = $ref0; - $trans_old = $trans_id2; +# $trans_old = $trans_id2; # doesn't seem to be used anymore $trans_id2 = $ref2->{id}; $balance = @@ -596,7 +599,7 @@ sub transaction { if ($form->{id}) { $query = qq|SELECT g.reference, g.description, g.notes, g.transdate, g.storno, g.storno_id, - d.description AS department, e.name AS employee, g.taxincluded, g.gldate, + d.description AS department, e.name AS employee, g.taxincluded, g.gldate, g.ob_transaction, g.cb_transaction FROM gl g LEFT JOIN department d ON (d.id = g.department_id) @@ -701,7 +704,7 @@ sub storno { # now copy acc_trans entries $query = qq|SELECT * FROM acc_trans WHERE trans_id = ?|; - my $rowref = selectall_hashref_query($form, $dbh, $query, $id); + my $rowref = selectall_hashref_query($form, $dbh, $query, $id); for my $row (@$rowref) { delete @$row{qw(itime mtime)}; diff --git a/SL/IR.pm b/SL/IR.pm index 78970e3d2..ab515b21a 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -44,6 +44,8 @@ use SL::GenericTranslations; use SL::MoreCommon; use List::Util qw(min); +use strict; + sub post_invoice { $main::lxdebug->enter_sub(); @@ -61,6 +63,7 @@ sub post_invoice { my ($amount, $linetotal, $lastinventoryaccno, $lastexpenseaccno); my ($netamount, $invoicediff, $expensediff) = (0, 0, 0); my $exchangerate = 0; + my ($basefactor, $baseqty, @taxaccounts, $totaltax); my $all_units = AM->retrieve_units($myconfig, $form); @@ -133,13 +136,13 @@ sub post_invoice { $price_factor = $price_factors{ $form->{"price_factor_id_$i"} } || 1; ##################################################################### # das ist aus IS.pm kopiert. schlimm. jb 7.10.2009 - # ich würde mir wünschen, dass diese vier stellen zusammengefasst werden + # ich würde mir wünschen, dass diese vier stellen zusammengefasst werden # ... vier stellen = (einkauf + verkauf) * (maske + backend) # ansonsten stolpert man immer wieder viermal statt einmal heftig # und auch das undo discount formatting ist nicht besonders wartungsfreundlich - + # keep entered selling price - my $fxsellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); + $fxsellprice = $form->parse_amount($myconfig, $form->{"sellprice_$i"}); # keine ahnung wofür das in IS.pm gemacht wird: # my ($dec) = ($fxsellprice =~ /\.(\d+)/); @@ -150,7 +153,7 @@ sub post_invoice { $form->{"discount_$i"} = $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100; # deduct discount $form->{"sellprice_$i"} = $fxsellprice * (1 - $form->{"discount_$i"}); - + ###################################################################### if ($form->{"inventory_accno_$i"}) { @@ -218,9 +221,9 @@ sub post_invoice { ORDER BY transdate|; $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{"id_$i"})); - my $totalqty = $base_qty; + my $totalqty = $baseqty; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { my $qty = min $totalqty, ($ref->{base_qty} + $ref->{allocated}); $linetotal = $form->round_amount(($form->{"sellprice_$i"} * $qty) / $basefactor, 2); @@ -631,7 +634,7 @@ sub reverse_invoice { my $netamount = 0; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { $netamount += $form->round_amount($ref->{sellprice} * $ref->{qty} * -1, 2); next unless $ref->{inventory_accno_id}; @@ -649,7 +652,7 @@ sub reverse_invoice { ORDER BY transdate DESC|; my $sth2 = prepare_execute_query($form, $dbh, $query, $ref->{parts_id}); - while (my $pthref = $sth2->fetchrow_hashref(NAME_lc)) { + while (my $pthref = $sth2->fetchrow_hashref("NAME_lc")) { my $qty = $ref->{allocated}; if (($ref->{allocated} + $pthref->{allocated}) > 0) { $qty = $pthref->{allocated} * -1; @@ -813,7 +816,7 @@ sub retrieve_invoice { ORDER BY i.id|; $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{id})); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { # Retrieve custom variables. my $cvars = CVar->get_custom_variables(dbh => $dbh, module => 'IC', @@ -849,7 +852,7 @@ sub retrieve_invoice { $ref->{taxaccounts} = ""; my $i = 0; - while ($ptr = $stw->fetchrow_hashref(NAME_lc)) { + while (my $ptr = $stw->fetchrow_hashref("NAME_lc")) { if (($ptr->{accno} eq "") && ($ptr->{rate} == 0)) { $i++; $ptr->{accno} = $i; @@ -923,7 +926,7 @@ sub get_vendor { LEFT JOIN business b ON (b.id = v.business_id) LEFT JOIN payment_terms pt ON (v.payment_id = pt.id) WHERE 1=1 $where|; - $ref = selectfirst_hashref_query($form, $dbh, $query, @values); + my $ref = selectfirst_hashref_query($form, $dbh, $query, @values); map { $params->{$_} = $ref->{$_} } keys %$ref; $params->{creditremaining} = $params->{creditlimit}; @@ -972,14 +975,14 @@ sub get_vendor { for $ref (@$refs) { if ($ref->{category} eq 'E') { $i++; - + my ($tax_id, $rate); if ($params->{initial_transdate}) { my $tax_query = qq|SELECT tk.tax_id, t.rate FROM taxkeys tk LEFT JOIN tax t ON (tk.tax_id = t.id) WHERE (tk.chart_id = ?) AND (startdate <= ?) ORDER BY tk.startdate DESC LIMIT 1|; - my ($tax_id, $rate) = selectrow_query($form, $dbh, $tax_query, $ref->{id}, $params->{initial_transdate}); + ($tax_id, $rate) = selectrow_query($form, $dbh, $tax_query, $ref->{id}, $params->{initial_transdate}); $params->{"taxchart_$i"} = "${tax_id}--${rate}"; } @@ -1082,7 +1085,7 @@ sub retrieve_item { my $sth = prepare_execute_query($form, $dbh, $query, @values); $form->{item_list} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { # In der Buchungsgruppe ist immer ein Bestandskonto verknuepft, auch wenn # es sich um eine Dienstleistung handelt. Bei Dienstleistungen muss das @@ -1093,7 +1096,7 @@ sub retrieve_item { delete($ref->{inventory_accno_id}); # get tax rates and description - $accno_id = ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno}; + my $accno_id = ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno}; $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber FROM tax t @@ -1113,7 +1116,7 @@ sub retrieve_item { $ref->{taxaccounts} = ""; my $i = 0; - while ($ptr = $stw->fetchrow_hashref(NAME_lc)) { + while (my $ptr = $stw->fetchrow_hashref("NAME_lc")) { # if ($customertax{$ref->{accno}}) { if (($ptr->{accno} eq "") && ($ptr->{rate} == 0)) { @@ -1227,7 +1230,7 @@ sub item_links { ORDER BY accno|; my $sth = prepare_execute_query($query, $dbh, $query); - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { foreach my $key (split(/:/, $ref->{link})) { if ($key =~ /IC/) { push @{ $form->{IC_links}{$key} }, diff --git a/SL/IS.pm b/SL/IS.pm index 9b978217e..29e64c862 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -34,8 +34,6 @@ package IS; -#use strict; - use List::Util qw(max); use SL::AM; @@ -49,6 +47,8 @@ use SL::MoreCommon; use SL::IC; use Data::Dumper; +use strict; + sub invoice_details { $main::lxdebug->enter_sub(); diff --git a/SL/Inifile.pm b/SL/Inifile.pm index 846459d5f..6895d6030 100644 --- a/SL/Inifile.pm +++ b/SL/Inifile.pm @@ -37,6 +37,8 @@ package Inifile; use IO::File; +use strict; + sub new { $main::lxdebug->enter_sub(2); diff --git a/SL/LICENSES.pm b/SL/LICENSES.pm index 8f9c02592..ca9c679f9 100644 --- a/SL/LICENSES.pm +++ b/SL/LICENSES.pm @@ -35,16 +35,18 @@ package LICENSES; use SL::Form; +use strict; + sub save_license { $main::lxdebug->enter_sub(); my ($self, $myconfig, $form) = @_; - $dbh = $form->dbconnect($myconfig); + my $dbh = $form->dbconnect($myconfig); - $query = + my $query = qq| INSERT INTO license (licensenumber) VALUES ('$form->{licensenumber}')|; - $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $sth->finish(); @@ -52,7 +54,7 @@ sub save_license { qq|SELECT l.id FROM license l WHERE l.licensenumber = '$form->{licensenumber}'|; $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - ($license_id) = $sth->fetchrow_array; + my ($license_id) = $sth->fetchrow_array; $sth->finish(); # save license @@ -88,7 +90,7 @@ sub get_customers { my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{"all_customers"} = []; - while ($ref = $sth->fetchrow_hashref(NAME_lc)) { + while ($ref = $sth->fetchrow_hashref("NAME_lc")) { push(@{ $form->{"all_customers"} }, $ref); } $sth->finish(); @@ -174,7 +176,7 @@ sub search { $sth = $dbh->prepare($query); $sth->execute() || $form->dberror($query); $form->{"licenses"} = []; - while ($ref = $sth->fetchrow_hashref(NAME_lc)) { + while ($ref = $sth->fetchrow_hashref("NAME_lc")) { push(@{ $form->{"licenses"} }, $ref); } @@ -207,7 +209,7 @@ sub get_license { . $form->{"id"}; $sth = $dbh->prepare($query); $sth->execute() || $form->dberror($query); - $form->{"license"} = $sth->fetchrow_hashref(NAME_lc); + $form->{"license"} = $sth->fetchrow_hashref("NAME_lc"); $sth->finish(); $dbh->disconnect(); $main::lxdebug->leave_sub(); diff --git a/SL/Locale.pm b/SL/Locale.pm index e3ff23692..b869587ca 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -42,6 +42,8 @@ use SL::LXDebug; use SL::Common; use SL::Inifile; +use strict; + sub new { $main::lxdebug->enter_sub(); @@ -229,6 +231,8 @@ sub date { my $longdate = ""; my $longmonth = ($longformat) ? 'LONG_MONTH' : 'SHORT_MONTH'; + my ($spc, $yy, $mm, $dd); + if ($date) { # get separator @@ -302,6 +306,7 @@ sub parse_date { $main::lxdebug->enter_sub(); my ($self, $myconfig, $date, $longformat) = @_; + my ($spc, $yy, $mm, $dd); unless ($date) { $main::lxdebug->leave_sub(); diff --git a/SL/MoreCommon.pm b/SL/MoreCommon.pm index 6c292bab8..48eef0cf9 100644 --- a/SL/MoreCommon.pm +++ b/SL/MoreCommon.pm @@ -1,15 +1,17 @@ package SL::MoreCommon; require Exporter; -@ISA = qw(Exporter); +our @ISA = qw(Exporter); -@EXPORT = qw(save_form restore_form compare_numbers any cross); -@EXPORT_OK = qw(ary_union ary_intersect ary_diff listify); +our @EXPORT = qw(save_form restore_form compare_numbers any cross); +our @EXPORT_OK = qw(ary_union ary_intersect ary_diff listify); use YAML; use SL::AM; +use strict; + sub save_form { $main::lxdebug->enter_sub(); diff --git a/SL/Projects.pm b/SL/Projects.pm index afbc5a3d7..f5f48e7f7 100644 --- a/SL/Projects.pm +++ b/SL/Projects.pm @@ -39,6 +39,8 @@ use Data::Dumper; use SL::DBUtils; use SL::CVar; +use strict; + my %project_id_column_prefixes = ("ar" => "global", "ap" => "global", "oe" => "global", @@ -178,7 +180,7 @@ sub save_project { $params{active} = 1; } - $query = qq|UPDATE project SET projectnumber = ?, description = ?, active = ? + my $query = qq|UPDATE project SET projectnumber = ?, description = ?, active = ? WHERE id = ?|; @values = ($params{projectnumber}, $params{description}, $params{active} ? 't' : 'f', conv_i($params{id})); diff --git a/SL/RC.pm b/SL/RC.pm index aa0b49214..9493f0f6a 100644 --- a/SL/RC.pm +++ b/SL/RC.pm @@ -36,6 +36,8 @@ package RC; use SL::DBUtils; +use strict; + sub paymentaccounts { $main::lxdebug->enter_sub(); diff --git a/SL/RecordLinks.pm b/SL/RecordLinks.pm index fa5de38f7..09fd642c1 100644 --- a/SL/RecordLinks.pm +++ b/SL/RecordLinks.pm @@ -5,6 +5,8 @@ use SL::DBUtils; use Data::Dumper; use List::Util qw(reduce); +use strict; + sub create_links { $main::lxdebug->enter_sub(); diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index 2d959509d..6c61acbc0 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -12,6 +12,8 @@ use Text::Iconv; use SL::Form; +use strict; + # Cause locales.pl to parse these files: # parse_html_template('report_generator/html_report') @@ -789,7 +791,7 @@ SL::ReportGenerator.pm: the Lx-Office way of getting data in shape $report->add_data($row1, $row2, @more_rows); $report->generate_with_headers(); -This creates a report object, sets a few columns, adds some data and generates a standard report. +This creates a report object, sets a few columns, adds some data and generates a standard report. Sorting of columns will be alphabetic, and options will be set to their defaults. The report will be printed including table headers, html headers and http headers. @@ -802,8 +804,8 @@ Then there are some options made by the user, such as hidden columns. You add mo Then it lacks usability. You want it to be able to sort the data. You add code for that. Then there are too many results, you need pagination, you want to print or export that data..... and so on. -The ReportGenerator class was designed because this exact scenario happened about half a dozen times in Lx-Office. -It's purpose is to manage all those formating, culling, sorting, and templating. +The ReportGenerator class was designed because this exact scenario happened about half a dozen times in Lx-Office. +It's purpose is to manage all those formating, culling, sorting, and templating. Which makes it almost as complicated to use as doing the work for yourself. =head1 FUNCTIONS @@ -831,8 +833,8 @@ Note that this is only for displaying. The data has to be presented already sort =item add_data \%data -Adds data to the report. A given hash_ref is interpreted as a single line of data, every array_ref as a collection of lines. -Every line will be expected to be in a kay => value format. Note that the rows have to be already sorted. +Adds data to the report. A given hash_ref is interpreted as a single line of data, every array_ref as a collection of lines. +Every line will be expected to be in a kay => value format. Note that the rows have to be already sorted. ReportGenerator does only colum sorting on its own, and provides links to sorting and visual cue as to which column was sorted by. =item add_separator @@ -842,7 +844,7 @@ Adds a separator line to the report. =item add_control \%data Adds a control element to the data. Control elements are an experimental feature to add functionality to a report the regular data cannot. -Every control element needs to set IS_CONTROL_DATA, in order to be recongnized by the template. +Every control element needs to set IS_CONTROL_DATA, in order to be recongnized by the template. Currently the only control element is a colspan element, which can be used as a mini header further down the report. =item clear_data @@ -867,7 +869,7 @@ Returns the set attachment_basename option, or 'report' if nothing was set. See =item generate_with_headers -Parses the report, adds headers and prints it out. Headers depend on the option 'output_format', +Parses the report, adds headers and prints it out. Headers depend on the option 'output_format', for example 'HTML' will add proper table headers, html headers and http headers. See configuration for this option. =item get_visible_columns $format @@ -880,9 +882,9 @@ Escapes HTML characters in $value and substitutes newlines with '
'. Returns =item prepare_html_content $column,$name,@column_headers -Parses the data, and sets internal data needed for certain output format. Must be called once before the template is invoked. +Parses the data, and sets internal data needed for certain output format. Must be called once before the template is invoked. Should not be called extrenally, since all render and generate functions invoke it anyway. - + =item generate_html_content The html generation function. Is invoked by generate_with_headers. @@ -939,7 +941,7 @@ Paper size. Default is a4. Supported paper sizes are a3, a4, a5, letter and lega Landscape or portrait. Default is landscape. -=item font_name +=item font_name Default is Verdana. Supported font names are Courier, Georgia, Helvetica, Times and Verdana. This option only affects the rendering with PDF::API2. diff --git a/SL/TODO.pm b/SL/TODO.pm index af881b406..de99ad1dc 100644 --- a/SL/TODO.pm +++ b/SL/TODO.pm @@ -4,6 +4,8 @@ package TODO; use SL::DBUtils; +use strict; + sub get_user_config { $main::lxdebug->enter_sub(); diff --git a/SL/USTVA.pm b/SL/USTVA.pm index ed0166986..84cc17dc3 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -29,6 +29,8 @@ use List::Util qw(first); use SL::DBUtils; +use strict; + my @tax_office_information = ( { 'id' => 8, 'name' => 'Baden Württemberg', 'taxbird_nr' => '0', 'elster_format' => 'FF/BBB/UUUUP', }, { 'id' => 9, 'name' => 'Bayern', 'taxbird_nr' => '1', 'elster_format' => 'FFF/BBB/UUUUP', }, @@ -145,10 +147,14 @@ sub report_variables { sub create_steuernummer { $main::lxdebug->enter_sub(); - $part = $form->{part}; - $patterncount = $form->{patterncount}; - $delimiter = $form->{delimiter}; - $elster_pattern = $form->{elster_pattern}; + my $form = $main::form; + + our ($elster_FFFF); + + my $part = $form->{part}; + my $patterncount = $form->{patterncount}; + my $delimiter = $form->{delimiter}; + my $elster_pattern = $form->{elster_pattern}; # rebuild steuernummer and elstersteuernummer # es gibt eine gespeicherte steuernummer $form->{steuernummer} @@ -157,9 +163,9 @@ sub create_steuernummer { my $h = 0; my $i = 0; - $steuernummer_new = $part; - $elstersteuernummer_new = $elster_FFFF; - $elstersteuernummer_new .= '0'; + my $steuernummer_new = $part; + my $elstersteuernummer_new = $elster_FFFF; + $elstersteuernummer_new .= '0'; for ($h = 1; $h < $patterncount; $h++) { $steuernummer_new .= qq|$delimiter|; @@ -181,6 +187,7 @@ sub steuernummer_input { $main::lxdebug->enter_sub(); my ($self, $elsterland, $elsterFFFF, $steuernummer) = @_; + our ($elster_FFFF, $elster_land); my $steuernummer_input = ''; @@ -286,6 +293,7 @@ sub fa_auswahl { my $ffff = ''; my $checked = ''; $checked = 'checked' if ($elsterFFFF eq '' and $land eq ''); + my %elster_land_fa; my $fa_auswahl = qq|