Bug 19030: Preserve link between order and subscription when editing an order

The aqorders.subscriptionid info is not sent to the template when the
order is edited. Which means we lose this link.

Test plan:
Create an order from a subscription
Edit the order
=> Without this patch, the aqorders.subscriptionid value is set to NULL
and items are created when receiving serial.

=> With this patch applied the link is preserved and expected behaviors
are preserved during all the acquisition workflow

You should also try and create several orders from the same subscription

Sponsored-by: BULAC - http://www.bulac.fr/

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4df24fdde1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2018-04-16 17:41:42 -03:00 committed by Fridolin Somers
parent 8b19de7bc3
commit 84fca5c20e
2 changed files with 10 additions and 5 deletions

View File

@ -104,7 +104,7 @@ my $suggestionid = $input->param('suggestionid');
my $close = $input->param('close');
my $uncertainprice = $input->param('uncertainprice');
my $import_batch_id = $input->param('import_batch_id'); # if this is filled, we come from a staged file, and we will return here after saving the order !
my $subscriptionid = $input->param('subscriptionid');
my $from_subscriptionid = $input->param('from_subscriptionid');
my $data;
my $new = 'no';
@ -193,6 +193,10 @@ else { #modify order
$biblionumber = $data->{'biblionumber'};
$budget_id = $data->{'budget_id'};
$template->param(
subscriptionid => $data->{subscriptionid},
);
$basket = GetBasket( $data->{'basketno'} );
$basketno = $basket->{'basketno'};
@ -257,8 +261,8 @@ if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
my @itemtypes;
@itemtypes = Koha::ItemTypes->search unless C4::Context->preference('item-level_itypes');
if ( defined $subscriptionid ) {
my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $subscriptionid;
if ( defined $from_subscriptionid ) {
my $lastOrderReceived = GetLastOrderReceivedFromSubscriptionid $from_subscriptionid;
if ( defined $lastOrderReceived ) {
$budget_id = $lastOrderReceived->{budgetid};
$data->{listprice} = $lastOrderReceived->{listprice};
@ -276,6 +280,8 @@ if ( defined $subscriptionid ) {
$basket = GetBasket( $input->param('basketno') );
}
$template->param( subscriptionid => $from_subscriptionid );
}
# Find the items.barcode subfield for barcode validations
@ -356,7 +362,6 @@ $template->param(
publishercode => $data->{'publishercode'},
barcode_subfield => $barcode_subfield,
import_batch_id => $import_batch_id,
subscriptionid => $subscriptionid,
acqcreate => C4::Context->preference("AcqCreateItem") eq "ordering" ? 1 : "",
users_ids => join(':', @order_user_ids),
users => \@order_users,

View File

@ -98,7 +98,7 @@
[% IF (sub.alreadyOnOrder) %]
Outstanding order (only one order per subscription is allowed)
[% ELSIF not sub.aqbooksellerid || booksellerid == sub.aqbooksellerid%]
<a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;biblionumber=[% sub.biblionumber %]&amp;subscriptionid=[% sub.subscriptionid %]" title="Order this one">
<a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;biblionumber=[% sub.biblionumber %]&amp;from_subscriptionid=[% sub.subscriptionid %]" title="Order this one">
Order
</a>
[% ELSE %]