From bc88c1f17264bda842a6fbfbe555b663939a5c13 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Mon, 16 Apr 2018 17:41:42 -0300
Subject: [PATCH] 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
---
 acqui/neworderempty.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl
index 54feb36f40..050f4072e4 100755
--- a/acqui/neworderempty.pl
+++ b/acqui/neworderempty.pl
@@ -262,6 +262,12 @@ else {    #modify order
     $biblionumber = $data->{'biblionumber'};
     $budget_id = $data->{'budget_id'};
 
+    # We do not want to modify $subscriptionid here
+    # Otherwise prices and notes will be reset with previous orders
+    $template->param(
+        subscriptionid => $data->{subscriptionid},
+    );
+
     $basket   = GetBasket( $data->{'basketno'} );
     $basketno = $basket->{'basketno'};
 
-- 
2.11.0