]> wagnertech.de Git - mfinanz.git/blobdiff - SL/AM.pm
Merge branch 'master' of github.com:kivitendo/kivitendo-erp
[mfinanz.git] / SL / AM.pm
index acc5bdccc0906e712b13a3a99829e0cf3c9c39d1..4934d866cbae9dd701dcbc4b77045c4ebd279701 100644 (file)
--- a/SL/AM.pm
+++ b/SL/AM.pm
@@ -40,6 +40,7 @@ package AM;
 use Carp;
 use Data::Dumper;
 use Encode;
+use List::MoreUtils qw(any);
 use SL::DBUtils;
 
 use strict;
@@ -213,8 +214,8 @@ sub save_account {
 
   # sanity check, can't have AR with AR_...
   if ($form->{AR} || $form->{AP} || $form->{IC}) {
-    for (qw(AR_amount AR_tax AR_paid AP_amount AP_tax AP_paid IC_sale IC_cogs IC_taxpart IC_income IC_expense IC_taxservice)) {
-      $form->error($::locale->text('It is not allowed that a summary account occurs in a drop-down menu!')) if $form->{$_};
+    if (any { $form->{$_} } qw(AR_amount AR_tax AR_paid AP_amount AP_tax AP_paid IC_sale IC_cogs IC_taxpart IC_income IC_expense IC_taxservice)) {
+      $form->error($::locale->text('It is not allowed that a summary account occurs in a drop-down menu!'));
     }
   }
 
@@ -2115,9 +2116,10 @@ sub get_warehouse {
   map { $form->{$_} = $ref->{$_} } keys %{ $ref };
 
   $query = qq|SELECT b.*, EXISTS
-                (SELECT i.warehouse_id
-                 FROM inventory i
+                (SELECT i.warehouse_id, p.warehouse_id
+                 FROM inventory i, parts p
                  WHERE i.bin_id = b.id
+                 OR    p.bin_id = b.id
                  LIMIT 1)
                 AS in_use
               FROM bin b