Bugzilla – Attachment 34702 Details for
Bug 13319
On inserting an order, the parent_ordernumber attribute is not set to the object
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 13319: Fix Koha::Acq::Order should set parent_ordernumber
PASSED-QA-Bug-13319-Fix-KohaAcqOrder-should-set-pa.patch (text/plain), 3.84 KB, created by
Katrin Fischer
on 2014-12-27 11:40:30 UTC
(
hide
)
Description:
[PASSED QA] Bug 13319: Fix Koha::Acq::Order should set parent_ordernumber
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-12-27 11:40:30 UTC
Size:
3.84 KB
patch
obsolete
>From 825fd57cb4361f007b1dc9c121811e3872d4ff3d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 14 Nov 2014 16:18:09 +0100 >Subject: [PATCH] [PASSED QA] Bug 13319: Fix Koha::Acq::Order should set > parent_ordernumber > >The tests highligh the problem: if the parent_ordernumber attribute is >not set on inserting an order, the object returned by the method does >not contain the value (undef). > >Test plan: >Verify the tests are consistent and > prove t/db_dependent/Acquisition/CancelReceipt.t >should return green. > >You can also verify that receive partially an order and cancel the >receipt work as expected. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Acquisition/Order.pm | 3 +- > t/db_dependent/Acquisition/CancelReceipt.t | 44 ++++++++++++++++++++++++++++-- > 2 files changed, 44 insertions(+), 3 deletions(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index 67a9982..15b9867 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -51,7 +51,8 @@ sub insert { > $self->{ordernumber} = $rs->id; > > unless ( $self->{parent_ordernumber} ) { >- $rs->update( { parent_ordernumber => $self->{ordernumber} } ); >+ $self->{parent_ordernumber} = $self->{ordernumber}; >+ $rs->update( { parent_ordernumber => $self->{parent_ordernumber} } ); > } > > return $self; >diff --git a/t/db_dependent/Acquisition/CancelReceipt.t b/t/db_dependent/Acquisition/CancelReceipt.t >index 3ef83b3..1946550 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 => 4; >+use Test::More tests => 12; > use C4::Context; > use C4::Acquisition; > use C4::Biblio; >@@ -85,9 +85,19 @@ $order = Koha::Acquisition::Order->new( > )->insert; > $ordernumber = $order->{ordernumber}; > >+is( $order->{parent_ordernumber}, $order->{ordernumber}, >+ "Insert an order should set parent_order=ordernumber, if no parent_ordernumber given" >+); >+ > $order->add_item( $itemnumber1 ); > $order->add_item( $itemnumber2 ); > >+is( >+ scalar( GetItemnumbersFromOrder( $order->{ordernumber} ) ), >+ 2, >+ "Create items on ordering: 2 items should be linked to the order before receiving" >+); >+ > my ( undef, $new_ordernumber ) = ModReceiveOrder( > { > biblionumber => $biblionumber, >@@ -98,9 +108,39 @@ my ( undef, $new_ordernumber ) = ModReceiveOrder( > } > ); > >+my $new_order = GetOrder( $new_ordernumber ); >+ >+is( $new_order->{ordernumber}, $new_ordernumber, >+ "ModReceiveOrder should return a correct ordernumber" ); >+isnt( $new_ordernumber, $ordernumber, >+ "ModReceiveOrder should return a different ordernumber" ); >+is( $new_order->{parent_ordernumber}, $ordernumber, >+ "The new order created by ModReceiveOrder should be linked to the parent order" >+); >+ >+is( >+ scalar( GetItemnumbersFromOrder( $order->{ordernumber} ) ), >+ 1, >+ "Create items on ordering: 1 item should still be linked to the original order after receiving" >+); >+is( >+ scalar( GetItemnumbersFromOrder($new_ordernumber) ), >+ 1, >+ "Create items on ordering: 1 item should be linked to new order after receiving" >+); >+ > CancelReceipt($new_ordernumber); > >-is(scalar( GetItemnumbersFromOrder($ordernumber) ), 2, "Create items on ordering: items are not deleted after cancelling a receipt"); >+is( >+ scalar( GetItemnumbersFromOrder($new_ordernumber) ), >+ 0, >+ "Create items on ordering: no item should be linked to the cancelled order" >+); >+is( >+ scalar( GetItemnumbersFromOrder( $order->{ordernumber} ) ), >+ 2, >+ "Create items on ordering: items are not deleted after cancelling a receipt" >+); > > my $item1 = C4::Items::GetItem( $itemnumber1 ); > is( $item1->{notforloan}, 9, "The notforloan value has been updated with '9'" ); >-- >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 13319
:
33775
|
34686
| 34702