From 9e5f59121027fe75eef530cce236f50810cfe609 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Mon, 15 Jul 2019 18:01:25 +0000
Subject: [PATCH] Bug 23320 - Removed unused close parameter in neworderempty
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

To test:
 1 - Add to basket
 2 - Note the options on the page
 3 - Add &close=1 to the url
 4 - Note some inputs are disabled
 5 - Save anyway, note it is a regular order
 6 - Add another order to basket
 7 - Save it
 8 - Modify
 9 - Add close to the url again
10 - Save changes
11 - No functional change
12 - Apply patch
13 - Note close parameter has no effect now
14 - Confirm you can place and confirm orders as before

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
---
 acqui/neworderempty.pl                             | 15 +---
 .../prog/en/modules/acqui/neworderempty.tt         | 98 +++++++---------------
 2 files changed, 30 insertions(+), 83 deletions(-)

diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl
index 862719b..a10bf46 100755
--- a/acqui/neworderempty.pl
+++ b/acqui/neworderempty.pl
@@ -60,8 +60,6 @@ if this order comes from a suggestion.
 =item breedingid
 the item's id in the breeding reservoir
 
-=item close
-
 =back
 
 =cut
@@ -106,7 +104,6 @@ my $ordernumber          = $input->param('ordernumber') || '';
 our $biblionumber    = $input->param('biblionumber');
 our $basketno        = $input->param('basketno');
 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 $from_subscriptionid  = $input->param('from_subscriptionid');
@@ -338,11 +335,6 @@ foreach my $r (@{$budgets}) {
     };
 }
 
-if ($close) {
-    $budget_id      =  $data->{'budget_id'};
-    $budget_name    =   $budget->{'budget_name'};
-
-}
 
 $template->param( sort1 => $data->{'sort1'} );
 $template->param( sort2 => $data->{'sort2'} );
