Browse Source

Bug 22390: Never copy items if original order has been created from a subscription

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Tiny change to the code comment: serial => subscription order

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
19.05.x
Jonathan Druart 5 years ago
committed by Nick Clemens
parent
commit
d6122ff78d
  1. 2
      Koha/Acquisition/Order.pm
  2. 8
      t/db_dependent/Koha/Acquisition/Order.t

2
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;

8
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'
);
};

Loading…
Cancel
Save