From: Jan Büren Date: Tue, 8 Mar 2022 14:29:35 +0000 (+0100) Subject: Abteilung bei Lohnbuchhaltung zuordnen, get_first mit richtigen Parameteraufruf X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~148 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f85f858c4f464251634dab5908d71a80f6703fb9;p=kivitendo-erp.git Abteilung bei Lohnbuchhaltung zuordnen, get_first mit richtigen Parameteraufruf --- diff --git a/SL/Controller/PayPostingImport.pm b/SL/Controller/PayPostingImport.pm index a2d103f2f..c8d39091d 100644 --- a/SL/Controller/PayPostingImport.pm +++ b/SL/Controller/PayPostingImport.pm @@ -82,7 +82,7 @@ sub parse_and_import { # optional KOST1 - KOST2 ? $department_name = $row->[36]; if ($department_name) { - $department = SL::DB::Manager::Department->get_first(description => { like => $department_name . '%' }); + $department = SL::DB::Manager::Department->get_first(where => [ description => { ilike => $department_name . '%' } ]); } my $amount = $::form->parse_amount({ numberformat => '1000,00' }, $row->[0]); diff --git a/t/pay_posting_import/datev_import.t b/t/pay_posting_import/datev_import.t index e11415c85..c164046cf 100644 --- a/t/pay_posting_import/datev_import.t +++ b/t/pay_posting_import/datev_import.t @@ -50,6 +50,23 @@ foreach my $accno (@charts) { } # and add department (KOST1 description) + SL::DB::Department->new( + description => 'Total falsche Abteilung, niemals zuordnen!' + )->save; + + SL::DB::Department->new( + description => '2. Total falsche Abteilung, niemals zuordnen!' + )->save; + + SL::DB::Department->new( + description => '3. Total falsche Abteilung, niemals zuordnen!' + )->save; + + SL::DB::Department->new( + description => 'annahme stelle. Total falsche Abteilung, niemals zuordnen!' + )->save; + + SL::DB::Department->new( description => 'Wisavis' )->save; @@ -73,7 +90,8 @@ foreach my $booking (@{ $gl_bookings }) { # gl is ($current_row->[13], $booking->reference, "Buchungstext correct"); - if (ref $booking->department eq 'SL::DB::Department') { + if ($current_row->[36] eq 'wisavis') { + is(ref $booking->department eq 'SL::DB::Department', 1, "Department assigned"); is ($current_row->[36], 'wisavis', "Department correctly assigned"); # lowercase is ('Wisavis', $booking->department->description, "Department correctly assigned"); # upper case } else {