@@ -394,12 +386,6 @@ if ( defined $from_subscriptionid ) {
 # Find the items.barcode subfield for barcode validations
 my (undef, $barcode_subfield) = GetMarcFromKohaField( 'items.barcode' );
 
-# fill template
-$template->param(
-    close        => $close,
-    budget_id    => $budget_id,
-    budget_name  => $budget_name
-) if ($close);
 
 # get option values for gist syspref
 my @gst_values = map {
@@ -411,6 +397,7 @@ my $quantity = $input->param('rr_quantity_to_order') ?
       $data->{'quantity'};
 $quantity //= 0;
 
+# fill template
 $template->param(
     existing         => $biblionumber,
     ordernumber           => $ordernumber,
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
index 04a41a9..c2d0a1c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
@@ -299,28 +299,23 @@
         <legend>Accounting details</legend>
         <ol>
             <li>
-                [% IF ( close ) %]
-                    <span class="label required">Quantity: </span>
-                    <input type="hidden" name="quantity" value="[% quantity | html %]" />[% quantity | html %]
+                <label class="required" for="quantity">Quantity: </label>
+                [% IF subscriptionid %]
+                    <input type="text" size="20" id="quantity" name="quantity" value="1" onchange="updateCosts();" />
+                [% ELSIF AcqCreateItemOrdering %]
+                    [% IF basket.is_standing %]
+                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
+                    [% ELSE %]
+                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
+                    [% END %]
                 [% ELSE %]
-                    <label class="required" for="quantity">Quantity: </label>
-                    [% IF subscriptionid %]
-                        <input type="text" size="20" id="quantity" name="quantity" value="1" onchange="updateCosts();" />
-                    [% ELSIF AcqCreateItemOrdering %]
-                        [% IF basket.is_standing %]
-                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
-                        [% ELSE %]
-                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
-                        [% END %]
+                    [% IF basket.is_standing %]
+                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
                     [% ELSE %]
-                        [% IF basket.is_standing %]
-                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
-                        [% ELSE %]
-                            <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec | html %]" onchange="updateCosts();" />
-                        [% END %]
+                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec | html %]" onchange="updateCosts();" />
                     [% END %]
-                    <span class="required">Required</span>
                 [% END %]
+                <span class="required">Required</span>
                 <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order -->
                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
 
@@ -335,10 +330,6 @@
                 [% END %]
             </li>
             <li>
-                [% IF ( close ) %]
-            <span class="label required">Fund: </span>
-                    <input type="hidden" name="budget_id" id="budget_id" value="[% budget_id | html %]" />[% Budget_name | html %]
-                [% ELSE %]
                 <label class="required" for="budget_id">Fund: </label>
                 [% active_count = 0 %]
                 [% IF !ordernumber %]
@@ -364,20 +355,15 @@
                                 style="padding-left:[% budget_loo.b_level | html %]em;"
                         >
                     [% END %]
-                    [% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
+                        [% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %]
                     </option>
                 [% END %]
                 </select>
                 <span class="required">Required</span>
                 <label for="showallbudgets" style="float:none;">&nbsp;Show inactive:</label>
                 <input type="checkbox" id="showallbudgets" />
-                [% END %]
             </li>
 		<li>
-                [% IF ( close ) %]
-			<span class="label">Currency: </span>
-            <input type="hidden" name="currency" id="currency" value="[% currency | html %]" />[% currency | html %]
-                [% ELSE %]
 			<label for="currency">Currency:</label>
             <select name="currency" id="currency" onchange="updateCosts();">
                 [% FOREACH c IN currencies %]
@@ -388,18 +374,11 @@
                     [% END %]
                 [% END %]
             </select>
-		[% END %]
                 </li>
             <li>
-                [% IF ( close ) %]
-                    <span class="label">Vendor price: </span>
-                    <input type="hidden" name="listprice" id="listprice" value="[% listprice | html %]" />[% listprice | html %] [% IF (listincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]
-                [% ELSE %]
                 <label for="listprice">Vendor price: </label>
                     <input type="text" size="20" name="listprice" id="listprice" value="[% listprice | html %]" onchange="updateCosts()" /> [% IF (listincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]
-                [% END %]
             </li>
-            [% UNLESS ( close ) %]
             <li>
                     <label for="uncertainprice">Uncertain price: </label>
                     [% IF ( uncertainprice ) %]
@@ -408,52 +387,33 @@
                     <input type="checkbox" name="uncertainprice" id="uncertainprice" value="1" />
                 [% END %]
             </li>
-            [% END %]
             [% IF ( gst_values ) %]
                 <li>
-                    [% IF ( close ) %]
-                        <span class="label">Tax rate: </span>
-                        <input type="hidden" name="tax_rate" id="tax_rate" value="[% tax_rate | html %]" />[% tax_rate | html %]%
-                    [% ELSE %]
-                        <label for="tax_rate">Tax rate: </label>
-                        <select name="tax_rate" id="tax_rate" onchange="updateCosts();">
-                        [% FOREACH gst IN gst_values %]
-                          [% IF ( gst.option == tax_rate ) %]
-                            <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
-                          [% ELSE %]
-                            <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
-                          [% END %]
-                        [% END %]
-                        </select>
+                    <label for="tax_rate">Tax rate: </label>
+                    <select name="tax_rate" id="tax_rate" onchange="updateCosts();">
+                    [% FOREACH gst IN gst_values %]
+                      [% IF ( gst.option == tax_rate ) %]
+                        <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
+                      [% ELSE %]
+                        <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
+                      [% END %]
                     [% END %]
-                [% ELSE %]
+                    </select>
+            [% ELSE %]
                     <input type="hidden" name="tax_rate" value="0" />
                 </li>
             [% END %]
             <li>
                 <label for="discount">Discount: </label>
-                [% IF ( close ) %]
-                    [% IF ( orderdiscount ) %]
-                        <input type="hidden" name="discount" id="discount" value="[% orderdiscount | html %]" />[% orderdiscount_2dp | html %]%
-                    [% ELSE %]
-                        <input type="hidden" name="discount" id="discount" value="[% discount | html %]" />[% discount_2dp | html %]%
-                    [% END %]
+                [% IF ( orderdiscount ) %]
+                    <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount | html %]" onchange="updateCosts();" />%
                 [% ELSE %]
-                    [% IF ( orderdiscount ) %]
-                        <input type="text" size="6" name="discount" id="discount" value="[% orderdiscount | html %]" onchange="updateCosts();" />%
-                    [% ELSE %]
-                        <input type="text" size="6" name="discount" id="discount" value="[% discount | html %]" onchange="updateCosts();" />%
-                    [% END %]
+                    <input type="text" size="6" name="discount" id="discount" value="[% discount | html %]" onchange="updateCosts();" />%
                 [% END %]
             </li>
             <li>
-                [% IF ( close ) %]
-                    <span class="label">Retail price: </span>
-                    <input type="hidden" name="rrp" id="rrp" value="[% rrp | html %]" />[% rrp | html %]  (adjusted for [% cur_active | html %], [% IF (listincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])
-                [% ELSE %]
-                    <label for="rrp">Retail price: </label>
-                    <input type="text" size="20" name="rrp" id="rrp" value="[% rrp | html %]" /> (adjusted for [% cur_active | html %], [% IF (listincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])
-                [% END %]
+                <label for="rrp">Retail price: </label>
+                <input type="text" size="20" name="rrp" id="rrp" value="[% rrp | html %]" /> (adjusted for [% cur_active | html %], [% IF (listincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])
             </li>
             <li>
                 <label for="replacementprice">Replacement cost: </label>
-- 
2.7.4