X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/cd887de4f6f50b3f49d9805f7a64a798d1db104f..9a128e8bfd4f08c24e12b4ab7387efb3001d629f:/SL/Controller/BankTransaction.pm diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index bbe4edf2c..d018930fc 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -23,6 +23,7 @@ use SL::DB::AccTransaction; use SL::DB::Tax; use SL::DB::Draft; use SL::DB::BankAccount; +use SL::DBUtils qw(like); use SL::Presenter; use List::Util qw(max); @@ -78,9 +79,10 @@ sub action_list { push @where, (transdate => { lt => $todate }) if ($todate); my $bank_account = SL::DB::Manager::BankAccount->find_by( id => $::form->{filter}{bank_account} ); # bank_transactions no younger than starting date, + # including starting date (same search behaviour as fromdate) # but OPEN invoices to be matched may be from before if ( $bank_account->reconciliation_starting_date ) { - push @where, (transdate => { gt => $bank_account->reconciliation_starting_date }); + push @where, (transdate => { ge => $bank_account->reconciliation_starting_date }); }; my $bank_transactions = SL::DB::Manager::BankTransaction->get_all(where => [ amount => {ne => \'invoice_amount'}, @@ -277,8 +279,8 @@ sub action_ajax_add_list { my @where_purchase = (amount => { ne => \'paid' }); if ($::form->{invnumber}) { - push @where_sale, (invnumber => { ilike => '%' . $::form->{invnumber} . '%'}); - push @where_purchase, (invnumber => { ilike => '%' . $::form->{invnumber} . '%'}); + push @where_sale, (invnumber => { ilike => like($::form->{invnumber})}); + push @where_purchase, (invnumber => { ilike => like($::form->{invnumber})}); } if ($::form->{amount}) { @@ -287,13 +289,13 @@ sub action_ajax_add_list { } if ($::form->{vcnumber}) { - push @where_sale, ('customer.customernumber' => { ilike => '%' . $::form->{vcnumber} . '%'}); - push @where_purchase, ('vendor.vendornumber' => { ilike => '%' . $::form->{vcnumber} . '%'}); + push @where_sale, ('customer.customernumber' => { ilike => like($::form->{vcnumber})}); + push @where_purchase, ('vendor.vendornumber' => { ilike => like($::form->{vcnumber})}); } if ($::form->{vcname}) { - push @where_sale, ('customer.name' => { ilike => '%' . $::form->{vcname} . '%'}); - push @where_purchase, ('vendor.name' => { ilike => '%' . $::form->{vcname} . '%'}); + push @where_sale, ('customer.name' => { ilike => like($::form->{vcname})}); + push @where_purchase, ('vendor.name' => { ilike => like($::form->{vcname})}); } if ($::form->{transdatefrom}) {