From bfdfc9eecd2ea922782f4e1b179b08370b41f2de Mon Sep 17 00:00:00 2001
From: =?utf8?q?Sven=20Sch=C3=B6ling?= <s.schoeling@linet-services.de>
Date: Fri, 13 Sep 2013 15:30:15 +0200
Subject: [PATCH] warnings unter 5.12.4

---
 sql/Pg-upgrade2/currencies.pl              | 76 +++++++++++-----------
 sql/Pg-upgrade2/defaults_posting_config.pl | 10 +--
 sql/Pg-upgrade2/erzeugnisnummern.pl        |  2 +-
 sql/Pg-upgrade2/warehouse.pl               |  6 +-
 t/rdbo_consistency.t                       |  1 +
 5 files changed, 50 insertions(+), 45 deletions(-)

diff --git a/sql/Pg-upgrade2/currencies.pl b/sql/Pg-upgrade2/currencies.pl
index 9a4a8fd5e..e1b8d9c9b 100644
--- a/sql/Pg-upgrade2/currencies.pl
+++ b/sql/Pg-upgrade2/currencies.pl
@@ -69,49 +69,51 @@ sub run {
     return 2;
   }
 
-  if ($main::form->{continue_options} eq 'break_up') {
-    return 0;
-  }
+  if (defined $::form->{continue_options}) {
+    if ($::form->{continue_options} eq 'break_up') {
+      return 0;
+    }
 
-  if ($main::form->{continue_options} eq 'insert') {
-    for my $i (0..($rowcount-1)){
-      push @currency_array, $main::form->{"curr_$i"};
+    if ($::form->{continue_options} eq 'insert') {
+      for my $i (0..($rowcount-1)){
+        push @currency_array, $main::form->{"curr_$i"};
+      }
+      create_and_fill_table($self, @currency_array);
+      return 1;
     }
-    create_and_fill_table($self, @currency_array);
-    return 1;
-  }
 
-  my $still_orphaned;
-  if ($main::form->{continue_options} eq 'replace') {
-    for my $i (0..($rowcount - 1)){
-      $still_orphaned = 1;
-      for my $item (@currency_array){
-        if ($main::form->{"curr_$i"} eq $item){
-          $still_orphaned = 0;
-          $query = qq|DELETE FROM exchangerate WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
-          $self->db_query($query);
-          $query = qq|UPDATE ap SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
-          $self->db_query($query);
-          $query = qq|UPDATE ar SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
-          $self->db_query($query);
-          $query = qq|UPDATE oe SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
-          $self->db_query($query);
-          $query = qq|UPDATE customer SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
-          $self->db_query($query);
-          $query = qq|UPDATE delivery_orders SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
-          $self->db_query($query);
-          $query = qq|UPDATE vendor SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
-          $self->db_query($query);
-          last;
+    my $still_orphaned;
+    if ($::form->{continue_options} eq 'replace') {
+      for my $i (0..($rowcount - 1)){
+        $still_orphaned = 1;
+        for my $item (@currency_array){
+          if ($main::form->{"curr_$i"} eq $item){
+            $still_orphaned = 0;
+            $query = qq|DELETE FROM exchangerate WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+            $self->db_query($query);
+            $query = qq|UPDATE ap SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+            $self->db_query($query);
+            $query = qq|UPDATE ar SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+            $self->db_query($query);
+            $query = qq|UPDATE oe SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+            $self->db_query($query);
+            $query = qq|UPDATE customer SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+            $self->db_query($query);
+            $query = qq|UPDATE delivery_orders SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+            $self->db_query($query);
+            $query = qq|UPDATE vendor SET curr = '| . $main::form->{"curr_$i"} . qq|' WHERE curr = '| . $main::form->{"old_curr_$i"} . qq|'|;
+            $self->db_query($query);
+            last;
+          }
+        }
+        if ($still_orphaned){
+          $main::form->{continue_options} = '';
+          return do_update();
         }
       }
-      if ($still_orphaned){
-        $main::form->{continue_options} = '';
-        return do_update();
-      }
+      create_and_fill_table($self, @currency_array);
+      return 1;
     }
-    create_and_fill_table($self, @currency_array);
-    return 1;
   }
 
   #No orphaned currencies, so create table:
diff --git a/sql/Pg-upgrade2/defaults_posting_config.pl b/sql/Pg-upgrade2/defaults_posting_config.pl
index a94f2f53e..32aa23f75 100644
--- a/sql/Pg-upgrade2/defaults_posting_config.pl
+++ b/sql/Pg-upgrade2/defaults_posting_config.pl
@@ -18,10 +18,12 @@ sub run {
   # kivitendo behaviour isn't changed by this update
   # if payments_changeable is not set in config set it to 0
   my $payments_changeable = 0;
-  if ($::lx_office_conf{features}->{payments_changeable} == 1 ) {
-    $payments_changeable = 1;
-  } elsif ($::lx_office_conf{features}->{payments_changeable} == 2 ) {
-    $payments_changeable = 2;
+  if (defined $::lx_office_conf{features}{payments_changeable}) {
+    if ($::lx_office_conf{features}->{payments_changeable} == 1 ) {
+      $payments_changeable = 1;
+    } elsif ($::lx_office_conf{features}->{payments_changeable} == 2 ) {
+      $payments_changeable = 2;
+    }
   }
 
   my $update_column = "UPDATE defaults SET payments_changeable = '$payments_changeable';";
diff --git a/sql/Pg-upgrade2/erzeugnisnummern.pl b/sql/Pg-upgrade2/erzeugnisnummern.pl
index ab561ee32..326122eb8 100644
--- a/sql/Pg-upgrade2/erzeugnisnummern.pl
+++ b/sql/Pg-upgrade2/erzeugnisnummern.pl
@@ -13,7 +13,7 @@ use SL::DBUtils;
 sub run {
   my ($self) = @_;
 
-  if ($::form->{upgrade_action} eq 'filter_parts') {
+  if (defined $::form->{upgrade_action} && $::form->{upgrade_action} eq 'filter_parts') {
     return $self->filter_parts($self);
   }
 
diff --git a/sql/Pg-upgrade2/warehouse.pl b/sql/Pg-upgrade2/warehouse.pl
index 3c9097176..6eebb2f7b 100644
--- a/sql/Pg-upgrade2/warehouse.pl
+++ b/sql/Pg-upgrade2/warehouse.pl
@@ -140,7 +140,7 @@ SQL
     print_question();
     return 2;
   } else {
-    if ($::form->{do_migrate} eq 'Y') {
+    if (defined $::form->{do_migrate} && $::form->{do_migrate} eq 'Y') {
       # if yes, both warehouse and bin must be given
       if (!$::form->{import_warehouse} || !$::form->{bin_default}) {
         print_question();
@@ -150,8 +150,8 @@ SQL
       $do_sql_migration = 1;
     }
   }
-  my $warehouse = $::form->{import_warehouse} ne '' ? $::form->{import_warehouse} : "Transfer";
-  my $bin       = $::form->{bin_default}      ne '' ? $::form->{bin_default}      : "1";
+  my $warehouse = defined $::form->{import_warehouse} && $::form->{import_warehouse} ne '' ? $::form->{import_warehouse} : "Transfer";
+  my $bin       = defined $::form->{bin_default}      && $::form->{bin_default}      ne '' ? $::form->{bin_default}      : "1";
 
   $warehouse    = $self->dbh->quote($warehouse);
   $bin          = $self->dbh->quote($bin);
diff --git a/t/rdbo_consistency.t b/t/rdbo_consistency.t
index 7b5cedb3e..89d78a557 100644
--- a/t/rdbo_consistency.t
+++ b/t/rdbo_consistency.t
@@ -49,6 +49,7 @@ sub test_db_included_in_all {
 
 sub test_use_in_all_exists_as_db {
   foreach my $package (map { m/^use\s+(.+?);/; $1 } grep { '^use SL::DB::' } split m/\n/, $all_content) {
+    next unless $package;
     next unless $package =~ m/^SL::DB::(.+)/;
     my $file = $1;
     $file    =~ s{::}{/}g;
-- 
2.20.1