]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Und wieder ein Schwung strict.
authorSven Schöling <s.schoeling@linet-services.de>
Tue, 20 Oct 2009 12:14:56 +0000 (14:14 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Tue, 20 Oct 2009 12:14:56 +0000 (14:14 +0200)
25 files changed:
SL/ARAP.pm
SL/Auth.pm
SL/BP.pm
SL/Common.pm
SL/DBUpgrade2.pm
SL/GL.pm
SL/IR.pm
SL/IS.pm
SL/Inifile.pm
SL/LICENSES.pm
SL/Locale.pm
SL/MoreCommon.pm
SL/Projects.pm
SL/RC.pm
SL/RecordLinks.pm
SL/ReportGenerator.pm
SL/TODO.pm
SL/USTVA.pm
SL/User.pm
SL/Watchdog.pm
sql/Pg-upgrade2/USTVA_abstraction.pl
sql/Pg-upgrade2/USTVA_at.pl
sql/Pg-upgrade2/cp_greeting_migration.pl
sql/Pg-upgrade2/globalprojectnumber_ap_ar_oe.pl
sql/Pg-upgrade2/warehouse.pl

index 299c32f16aa2af5c4a6dd9f0fb9836a045326fde..6b75114fb454aa93892c792bcc7301486770b722 100644 (file)
@@ -6,6 +6,8 @@ use SL::DBUtils;
 use SL::MoreCommon;
 use Data::Dumper;
 
+use strict;
+
 sub close_orders_if_billed {
   $main::lxdebug->enter_sub();
 
index 0c8e3b34017720a77ba037003500c2908492ba55..af19e71d562bc83fb7234e33f0b82a2e59cf8ad0 100644 (file)
@@ -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);
 
index 9365d23076ad92cffd015709e68cc2ff752d61d5..b981f1842a910a5855e22084f15750409974fc15 100644 (file)
--- 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 : $!");
index 5cc79c472465bd07ce66ea7e825cd3521dcddafa..7462d8b9324dba6df154acb63ee914d12e0d523a 100644 (file)
@@ -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" },
index 6d8129c7e369a849b6c812b2ac325b00032943e3..ae07d1c084e7ff6868accad13779a9aa084dabed 100644 (file)
@@ -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();
index db9d9aec9e98b31a67ec2bf975b2056f758b4b0c..320be1e7ec4a2dea79b1e970cbe679681cc26960 100644 (file)
--- 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)};
index 78970e3d29c5fb3acfdfeddf820ae1c11a19bd20..ab515b21a2832e25edb419990a4031760dc50fbd 100644 (file)
--- 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} },
index 9b978217e831d9fc1b81031a9453090a15ffc927..29e64c86290f19193fd9c153bf04f3289c1e9ada 100644 (file)
--- 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();
 
index 846459d5f5a372a8aecb112a0baa57cecb924664..6895d6030b5c2b15502be359505d7aca93ea9036 100644 (file)
@@ -37,6 +37,8 @@ package Inifile;
 
 use IO::File;
 
+use strict;
+
 sub new {
   $main::lxdebug->enter_sub(2);
 
index 8f9c0259206c70ff332b2df2e7af6e5dd1da92f1..ca9c679f984fb1b420e51f63cae2608c1168f4ed 100644 (file)
@@ -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();
index e3ff236927c44d2f915b9ac49af31b1ff736b453..b869587ca983c22d00f4112bd63fa28524efc48e 100644 (file)
@@ -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();
index 6c292bab8446165cd0e8c3693c3d334e4f435e9a..48eef0cf93eca60a4a6b62f28c2aa93c88b25394 100644 (file)
@@ -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();
 
index afbc5a3d761876491629649041b2598805b7dd0d..f5f48e7f7d383420e49a589af7f641538941d993 100644 (file)
@@ -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}));
index aa0b49214576261fe1691f43c5276237ce6ff1b0..9493f0f6a81f34aa413e8e68297a9b61c07ec601 100644 (file)
--- 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();
 
