Bugzilla – Attachment 31041 Details for
Bug 12557
Cannot revert the changes done by AcqItemSetSubfieldsWhenReceived on canceling a receipt
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12557: Add a way to revert the changes made on items on receving
PASSED-QA-Bug-12557-Add-a-way-to-revert-the-change.patch (text/plain), 3.66 KB, created by
Katrin Fischer
on 2014-08-21 09:25:01 UTC
(
hide
)
Description:
[PASSED QA] Bug 12557: Add a way to revert the changes made on items on receving
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-08-21 09:25:01 UTC
Size:
3.66 KB
patch
obsolete
>From a03fb20ea5bb7b51c673a81ea8265cd1237e6b12 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 11 Jul 2014 12:09:32 +0200 >Subject: [PATCH] [PASSED QA] Bug 12557: Add a way to revert the changes made > on items on receving > >Bug 8307 introduces the AcqItemSetSubfieldsWhenReceived pref. >You can now update an item field on receiving (if you create items on >ordering). >But if the receipt is cancel, there is no way to revert these changes. > >This patch adds a new pref AcqItemSetSubfieldsWhenReceiptIsCancelled to >allow to revert changes previously done on receiving > >Test plan: >0/ Set the AcqCreateItems to 'ordering' >1/ Fill AcqItemSetSubfieldsWhenReceived with o=1 (UNIMARC) or 7=1 >(MARC21). >2/ Fill AcqItemSetSubfieldsWhenReceiptIsCancelled with o=2 (UNIMARC) or >7=2 (MARC21) >3/ Create an order with some items >4/ Receive the order and verify the notforloan value is set to 1 >5/ Cancel the receipt and verify the notforloan value is set to 2 > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >--- > C4/Acquisition.pm | 20 ++++++++++++++++++++ > t/db_dependent/Acquisition/CancelReceipt.t | 6 +++++- > 2 files changed, 25 insertions(+), 1 deletion(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 0cff235..7c7222d 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1665,6 +1665,26 @@ sub CancelReceipt { > > } > >+ if(C4::Context->preference('AcqCreateItem') eq 'ordering') { >+ my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled"); >+ if ( @affects ) { >+ my @itemnumbers = GetItemnumbersFromOrder( $parent_ordernumber ); >+ for my $in ( @itemnumbers ) { >+ my $biblionumber = C4::Biblio::GetBiblionumberFromItemnumber( $in ); >+ my $frameworkcode = GetFrameworkCode($biblionumber); >+ my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber', $frameworkcode ); >+ my $item = C4::Items::GetMarcItem( $biblionumber, $in ); >+ for my $affect ( @affects ) { >+ my ( $sf, $v ) = split q{=}, $affect, 2; >+ foreach ( $item->field($itemfield) ) { >+ $_->update( $sf => $v ); >+ } >+ } >+ C4::Items::ModItemFromMarc( $item, $biblionumber, $in ); >+ } >+ } >+ } >+ > return $parent_ordernumber; > } > >diff --git a/t/db_dependent/Acquisition/CancelReceipt.t b/t/db_dependent/Acquisition/CancelReceipt.t >index e2d4e4d..7304dc3 100644 >--- a/t/db_dependent/Acquisition/CancelReceipt.t >+++ b/t/db_dependent/Acquisition/CancelReceipt.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use C4::Context; > use C4::Acquisition; > use C4::Biblio; >@@ -70,6 +70,7 @@ my $order = GetOrder( $ordernumber ); > is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 0, "Create items on receiving: 0 item exist after cancelling a receipt"); > > t::lib::Mocks::mock_preference('AcqCreateItem', 'ordering'); >+t::lib::Mocks::mock_preference('AcqItemSetSubfieldsWhenReceiptIsCancelled', '7=9'); # notforloan is mapped with 952$7 > ( undef, $ordernumber ) = C4::Acquisition::NewOrder( > { > basketno => $basketno1, >@@ -95,4 +96,7 @@ CancelReceipt($ordernumber); > $order = GetOrder( $ordernumber ); > is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 1, "Create items on ordering: items are not deleted after cancelling a receipt"); > >+my $item = C4::Items::GetItem( $itemnumber ); >+is( $item->{notforloan}, 9, "The notforloan value has been updated with '9'" ); >+ > $dbh->rollback; >-- >1.9.1
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 12557
:
29620
|
29621
|
30886
|
30887
|
31009
|
31039
|
31040
| 31041 |
31042
|
31043