X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ba6a136694f2e54e7bf21b1ecfabfcb872784ef4..7635f647ec7dcdef51684b21601ee0930ea2bc5b:/SL/AM.pm?ds=sidebyside diff --git a/SL/AM.pm b/SL/AM.pm index 6989e3590..4934d866c 100644 --- 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; @@ -207,14 +208,15 @@ sub save_account { # connect to database, turn off AutoCommit my $dbh = $form->dbconnect_noauto($myconfig); - # sanity check, can't have AR with AR_... - if ($form->{AR} || $form->{AP} || $form->{IC}) { - map { delete $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); + for (qw(AR_include_in_dropdown AP_include_in_dropdown summary_account)) { + $form->{$form->{$_}} = $form->{$_} if $form->{$_}; } - for (qw(AR_include_in_dropdown AP_include_in_dropdown)) { - $form->{$form->{$_}} = $form->{$_} if $form->{$_}; + # sanity check, can't have AR with AR_... + if ($form->{AR} || $form->{AP} || $form->{IC}) { + 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!')); + } } $form->{link} = ""; @@ -2114,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