]> wagnertech.de Git - mfinanz.git/blobdiff - SL/AP.pm
Gelieferte Mengen über Recordlinks ermitteln
[mfinanz.git] / SL / AP.pm
index 08dd542246caf7190e196a33117cd861a5ea9537..e3dc7b31d9506d2f8d04a5e047b6851547d92487 100644 (file)
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -39,6 +39,7 @@ use SL::DBUtils;
 use SL::IO;
 use SL::MoreCommon;
 use SL::DB::Default;
+use SL::Util qw(trim);
 use Data::Dumper;
 
 use strict;
@@ -457,7 +458,7 @@ sub ap_transactions {
   }
   if ($form->{"cp_name"}) {
     $where .= " AND (cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
-    push(@values, ('%' . $form->{"cp_name"} . '%')x2);
+    push(@values, ('%' . trim($form->{"cp_name"}) . '%')x2);
   }
   if ($form->{department}) {
     # ähnlich wie commit 0bbfb33b6aa8e38bb6c81d1684ab7d08e5b5c5af abteilung
@@ -493,11 +494,11 @@ sub ap_transactions {
 
   if ($form->{transdatefrom}) {
     $where .= " AND a.transdate >= ?";
-    push(@values, $form->{transdatefrom});
+    push(@values, trim($form->{transdatefrom}));
   }
   if ($form->{transdateto}) {
     $where .= " AND a.transdate <= ?";
-    push(@values, $form->{transdateto});
+    push(@values, trim($form->{transdateto}));
   }
   if ($form->{open} || $form->{closed}) {
     unless ($form->{open} && $form->{closed}) {
@@ -811,6 +812,8 @@ sub storno {
   $query = qq|UPDATE ap SET paid = amount + paid, storno = 't' WHERE id = ?|;
   do_query($form, $dbh, $query, $id);
 
+  $form->new_lastmtime('ap') if $id == $form->{id};
+
   # now copy acc_trans entries
   $query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ? ORDER BY a.acc_trans_id|;
   my $rowref = selectall_hashref_query($form, $dbh, $query, $id);