X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=SL%2FWH.pm;h=51c27c976ccc298fe6c93c20aee4954416ad0e13;hb=78c8b931b0081dc5c082615c6dac24b7d8f6ff7f;hp=b93eebdd659d28bfb1ccba4d6efd3ea0dae0a487;hpb=64c39b744b9fba960b32315ac7ea36477c85e8a5;p=kivitendo-erp.git
diff --git a/SL/WH.pm b/SL/WH.pm
index b93eebdd6..51c27c976 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);
@@ -438,6 +441,7 @@ sub get_warehouse_journal {
# - partsid - will return matches with this parts_id only
# - description - will return only matches where the given string is a substring of the description
# - chargenumber - will return only matches where the given string is a substring of the chargenumber
+# - ean - will return only matches where the given string is a substring of the ean as stored in the table parts (article)
# - charge_ids - must be an arrayref. will return contents with these ids only
# - expires_in - will only return matches that expire within the given number of days
# will also add a column named 'has_expired' containing if the match has already expired or not
@@ -499,6 +503,10 @@ sub get_warehouse_report {
push @filter_ary, "i.chargenumber ILIKE ?";
push @filter_vars, '%' . $filter{chargenumber} . '%';
}
+ if ($filter{ean}) {
+ push @filter_ary, "p.ean ILIKE ?";
+ push @filter_vars, '%' . $filter{ean} . '%';
+ }
# prepare qty comparison for later filtering
my ($f_qty_op, $f_qty, $f_qty_base_unit);
@@ -516,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);
@@ -534,6 +545,7 @@ sub get_warehouse_report {
"bindescription" => "b.description",
"binid" => "b.id",
"chargenumber" => "i.chargenumber",
+ "ean" => "p.ean",
"chargeid" => "c.id",
"warehousedescription" => "w.description",
"partunit" => "p.unit",
@@ -565,7 +577,7 @@ sub get_warehouse_report {
$joins
WHERE $where_clause
GROUP BY $group_clause $group_by
- ORDER BY $form->{sort}|;
+ ORDER BY $sort_spec|;
my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars);