Bugzilla – Attachment 43682 Details for
Bug 15036
Closing and reopening a basket should not alter status of completed orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-15036-Do-not-overwrite-complete-status-in-basket.patch (text/plain), 2.67 KB, created by
Colin Campbell
on 2015-10-21 10:26:32 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Colin Campbell
Created:
2015-10-21 10:26:32 UTC
Size:
2.67 KB
patch
obsolete
>From 0ee0a773bfa592762e15b366834942e9e7a6fdc0 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Tue, 20 Oct 2015 14:19:35 +0100 >Subject: [PATCH] Bug 15036: Do not overwrite complete status in basket ops > >Reopening or closing a basket should preserve the completed >status for receipted orders. > >This patch excludes orderlines with the completed status >from having their status rewritten as a result of the >change in basket status > >Made the subroutines involved more efficient by removing an >unnecessary loop and by not fetching a large amount of >superfluous data >--- > C4/Acquisition.pm | 46 ++++++++++++---------------------------------- > 1 file changed, 12 insertions(+), 34 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 0f2b161..4044556 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -236,24 +236,11 @@ close a basket (becomes unmodifiable, except for receives) > sub CloseBasket { > my ($basketno) = @_; > my $dbh = C4::Context->dbh; >- my $query = " >- UPDATE aqbasket >- SET closedate=now() >- WHERE basketno=? >- "; >- my $sth = $dbh->prepare($query); >- $sth->execute($basketno); >+ $dbh->do('UPDATE aqbasket SET closedate=now() WHERE basketno=?', {}, $basketno ); > >- my @orders = GetOrders($basketno); >- foreach my $order (@orders) { >- $query = qq{ >- UPDATE aqorders >- SET orderstatus = 'ordered' >- WHERE ordernumber = ?; >- }; >- $sth = $dbh->prepare($query); >- $sth->execute($order->{'ordernumber'}); >- } >+ $dbh->do( q{UPDATE aqorders SET orderstatus = 'ordered' WHERE basketno = ? AND orderstatus != 'complete'}, >+ {}, $basketno); >+ return; > } > > =head3 ReopenBasket >@@ -267,24 +254,15 @@ reopen a basket > sub ReopenBasket { > my ($basketno) = @_; > my $dbh = C4::Context->dbh; >- my $query = " >- UPDATE aqbasket >- SET closedate=NULL >- WHERE basketno=? >- "; >- my $sth = $dbh->prepare($query); >- $sth->execute($basketno); >+ $dbh->do( q{UPDATE aqbasket SET closedate=NULL WHERE basketno=?}, {}, $basketno ); > >- my @orders = GetOrders($basketno); >- foreach my $order (@orders) { >- $query = qq{ >- UPDATE aqorders >- SET orderstatus = 'new' >- WHERE ordernumber = ?; >- }; >- $sth = $dbh->prepare($query); >- $sth->execute($order->{'ordernumber'}); >- } >+ $dbh->do( q{ >+ UPDATE aqorders >+ SET orderstatus = 'new' >+ WHERE basketno = ? >+ AND orderstatus != 'complete' >+ }, {}, $basketno); >+ return; > } > > #------------------------------------------------------------# >-- >2.4.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15036
:
43682
|
44551