index fa5de38f79c6eb7b328292e323a99c49514abdb0..09fd642c1b55e82ca0a278ad51ceca1643dd8974 100644 (file)
@@ -5,6 +5,8 @@ use SL::DBUtils;
 use Data::Dumper;
 use List::Util qw(reduce);
 
+use strict;
+
 sub create_links {
   $main::lxdebug->enter_sub();
 
index 2d959509d05c47f9e18b66497c8261f196e52668..6c61acbc0a992acf4564aac7dfc0f2eb25d10160 100644 (file)
@@ -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 '<br>'. 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.
 
index af881b40647d612f65d0ef670a9bb31079725b0a..de99ad1dc2f0df61e0ea524dc224ec17f9aa5430 100644 (file)
@@ -4,6 +4,8 @@ package TODO;
 
 use SL::DBUtils;
 
+use strict;
+
 sub get_user_config {
   $main::lxdebug->enter_sub();
 
index ed0166986732d0a565091292328f9755ed3d9f00..84cc17dc39efec49b70e7bb5f66f14026f49a0b6 100644 (file)
@@ -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|
         <script language="Javascript">
@@ -297,14 +305,14 @@ sub fa_auswahl {
                 elsterFAAuswahl.options.length = 0; // dropdown aufräumen
                 |;
 
-  foreach $elster_land (sort keys %$elster_init) {
+  foreach my $elster_land (sort keys %$elster_init) {
     $fa_auswahl .= qq|
                if (elsterBLAuswahl.options[elsterBLAuswahl.selectedIndex].
                value == "$elster_land")
                {
                |;
     my $j              = 0;
-    my %elster_land_fa = ();
+    %elster_land_fa = ();
     $FFFF = '';
     for $FFFF (keys %{ $elster_init->{$elster_land} }) {
       $elster_land_fa{$FFFF} = $elster_init->{$elster_land}->{$FFFF}->[0];
@@ -333,7 +341,7 @@ sub fa_auswahl {
   if ($land eq '') {
     $fa_auswahl .= qq|<option value="Auswahl" $checked>| . $main::locale->text('Select federal state...') . qq|</option>\n|;
   }
-  foreach $elster_land (sort keys %$elster_init) {
+  foreach my $elster_land (sort keys %$elster_init) {
     $fa_auswahl .= qq|
                   <option value="$elster_land"|;
     if ($elster_land eq $land and $checked eq '') {
@@ -414,6 +422,7 @@ sub info {
   $main::lxdebug->leave_sub();
 }
 
+# 20.10.2009 sschoeling: this sub seems to be orphaned.
 sub stichtag {
   $main::lxdebug->enter_sub();
 
@@ -428,41 +437,43 @@ sub stichtag {
 
   #$today =today * 1;
   $today =~ /(\d\d\d\d)(\d\d)(\d\d)/;
-  $year     = $1;
-  $month    = $2;
-  $day      = $3;
-  $yy       = $year;
-  $mm       = $month;
-  $yymmdd   = "$year$month$day" * 1;
-  $mmdd     = "$month$day" * 1;
-  $stichtag = '';
+  my $year     = $1;
+  my $month    = $2;
+  my $day      = $3;
+  my $yy       = $year;
+  my $mm       = $month;
+  my $yymmdd   = "$year$month$day" * 1;
+  my $mmdd     = "$month$day" * 1;
+  my $stichtag = '';
 
   #$tage_bis = '1234';
   #$ical = '...vcal format';
 
   #if ($FA_voranmeld eq 'month'){
 
-  %liste = ("0110" => 'December',
-            "0210" => 'January',
-            "0310" => 'February',
-            "0410" => 'March',
-            "0510" => 'April',
-            "0610" => 'May',
-            "0710" => 'June',
-            "0810" => 'July',
-            "0910" => 'August',
-            "1010" => 'September',
-            "1110" => 'October',
-            "1210" => 'November');
+  my %liste = (
+    "0110" => 'December',
+    "0210" => 'January',
+    "0310" => 'February',
+    "0410" => 'March',
+    "0510" => 'April',
+    "0610" => 'May',
+    "0710" => 'June',
+    "0810" => 'July',
+    "0910" => 'August',
+    "1010" => 'September',
+    "1110" => 'October',
+    "1210" => 'November',
+  );
 
   #$mm += $dauerfrist
   #$month *= 1;
   $month += 1 if ($day > 10);
   $month    = sprintf("%02d", $month);
   $stichtag = $year . $month . "10";
-  $ust_va   = $month . "10";
+  my $ust_va   = $month . "10";
 
-  foreach $date (%liste) {
+  foreach my $date (%liste) {
     $ust_va = $liste{$date} if ($date eq $stichtag);
   }
 
@@ -486,6 +497,10 @@ sub stichtag {
   #$stichtag =~ /([\d]\d)(\d\d)$/
   #$stichtag = "$1.$2.$yy"
   #$stichtag=$1;
+  our $description; # most probably not existant.
+  our $tage_bis;    # most probably not existant.
+  our $ical;        # most probably not existant.
+
   $main::lxdebug->leave_sub();
   return ($stichtag, $description, $tage_bis, $ical);
 }
@@ -557,6 +572,7 @@ sub query_finanzamt {
   $sth->execute || $form->dberror($query);
   my $array_ref = $sth->fetchall_arrayref();
   my $land      = '';
+  my %finanzamt;
   foreach my $row (@$array_ref) {
     my $FA_finanzamt = $row;
     my $tax_office   = first { $_->{id} == $FA_finanzamt->[0] } @{ $self->{tax_office_information} };
@@ -679,10 +695,10 @@ sub ustva {
 
   $form->{decimalplaces} *= 1;
 
-  foreach $item (@category_cent) {
+  foreach my $item (@category_cent) {
     $form->{"$item"} = 0;
   }
-  foreach $item (@category_euro) {
+  foreach my $item (@category_euro) {
     $form->{"$item"} = 0;
   }
   my $coa_name = coa_get($dbh);
@@ -691,7 +707,7 @@ sub ustva {
   # Controlvariable for templates
   $form->{"$coa_name"} = '1';
 
-  $main::lxdebug->message(LXDebug::DEBUG2, "COA: '$form->{coa}',  \$form->{$coa_name} = 1");
+  $main::lxdebug->message(LXDebug->DEBUG2(), "COA: '$form->{coa}',  \$form->{$coa_name} = 1");
 
   &get_accounts_ustva($dbh, $last_period, $form->{fromdate}, $form->{todate},
                       $form, $category);
@@ -762,6 +778,7 @@ sub ustva {
 sub coa_get {
 
   my ($dbh) = @_;
+  my $form  = $main::form;
 
   my $query= qq|SELECT coa FROM defaults|;
 
@@ -769,7 +786,7 @@ sub coa_get {
 
   $sth->execute || $form->dberror($query);
 
-  ($ref) = $sth->fetchrow_array;
+  my ($ref) = $sth->fetchrow_array;
 
   return $ref;
 
@@ -779,6 +796,7 @@ sub get_accounts_ustva {
   $main::lxdebug->enter_sub();
 
   my ($dbh, $last_period, $fromdate, $todate, $form, $category) = @_;
+  our ($dpt_join);
 
   my $query;
   my $where    = "";
@@ -987,14 +1005,14 @@ sub get_accounts_ustva {
   my $ref;
 
   # Show all $query in Debuglevel LXDebug::QUERY
-  $callingdetails = (caller (0))[3];
-  $main::lxdebug->message(LXDebug::QUERY, "$callingdetails \$query=\n $query");
+  my $callingdetails = (caller (0))[3];
+  $main::lxdebug->message(LXDebug->QUERY(), "$callingdetails \$query=\n $query");
 
   my $sth = $dbh->prepare($query);
 
   $sth->execute || $form->dberror($query);
 
-  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
+  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
     # Bug 365 solved?!
     $ref->{amount} *= -1;
     $form->{ $ref->{$category} } += $ref->{amount};
@@ -1011,14 +1029,14 @@ sub get_config {
 
   my ($self, $userspath, $filename) = @_;
 
-  $form->error("Missing Parameter: @_") if !$userspath || !$filename;
-
   my $form = $main::form;
 
+  $form->error("Missing Parameter: @_") if !$userspath || !$filename;
+
   $filename = "$form->{login}_$filename";
   $filename =~ s|.*/||;
   $filename = "$userspath/$filename";
-  open my $FACONF, "<", $filename or sub {# Annon Sub
+  open my $FACONF, "<", $filename or do {# Annon Sub
     # catch open error
     # create file if file does not exist
     open my $FANEW, ">", $filename  or $form->error("CREATE: $filename : $!");
index 2115ddc7671796851fd55f866e00da7a9c647837..0fbd66a398325eef5d947d48417a30c10759cc9b 100644 (file)
@@ -445,6 +445,7 @@ sub process_perl_script {
 
   $dbh->begin_work();
 
+  # setup dbup_ export vars
   my %dbup_myconfig = ();
   map({ $dbup_myconfig{$_} = $form->{$_}; }
       qw(dbname dbuser dbpasswd dbhost dbport dbconnect));
index 180d364c741361ff930f44d3ff1e6e315a16218b..9c1a3b5fc1c760ea733c7481580c767d915c657e 100644 (file)
@@ -4,7 +4,9 @@ use Data::Dumper;
 
 require Tie::Hash;
 
-@ISA = (Tie::StdHash);
+our @ISA = qw(Tie::StdHash);
+
+use strict;
 
 my %watched_variables;
 
index e94812855fa9a83fe5651e982127676880a983d9..83dffc6f767e077c950e57f57bad0629d9a22729 100644 (file)
@@ -8,8 +8,13 @@
 
 ###################
 
+use strict;
+
 die("This script cannot be run from the command line.") unless ($main::form);
 
+# import vars from caller
+our ($dbup_locale, $dbup_myconfig, $dbh, $iconv);
+
 sub mydberror {
   my ($msg) = @_;
   die($dbup_locale->text("Database update error:") .
index e3e869698f261e8e0b5273954a2198e3fcda465b..0ad72a0c34fcd339b09b6afb62d53f775a72f5a1 100644 (file)
@@ -2,20 +2,25 @@
 # @description: USTVA Report Daten fuer Oesterreich. Vielen Dank an Gerhard Winkler..
 # @depends: USTVA_abstraction
 
-unless ( $main::form ) { 
+use strict;
+
+unless ( $main::form ) {
   die("This script cannot be run from the command line.");
 }
 
+# import vars from caller
+our ($dbup_locale, $dbup_myconfig, $dbh, $iconv);
+
 if ( check_coa('Austria') ){
 
   if ( coa_is_empty() )  {
     print qq|Eine leere Datenbank mit Kontenrahmen Österreich vorgefunden. <br />
              Die Aktualisierungen werden eingespielt...<br />
              <b>Achtung: Dieses Update ist ungetestet und bedarf weiterer Konfiguration</b>|;
-    
+
     return 1
-      && clear_tables(( 'tax.report_variables', 'tax.report_headings', 
-                        'tax.report_categorys', 'taxkeys', 
+      && clear_tables(( 'tax.report_variables', 'tax.report_headings',
+                        'tax.report_categorys', 'taxkeys',
                         'tax',                  'chart',
                         'buchungsgruppen',
                      ))
@@ -25,9 +30,9 @@ if ( check_coa('Austria') ){
       && do_insert_taxkeys()
       && do_insert_buchungsgruppen()
     ;
-  } 
+  }
   else {
-    print qq|Eine österreichische Datenbank in der bereits Buchungssätze enthalten sind, kann nicht aktualisiert werden.<br /> 
+    print qq|Eine österreichische Datenbank in der bereits Buchungssätze enthalten sind, kann nicht aktualisiert werden.<br />
              Bitte eine neue Datenbank mit Kontenrahmen 'Austria' anlegen.|;
     return 1;
   }
@@ -76,22 +81,22 @@ sub clear_tables {
 }
 
 sub check_coa {
-  
+
   my ( $want_coa ) = @_;
-  
+
   my $query = q{ SELECT count(*) FROM defaults WHERE coa = ? };
-  my ($have_coa) = selectrow_query($form, $dbh, $query, $want_coa);
+  my ($have_coa) = selectrow_query($main::form, $dbh, $query, $want_coa);
 
   return $have_coa;
 
 }
 
 sub coa_is_empty {
-  
-  my $query = q{ SELECT count(*) 
+
+  my $query = q{ SELECT count(*)
                  FROM ar, ap, gl, invoice, acc_trans, customer, vendor, parts
                };
-  my ($empty) = selectrow_query($form, $dbh, $query);
+  my ($empty) = selectrow_query($main::form, $dbh, $query);
 
   $empty = !$empty;
 
@@ -106,16 +111,16 @@ sub do_copy_tax_report_structure {
         "INSERT INTO tax.report_headings (id, category_id, type, description, subdescription) VALUES (0, 0, NULL, NULL, NULL)",
   );
 
-  map({ do_query($_); } @queries);  
+  map({ do_query($_); } @queries);
 
 
   my @copy_statements = (
       "INSERT INTO tax.report_variables (id, position, heading_id, description, dec_places, valid_from) VALUES (?, ?, ?, ?, ?, ?)",
   );
 
-  
+
   my @copy_data = (
-    [ 
+    [
       "1;000;0;a) Gesamtbetrag der Bemessungsgrundlage für Lieferungen und sonstige Leistungen (ohne den nachstehend angeführten Eigenverbrauch) einschließlich Anzahlungen (jeweils ohne Umsatzsteuer);2;1970-01-01",
       "2;001;0;zuzüglich Eigenverbrauch (§1 Abs. 1 Z 2, § 3 Abs. 2 und § 3a Abs. 1a);2;1970-01-01",
       "3;021;0;abzüglich Umsätze für die die Steuerschuld gemäß § 19 Abs. 1 zweiter Satz sowie gemäß § 19 Abs. 1a, Abs. 1b, Abs. 1c auf den Leistungsempfänger übergegangen ist.;2;1970-01-01",
@@ -355,7 +360,7 @@ sub do_insert_chart {
   return 1;
 }
 sub do_insert_tax {
-  
+
   my @copy_statements = (
       "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (65, '2510', 7, 'Vorsteuer 10%', '2006-01-30 11:08:23.332857', '2006-02-08 20:28:09.63567', 0.10000, 173);",
       "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (64, '2512', 8, 'Vorsteuer 12%', '2006-02-02 17:39:18.535036', '2006-02-08 20:28:21.463869', 0.12000, 174);",
@@ -366,7 +371,7 @@ sub do_insert_tax {
       "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (NULL, NULL, 10, 'Im anderen EG-Staat steuerpfl. Lieferung', '2006-01-30 11:08:23.332857', '2006-02-08 12:45:36.44088', NULL, 171);",
       "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (NULL, NULL, 11, 'Steuerfreie EG-Lief. an Abn. mit UStIdNr', '2006-01-30 11:08:23.332857', '2006-02-08 12:45:36.44088', NULL, 172);",
       "INSERT INTO tax (chart_id, taxnumber, taxkey, taxdescription, itime, mtime, rate, id) VALUES (NULL, NULL, 0, 'Keine Steuer', '2006-01-30 11:08:23.332857', '2006-02-08 12:45:36.44088', 0.00000, 0);",
+
   );
 
   for my $statement ( 0 .. $#copy_statements ) {
@@ -378,7 +383,7 @@ sub do_insert_tax {
 }
 
 sub do_insert_taxkeys {
-  
+
   my @copy_statements = (
       "INSERT INTO taxkeys VALUES (230, 69, 177, 2, NULL, '1970-01-01');",
       "INSERT INTO taxkeys VALUES (231, 72, 178, 3, NULL, '1970-01-01');",
@@ -476,7 +481,7 @@ sub do_insert_taxkeys {
       "UPDATE taxkeys SET pos_ustva='017' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN ('4015', '4025', '4035', '4045', '4315', '4325', '4335', '4345'));",
       "UPDATE taxkeys SET pos_ustva='022' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN ('4040', '4045'));",
       "UPDATE taxkeys SET pos_ustva='122' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN ('3520'));",
-      "UPDATE taxkeys SET pos_ustva='029' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN ('4010', '4015'));", 
+      "UPDATE taxkeys SET pos_ustva='029' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN ('4010', '4015'));",
       "UPDATE taxkeys SET pos_ustva='129' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN ('3510'));",
       "UPDATE taxkeys SET pos_ustva='025' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN ('4012'));",
       "UPDATE taxkeys SET pos_ustva='125' WHERE chart_id IN (SELECT id FROM chart WHERE accno IN ('3512'));",
index 1ee6abd61b70a4fdc62de8046d7287044311d7a3..40c1ebdfac56954dffe3b47cee9fdaaa9bd2cb22 100644 (file)
@@ -2,8 +2,12 @@
 # @description: Migration of cp_greeting to cp_gender
 # @depends: generic_translations
 
+use strict;
+
 die("This script cannot be run from the command line.") unless ($main::form);
 
+# import vars from caller
+our ($dbup_locale, $dbup_myconfig, $dbh, $iconv);
 
 sub mydberror {
   my ($msg) = @_;
@@ -26,40 +30,40 @@ sub query_result {
 
   # list of all entries where cp_greeting is empty, meaning can't determine gender from parsing Herr/Frau/...
   # this assumes cp_greeting still exists, i.e. gender.sql was not run yet
-  my $gender_table;
+  my ($gender_table, $mchecked, $fchecked);
 
   my $sql2 = "select cp_id,cp_givenname,cp_name,cp_title,cp_greeting from contacts where not (cp_greeting ILIKE '%frau%' OR cp_greeting ILIKE '%herr%' or cp_greeting ILIKE '%mrs.%' or cp_greeting ILIKE '%miss%') ";
   my $sth2 = $dbh->prepare($sql2) or die $dbh->errstr();
-  $sth2->execute() or die $dbh->errstr(); 
+  $sth2->execute() or die $dbh->errstr();
 
-  my $i = 1;   
+  my $i = 1;
   $gender_table .= '<table border="1"><tr><th>cp_givenname</th><th>cp_name</th><th>cp_title</th><th>cp_greeting</th><th><translate>male/female</th></tr>';
   $gender_table .= "\n";
 
   while (my $row = $sth2->fetchrow_hashref()) {
-    if ( main::form->{"gender_$i"} eq "f" ) {
+    if ($main::form->{"gender_$i"} eq "f" ) {
                        $mchecked = "";
                        $fchecked = "checked";
        } else {
                        $mchecked = "checked";
                        $fchecked = "";
        };
-    
+
    $gender_table .= "<tr><input type=hidden name=\"cp_id_$i\" value=\"$row->{cp_id}\"> <td>$row->{cp_givenname}</td> <td>$row->{cp_name}</td> <td>$row->{cp_title} </td> <td>$row->{cp_greeting} </td><td> <input type=\"radio\" name=\"gender_$i\" value=\"m\" $mchecked> <input type=\"radio\" name=\"gender_$i\" value=\"f\" $fchecked></td></tr>\n";
    $i++;
   };
 
-  $gender_table .= "<input type=hidden name=\"number_of_gender_entries\" value=\"$i\">"; 
+  $gender_table .= "<input type=hidden name=\"number_of_gender_entries\" value=\"$i\">";
   $gender_table .= "</table>";
 
   $main::form->{gender_table} = $gender_table;
 
   my $title_table;
-  
+
   my $sql3 = "select cp_id,cp_givenname,cp_name,cp_title,cp_greeting from contacts where not ( (cp_greeting ILIKE '%frau%' OR cp_greeting ILIKE '%herr%' or cp_greeting ILIKE '%mrs.%' or cp_greeting ILIKE '%miss%')) and not (cp_greeting like ''); ";
 
   my $sth3 = $dbh->prepare($sql3) or die $dbh->errstr();
-  $sth3->execute() or die $dbh->errstr(); 
+  $sth3->execute() or die $dbh->errstr();
 
   $title_table = '<table border="1"><tr><th>cp_givenname</th><th>cp_name</th><th>cp_title</th><th>cp_greeting</th><th>cp_title new</th></tr>';
 
@@ -74,7 +78,7 @@ sub query_result {
                  $j++;
   };
 
-  $title_table .= "<input type=hidden name=\"number_of_title_entries\" value=\"$j\">"; 
+  $title_table .= "<input type=hidden name=\"number_of_title_entries\" value=\"$j\">";
   $title_table .= "</table>";
   $main::form->{title_table} = $title_table;
 
index 93ace03ee84e1cebd69210898dbb84a9eb279359..6edd14dc4e109f330a0dac83a81a8231bd18bb70 100644 (file)
@@ -2,6 +2,11 @@
 # @description: Neue Spalte f&uuml;r eine globale Projektnummer in Einkaufs- und Verkaufsbelegen
 # @depends: release_2_4_1
 
+use strict;
+
+# import vars from caller
+our ($dbup_locale, $dbup_myconfig, $dbh);
+
 die("This script cannot be run from the command line.") unless ($main::form);
 
 sub mydberror {
index f9e59a4e5e19e0259bc2ab4dd2319adfcbecf4f4..725758f19a130fc72fde12b1a5bde30476bd9e86 100644 (file)
@@ -2,9 +2,15 @@
 # @description:  Diverse neue Tabellen und Spalten zur Mehrlagerf&auml;higkeit inkl. Migration
 # @depends: release_2_4_3
 
+use strict;
 
 die("This script cannot be run from the command line.") unless ($main::form);
 
+# import vars from caller
+our ($dbup_locale, $dbup_myconfig, $dbh, $iconv);
+my $do_sql_migration = 0;
+my ($check_sql, $sqlcode);
+
 sub mydberror {
   my ($msg) = @_;
   die($dbup_locale->text("Database update error:") .
@@ -21,7 +27,6 @@ sub do_query {
   }
 }
 
-$do_sql_migration = 0;
 
 sub print_question {
   print $main::form->parse_html_template("dbupgrade/warehouse_form");
@@ -57,17 +62,17 @@ INSERT INTO warehouse (description, sortkey, invalid) VALUES ($warehouse, 1, FAL
 UPDATE tmp_parts SET bin = NULL WHERE bin = '';
 
 -- Restore old onhand
-INSERT INTO bin 
- (warehouse_id, description) 
- (SELECT DISTINCT warehouse.id, COALESCE(bin, $bin) 
-   FROM warehouse, tmp_parts 
+INSERT INTO bin
+ (warehouse_id, description)
+ (SELECT DISTINCT warehouse.id, COALESCE(bin, $bin)
+   FROM warehouse, tmp_parts
    WHERE warehouse.description=$warehouse);
-INSERT INTO inventory 
+INSERT INTO inventory
  (warehouse_id, parts_id, bin_id, qty, employee_id, trans_id, trans_type_id, chargenumber)
  (SELECT warehouse.id, tmp_parts.id, bin.id, onhand, (SELECT id FROM employee LIMIT 1), nextval('id'), transfer_type.id, ''
   FROM transfer_type, warehouse, tmp_parts, bin
   WHERE warehouse.description = $warehouse
-    AND COALESCE(bin, $bin) = bin.description 
+    AND COALESCE(bin, $bin) = bin.description
     AND transfer_type.description = 'stock');
 EOF
 ;