From 8bdfc52d36bee589dc7c04f62536bb14efbcab28 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Tue, 22 Oct 2019 14:07:46 -0400
Subject: [PATCH] Bug 23863: Editing a basket clears create_items value

Test Plan:
1) Create a basket with a non-default value for aqbasket.create_items
2) Click Edit from basket.pl
3) Click Save without changing anything
4) Note that aqbasket.create_items is no longer set
5) Apply this patch
6) Restart all the things!
7) Repeat steps 1-3
8) Note create_items is unchanged!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
---
 acqui/basketheader.pl                                         | 1 +
 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl
index 202f6b9079..0eb479ff20 100755
--- a/acqui/basketheader.pl
+++ b/acqui/basketheader.pl
@@ -131,6 +131,7 @@ if ( $op eq 'add_form' ) {
                     basketno => $basketno,
                     booksellers => \@booksellers,
                     is_standing => $basket->{is_standing},
+                    create_items => $basket->{create_items},
     );
 
     my $billingplace = $basket->{'billingplace'} || C4::Context->userenv->{"branch"};
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt
index f6a89c7dd7..4b87af45bb 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt
@@ -110,7 +110,9 @@
                     [% END %]
                     <div class="hint">Standing orders do not close when received.</div>
                 </li>
-                [% UNLESS basketno %]
+                [% IF basketno %]
+                    <input type="hidden" name="create_items" value="[% create_items %]" />
+                [% ELSE %]
                  <li>
                     <label for="create_items">Create items when:</label>
                     <select name="create_items" id="create_items">
-- 
2.11.0