From ed62899694fe27f024f8948fc47617125f06a32c Mon Sep 17 00:00:00 2001 From: Yohann Dufour Date: Tue, 22 Jul 2014 13:48:03 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 12626: SQLHelper replacement - C4::Acquisition With this patch, the subroutine NewOrder uses DBIx::Class instead of C4::SQLHelper. Test plan: 1) Apply the patch 2) Execute the unit tests by launching : prove t/db_dependent/Acquisition.t 3) The result has to be a success without error or warning : t/db_dependent/Acquisition.t .. ok All tests successful. Files=1, Tests=79, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.80 cusr 0.09 csys = 1.94 CPU) Result: PASS Signed-off-by: Kyle M Hall --- C4/Acquisition.pm | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 7904cbe..eebef6b 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -28,7 +28,6 @@ use MARC::Record; use C4::Suggestions; use C4::Biblio; use C4::Debug; -use C4::SQLHelper qw(InsertInTable UpdateInTable); use C4::Bookseller qw(GetBookSellerFromId); use C4::Templates qw(gettemplate); @@ -1270,17 +1269,13 @@ sub NewOrder { croak "Mandatory parameter $key missing" unless $orderinfo->{$key}; } - if ( defined $orderinfo->{subscription} && $orderinfo->{'subscription'} eq 'yes' ) { - $orderinfo->{'subscription'} = 1; - } else { - $orderinfo->{'subscription'} = 0; - } $orderinfo->{'entrydate'} ||= C4::Dates->new()->output("iso"); if (!$orderinfo->{quantityreceived}) { $orderinfo->{quantityreceived} = 0; } - my $ordernumber=InsertInTable("aqorders",$orderinfo); + my $rs = Koha::Database->new()->schema->resultset('Aqorder'); + my $ordernumber = $rs->create($orderinfo)->id; if (not $orderinfo->{parent_ordernumber}) { my $sth = $dbh->prepare(" UPDATE aqorders -- 1.7.2.5