From d6122ff78d4344441ed45ceb26ed09af83a15d15 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 4 Mar 2019 16:07:22 -0300 Subject: [PATCH] Bug 22390: Never copy items if original order has been created from a subscription Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Tiny change to the code comment: serial => subscription order Signed-off-by: Nick Clemens --- Koha/Acquisition/Order.pm | 2 +- t/db_dependent/Koha/Acquisition/Order.t | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm index 2b62760415..9bba0faef2 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 ( ! $self->subscriptionid || $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 subscription order AND 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 9968c8bed3..a13f9c5edc 100644 --- a/t/db_dependent/Koha/Acquisition/Order.t +++ b/t/db_dependent/Koha/Acquisition/Order.t @@ -215,8 +215,8 @@ subtest 'duplicate_to | add_item' => sub { 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' + is( $duplicated_order->items->count, 0, + 'Items should not be copied if the original order did not create items on ordering' ); $duplicated_order = $order_from_sub->duplicate_to($basket_to); @@ -236,8 +236,8 @@ subtest 'duplicate_to | add_item' => sub { ); $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' + is( $duplicated_order->items->count, 0, + 'Items should never be copied if the original order is created from a subscription' ); }; -- 2.39.5