]> wagnertech.de Git - mfinanz.git/commitdiff
Benutzung undefinierter Werte vermeiden
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 2 Nov 2015 13:33:18 +0000 (14:33 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 2 Nov 2015 13:49:36 +0000 (14:49 +0100)
SL/Auth.pm
SL/DATEV.pm
SL/DBUtils.pm
SL/Menu.pm
sql/Pg-upgrade2/defaults_datev_check.pl

index 2323a28412243e8332713e1fdf1b0014566a2575..788154c14c8cd5c3867c5a5a190d92cc15ac6fa8 100644 (file)
@@ -1120,7 +1120,7 @@ sub _parse_rights_string {
       push @{$cur_ary}, $token;
 
     } else {
-      push @{$cur_ary}, $self->{RIGHTS}->{$login}->{$token} * 1;
+      push @{$cur_ary}, ($self->{RIGHTS}->{$login}->{$token} // 0) * 1;
     }
   }
 
index ca74cd287531d70a25c443a7dd566ed4873afb39..90fa620736f8b467d849dc24dd35b1851eb69bb9 100644 (file)
@@ -263,7 +263,7 @@ sub _fill {
   my $fill_char = shift;
   my $alignment = shift || 'right';
 
-  my $text_len  = length $text;
+  my $text_len  = length($text // '');
 
   if ($field_len < $text_len) {
     $text = substr $text, 0, $field_len;
index 8e1ad458a0abb214773c93cb4426c64558b0111d..89761443bb378a3380a8722986b6ea0752da1995 100644 (file)
@@ -222,11 +222,11 @@ sub selectall_as_map {
   my %hash;
   if ('' eq ref $value_col) {
     while (my $ref = $sth->fetchrow_hashref()) {
-      $hash{$ref->{$key_col}} = $ref->{$value_col};
+      $hash{$ref->{$key_col} // ''} = $ref->{$value_col};
     }
   } else {
     while (my $ref = $sth->fetchrow_hashref()) {
-      $hash{$ref->{$key_col}} = { map { $_ => $ref->{$_} } @{ $value_col } };
+      $hash{$ref->{$key_col} // ''} = { map { $_ => $ref->{$_} } @{ $value_col } };
     }
   }
 
index f01b341be5412eaeb301e059a22c7cee4963572c..6bbcffb9c8af8adbfc42883522e3298b47a2e5cd 100644 (file)
@@ -103,7 +103,7 @@ sub build_tree {
   my %by_parent;
   # order them by parent
   for my $node ($self->nodes) {
-    push @{ $by_parent{ $node->{parent} } //= [] }, $node;
+    push @{ $by_parent{ $node->{parent} // '' } //= [] }, $node;
   }
 
   my $tree = { };
index 956bc810e6aa0c9ac8f4da27ae80442d045e792d..619a9fc02eb45c9a103b7230ca0395d893a0f51f 100644 (file)
@@ -22,11 +22,7 @@ sub run {
   # kivitendo's behaviour isn't changed by this update
   # if checks are not set in config set it to true
   foreach my $check (qw(check_on_sales_invoice check_on_purchase_invoice check_on_ar_transaction check_on_ap_transaction check_on_gl_transaction)) {
-    my $check_set = 1;
-    if ($::lx_office_conf{datev_check}->{$check} == 0 && defined ($::lx_office_conf{datev_check}->{$check})) {
-      $check_set = 0;
-    }
-
+    my $check_set     = defined($::lx_office_conf{datev_check}->{$check}) && ($::lx_office_conf{datev_check}->{$check} == 0) ? 0 : 1;
     my $update_column = "UPDATE defaults SET datev_$check = '$check_set';";
     $self->db_query($update_column);
   }