X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAR.pm;h=fe3e4431bcde45d1bc799ab7931b7b883ecab734;hb=9bfcf6a0d67d2210065de7d907d46c3e2715e06b;hp=04af973506d0bed8d9b3d0de05c1eb7743f63cfa;hpb=e712a2147eeaa7e73329b06cd55f744b2bb58e0d;p=kivitendo-erp.git diff --git a/SL/AR.pm b/SL/AR.pm index 04af97350..fe3e4431b 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -435,7 +435,8 @@ sub ar_transactions { qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | . qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| . qq|LEFT JOIN tax_zones tz ON (tz.id = c.taxzone_id)| . - qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)|; + qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)| . + qq|LEFT JOIN department d ON (d.id = a.department_id)|; my $where = "1 = 1"; if ($form->{customer_id}) { @@ -445,11 +446,16 @@ sub ar_transactions { $where .= " AND c.name ILIKE ?"; push(@values, $form->like($form->{customer})); } - if ($form->{department}) { - my ($null, $department_id) = split /--/, $form->{department}; + if ($form->{department_id}) { + my $department_id = $form->{department_id}; $where .= " AND a.department_id = ?"; push(@values, $department_id); } + if ($form->{department}) { + my $department = "%" . $form->{department} . "%"; + $where .= " AND d.description ILIKE ?"; + push(@values, $department); + } foreach my $column (qw(invnumber ordnumber notes transaction_description)) { if ($form->{$column}) { $where .= " AND a.$column ILIKE ?";