From 31ddb16fa2d142706b7f17c924b05a46e9774edb Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Tue, 1 Jan 2008 18:39:48 -0600 Subject: [PATCH] Fix bug in ModReceiveOrder call had been losing datereceived and replacementprice on modorder. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Acquisition.pm | 38 +++++++++---------- acqui/finishreceive.pl | 2 +- acqui/orderreceive.pl | 3 +- .../prog/en/modules/acqui/orderreceive.tmpl | 3 +- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 26c2578098..8270627035 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -595,6 +595,22 @@ sub ModReceiveOrder { # $daterecieved=POSIX::strftime("%Y-%m-%d",CORE::localtime) unless $daterecieved; # warn "DATE REC : $daterecieved"; $datereceived = C4::Dates->output('iso') unless $datereceived; + my $suggestionid = GetSuggestionFromBiblionumber( $dbh, $biblionumber ); + if ($suggestionid) { + ModStatus( $suggestionid, 'AVAILABLE', '', $biblionumber ); + } + # Allows libraries to change their bookfund during receiving orders + # allows them to adjust budgets + if ( C4::Context->preference("LooseBudgets") && $bookfund ) { + my $query = " + UPDATE aqorderbreakdown + SET bookfundid=? + WHERE ordernumber=? + "; + my $sth = $dbh->prepare($query); + $sth->execute( $bookfund, $ordnum ); + $sth->finish; + } my $sth=$dbh->prepare("SELECT * FROM aqorders LEFT JOIN aqorderbreakdown ON aqorders.ordernumber=aqorderbreakdown.ordernumber WHERE biblionumber=? AND aqorders.ordernumber=?"); @@ -615,12 +631,8 @@ sub ModReceiveOrder { $order->{'bookfundid'},$order->{'biblioitemnumber'},$order->{'rrp'},$order->{'ecost'},$order->{'gst'}, $order->{'budget'},$order->{'unitcost'},$order->{'sub'},'',$order->{'sort1'},$order->{'sort2'},$order->{'purchaseordernumber'}); - $sth = $dbh->prepare("select branchcode, bookfundid from aqorderbreakdown where ordernumber=?"); - $sth->execute($ordnum); - my ($branch,$bookfund) = $sth->fetchrow_array; - $sth->finish; $sth=$dbh->prepare(" insert into aqorderbreakdown (ordernumber, branchcode, bookfundid) values (?,?,?)"); - $sth->execute($newOrder,$branch,$bookfund); + $sth->execute($newOrder,$order->{branch},$order->{bookfundid}); } else { $sth=$dbh->prepare("update aqorders set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?, @@ -629,22 +641,6 @@ sub ModReceiveOrder { $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordnum); $sth->finish; } - my $suggestionid = GetSuggestionFromBiblionumber( $dbh, $biblionumber ); - if ($suggestionid) { - ModStatus( $suggestionid, 'AVAILABLE', '', $biblionumber ); - } - # Allows libraries to change their bookfund during receiving orders - # allows them to adjust budgets - if ( C4::Context->preference("LooseBudgets") ) { - my $query = " - UPDATE aqorderbreakdown - SET bookfundid=? - WHERE ordernumber=? - "; - my $sth = $dbh->prepare($query); - $sth->execute( $bookfund, $ordnum ); - $sth->finish; - } return $datereceived; } #------------------------------------------------------------# diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index e39f77945c..71c548a24e 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -57,7 +57,7 @@ my $cnt = 0; if ($quantityrec > $origquantityrec ) { # save the quantity recieved. - $datereceived = ModReceiveOrder($biblionumber,$ordnum,$quantityrec,$user,$cost,$invoiceno,$datereceived,$freight,$replacement); + $datereceived = ModReceiveOrder($biblionumber,$ordnum,$quantityrec,$user,$cost,$invoiceno,$freight,$replacement,undef,$datereceived); # create items if the user has entered barcodes # my @barcodes=split(/\,| |\|/,$barcode); # foreach barcode provided, build the item MARC::Record and create the item diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 546c0f4a99..5e86eb53d0 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -181,7 +181,7 @@ if ( $count == 1 ) { date => format_date($date), title => $results[0]->{'title'}, author => $results[0]->{'author'}, - copyrightdate => format_date( $results[0]->{'copyrightdate'} ), + copyrightdate => $results[0]->{'copyrightdate'}, itemtype => $results[0]->{'itemtype'}, isbn => $results[0]->{'isbn'}, seriestitle => $results[0]->{'seriestitle'}, @@ -195,6 +195,7 @@ if ( $count == 1 ) { unitprice => $results[0]->{'unitprice'}, invoice => $invoice, datereceived => $datereceived->output(), + datereceived_iso => $datereceived->output('iso'), ); } else { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl index c82dc33b38..a51885a621 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl @@ -91,7 +91,7 @@ " /> " /> " /> - " /> + " /> " /> " /> @@ -100,6 +100,7 @@
Accounting details
    +
  • 1" /> -- 2.39.5