X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FWH.pm;h=91ac127076c94916f542da34254f284e522f8b0e;hb=c6d9d294865964edb58d06a982ea42b4f2a50518;hp=70bf7db1f18e8bb657534c4e7e7f2c4440602da8;hpb=21ca8cb76721b756440cfe75fd8710bfe1caf31b;p=kivitendo-erp.git diff --git a/SL/WH.pm b/SL/WH.pm index 70bf7db1f..91ac12707 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -174,7 +174,7 @@ sub transfer_assembly { if ($partsQTY > $max_parts){ # Gibt es hier ein Problem mit nicht "escapten" Zeichen? 25.4.09 Antwort: Ja. Aber erst wenn im Frontend die locales-Funktion aufgerufen wird - $kannNichtFertigen .= "Zum Fertigen fehlen:" . abs($partsQTY - $max_parts) . " Stueck der Ware:" . get_part_description($self, parts_id => $currentPart_ID) . ", um das Erzeugnis herzustellen.
"; # Konnte die Menge nicht mit der aktuellen Anzahl der Waren fertigen + $kannNichtFertigen .= "Zum Fertigen fehlen:" . abs($partsQTY - $max_parts) . " Einheiten der Ware:" . get_part_description($self, parts_id => $currentPart_ID) . ", um das Erzeugnis herzustellen.
"; # Konnte die Menge nicht mit der aktuellen Anzahl der Waren fertigen next; # die weiteren Überprüfungen sind unnötig } @@ -301,11 +301,14 @@ sub get_warehouse_journal { $filter{na} = '-' unless $filter{na}; # make order, search in $filter and $form - $form->{sort} = $filter{sort} unless $form->{sort}; - $form->{order} = ($form->{sort} = 'itime') unless $form->{sort}; - $form->{sort} = 'itime' if $form->{sort} eq "date"; - $form->{order} = $filter{order} unless $form->{order}; - $form->{sort} .= (($form->{order}) ? " DESC" : " ASC"); + my $sort_col = $form->{sort}; + my $sort_order = $form->{order}; + + $sort_col = $filter{sort} unless $sort_col; + $sort_order = ($sort_col = 'itime') unless $sort_col; + $sort_col = 'itime' if $sort_col eq 'date'; + $sort_order = $filter{order} unless $sort_order; + my $sort_spec = "${sort_col} " . ($sort_order ? " DESC" : " ASC"); my $where_clause = join(" AND ", @filter_ary) . " AND " if (@filter_ary); @@ -400,7 +403,7 @@ sub get_warehouse_journal { WHERE $where_clause i1.qty > 0 AND i1.trans_id IN ( SELECT i.trans_id FROM inventory i GROUP BY i.trans_id HAVING COUNT(i.trans_id) = 1 ) GROUP BY $group_clause - ORDER BY r_$form->{sort}|; + ORDER BY r_${sort_spec}|; my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars, @filter_vars, @filter_vars); @@ -464,7 +467,7 @@ sub get_warehouse_report { my $dbh = $form->get_standard_dbh($myconfig); # filters - my (@filter_ary, @filter_vars, @wh_bin_filter_ary, @wh_bin_filter_vars, $columns, $group_by); + my (@filter_ary, @filter_vars, @wh_bin_filter_ary, @wh_bin_filter_vars); delete $form->{include_empty_bins} unless ($form->{l_warehousedescription} || $form->{l_bindescription}); @@ -521,12 +524,15 @@ sub get_warehouse_report { map { $form->{"l_${_}id"} = "Y" if ($form->{"l_${_}description"} || $form->{"l_${_}number"}); } qw(warehouse bin); # make order, search in $filter and $form - $form->{sort} = $filter{sort} unless $form->{sort}; - $form->{sort} = "parts_id" unless $form->{sort}; - $form->{order} = $filter{order} unless $form->{order}; - $form->{sort} =~ s/ASC|DESC//; # kill stuff left in from previous queries - my $orderby = $form->{sort}; - $form->{sort} .= (($form->{order}) ? " DESC" : " ASC"); + my $sort_col = $form->{sort}; + my $sort_order = $form->{order}; + + $sort_col = $filter{sort} unless $sort_col; + $sort_col = "parts_id" unless $sort_col; + $sort_order = $filter{order} unless $sort_order; + $sort_col =~ s/ASC|DESC//; # kill stuff left in from previous queries + my $orderby = $sort_col; + my $sort_spec = "${sort_col} " . ($sort_order ? " DESC" : " ASC"); my $where_clause = join " AND ", ("1=1", @filter_ary); @@ -563,15 +569,14 @@ sub get_warehouse_report { my $query = qq|SELECT $select_clause - $columns FROM inventory i LEFT JOIN parts p ON i.parts_id = p.id LEFT JOIN bin b ON i.bin_id = b.id LEFT JOIN warehouse w ON i.warehouse_id = w.id $joins WHERE $where_clause - GROUP BY $group_clause $group_by - ORDER BY $form->{sort}|; + GROUP BY $group_clause + ORDER BY $sort_spec|; my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars); @@ -597,7 +602,7 @@ sub get_warehouse_report { @all_fields = keys %{ $ref } unless (@all_fields); } - $ref->{stock_value} *= $ref->{qty}; + $ref->{stock_value} = ($ref->{stock_value} || 0) * $ref->{qty}; push @contents, $ref; }