Bugzilla – Attachment 87560 Details for
Bug 22390
When duplicating existing order lines new items are not created
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22390: (bug 15184 follow-up) Use aqorders.subscriptionid instead of biblio.serial
Bug-22390-bug-15184-follow-up-Use-aqorderssubscrip.patch (text/plain), 4.49 KB, created by
Katrin Fischer
on 2019-04-08 21:52:31 UTC
(
hide
)
Description:
Bug 22390: (bug 15184 follow-up) Use aqorders.subscriptionid instead of biblio.serial
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-04-08 21:52:31 UTC
Size:
4.49 KB
patch
obsolete
>From 4a6e94450aa6ef37b59f3473d629f8c70729da73 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Feb 2019 14:48:24 -0300 >Subject: [PATCH] Bug 22390: (bug 15184 follow-up) Use aqorders.subscriptionid > instead of biblio.serial > >It seems that we made a wrong assumption on bug 15184, see > commit d658cb6f7ecb18845a78d4708ee63ad1126f220f > Bug 15184: Do copy items for not a serial OR if items are created on ordering > >To know if an order has been created from a subscription we should check >$order->subscriptionid instead of the $biblio->serial flag > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Acquisition/Order.pm | 2 +- > t/db_dependent/Koha/Acquisition/Order.t | 73 ++++++++++++++++++++++++++++++++- > 2 files changed, 73 insertions(+), 2 deletions(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index da1e5ac7bd..2b62760415 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -248,7 +248,7 @@ sub duplicate_to { > > $new_order = Koha::Acquisition::Order->new($order_info)->store; > >- if ( not $self->biblio->serial || $self->basket->effective_create_items eq 'ordering') { # Do copy items if not a serial OR if items are created on ordering >+ if ( ! $self->subscriptionid || $self->basket->effective_create_items eq 'ordering') { # Do copy items if not a serial OR if items are created on ordering > my $items = $self->items; > while ( my ($item) = $items->next ) { > my $item_info = $item->unblessed; >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 75d369aae3..9968c8bed3 100644 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -172,3 +172,74 @@ subtest 'subscription' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'duplicate_to | add_item' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $item = $builder->build_sample_item; >+ my $order_no_sub = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => >+ { >+ biblionumber => $item->biblionumber, >+ subscriptionid => undef, # not linked to a subscription >+ } >+ } >+ ); >+ $order_no_sub->basket->create_items(undef)->store; # use syspref >+ $order_no_sub->add_item( $item->itemnumber ); >+ >+ $item = $builder->build_sample_item; >+ my $order_from_sub = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => >+ { >+ biblionumber => $item->biblionumber, >+ # Will be linked to a subscription by TestBuilder >+ } >+ } >+ ); >+ $order_from_sub->basket->create_items(undef)->store; # use syspref >+ $order_from_sub->add_item( $item->itemnumber ); >+ >+ my $basket_to = $builder->build_object( >+ { class => 'Koha::Acquisition::Baskets' }); >+ >+ subtest 'Create item on receiving' => sub { >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_preference('AcqCreateItem', 'receiving'); >+ >+ my $duplicated_order = $order_no_sub->duplicate_to($basket_to); >+ is( $duplicated_order->items->count, 1, >+ 'Items should be copied if the original order is not created from a subscription' >+ ); >+ >+ $duplicated_order = $order_from_sub->duplicate_to($basket_to); >+ is( $duplicated_order->items->count, 0, >+ 'Items should not be copied if the original order is created from a subscription' >+ ); >+ }; >+ >+ subtest 'Create item on ordering' => sub { >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_preference('AcqCreateItem', 'ordering'); >+ >+ my $duplicated_order = $order_no_sub->duplicate_to($basket_to); >+ is( $duplicated_order->items->count, 1, >+ 'Items should be copied if items are created on ordering' >+ ); >+ >+ $duplicated_order = $order_from_sub->duplicate_to($basket_to); >+ is( $duplicated_order->items->count, 1, >+ 'Items should be copied if items are created on ordering, even if created from subscription' >+ ); >+ }; >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.11.0
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 22390
:
85473
|
86027
|
86523
|
86524
| 87560 |
87561