Bugzilla – Attachment 29626 Details for
Bug 11744
cancel receipt doesn't work for one item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 11744: Cancel a receipt does not delete items created on receiving
PASSED-QA-Bug-11744-Cancel-a-receipt-does-not-dele.patch (text/plain), 3.53 KB, created by
Kyle M Hall (khall)
on 2014-07-11 12:14:40 UTC
(
hide
)
Description:
[PASSED QA] Bug 11744: Cancel a receipt does not delete items created on receiving
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-07-11 12:14:40 UTC
Size:
3.53 KB
patch
obsolete
>From 6812fa7cd0fd259831238d71b50ae48611129a83 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 19 Feb 2014 13:39:39 +0100 >Subject: [PATCH] [PASSED QA] Bug 11744: Cancel a receipt does not delete items created on receiving > >If items is created on receiving, cancel a receipt should delete them. >The code only manage the case if the order is a child of another order >(partial). > >To reproduce: >1/ Set AcqCreateItem to receiving >2/ Order one or more item(s) >3/ Receive the order and verify the item is created >4/ Cancel the receipt >5/ The item is not deleted > >Test plan: >1/ Apply this patch and do again previous steps. The item should not be >deleted at step 5. >2/ Set AcqCreateItem to ordering and verify the item is not deleted. > >Signed-off-by: marjorie barry-vila <marjorie.barry-vila@ccsr.qc.ca> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Acquisition.pm | 46 +++++++++++++++++++++++++++------------------- > 1 files changed, 27 insertions(+), 19 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 2e013ac..ce97363 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1615,6 +1615,7 @@ sub CancelReceipt { > }; > $sth = $dbh->prepare($query); > $sth->execute(0, undef, undef, $ordernumber); >+ _cancel_items_receipt( $ordernumber ); > } else { > # The order line has a parent, increase parent quantity and delete > # the order line. >@@ -1651,25 +1652,7 @@ sub CancelReceipt { > " receipt"; > return; > } >- if(C4::Context->preference('AcqCreateItem') eq 'receiving') { >- # Remove items that were created at receipt >- $query = qq{ >- DELETE FROM items, aqorders_items >- USING items, aqorders_items >- WHERE items.itemnumber = ? AND aqorders_items.itemnumber = ? >- }; >- $sth = $dbh->prepare($query); >- my @itemnumbers = GetItemnumbersFromOrder($ordernumber); >- foreach my $itemnumber (@itemnumbers) { >- $sth->execute($itemnumber, $itemnumber); >- } >- } else { >- # Update items >- my @itemnumbers = GetItemnumbersFromOrder($ordernumber); >- foreach my $itemnumber (@itemnumbers) { >- ModItemOrder($itemnumber, $parent_ordernumber); >- } >- } >+ _cancel_items_receipt( $ordernumber, $parent_ordernumber ); > # Delete order line > $query = qq{ > DELETE FROM aqorders >@@ -1683,6 +1666,31 @@ sub CancelReceipt { > return $parent_ordernumber; > } > >+sub _cancel_items_receipt { >+ my ( $ordernumber, $parent_ordernumber ) = @_; >+ $parent_ordernumber ||= $ordernumber; >+ >+ my @itemnumbers = GetItemnumbersFromOrder($ordernumber); >+ if(C4::Context->preference('AcqCreateItem') eq 'receiving') { >+ # Remove items that were created at receipt >+ my $query = qq{ >+ DELETE FROM items, aqorders_items >+ USING items, aqorders_items >+ WHERE items.itemnumber = ? AND aqorders_items.itemnumber = ? >+ }; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare($query); >+ foreach my $itemnumber (@itemnumbers) { >+ $sth->execute($itemnumber, $itemnumber); >+ } >+ } else { >+ # Update items >+ foreach my $itemnumber (@itemnumbers) { >+ ModItemOrder($itemnumber, $parent_ordernumber); >+ } >+ } >+} >+ > #------------------------------------------------------------# > > =head3 SearchOrders >-- >1.7.2.5
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 11744
:
25201
|
25444
|
25445
|
25682
|
25683
|
26447
|
29622
| 29626 |
29627
|
29628