Bug 25473: Move JavaScript out of the footer of addorderiso2709.tt
authorOwen Leonard <oleonard@myacpl.org>
Thu, 14 May 2020 11:47:51 +0000 (11:47 +0000)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Fri, 12 Jun 2020 21:20:55 +0000 (23:20 +0200)
This patch undoes the move of the JavaScript block to the footer made in
Bug 22734. The item information tab can include embedded JavaScript for
cataloging plugins, and these don't currently work with JS in the
footer.

To test, apply the patch and test the JavaScript driven features of the
"Add to basket from a staged file" page:

- Acquisitions -> Vendor -> Basket -> Add to basket from a staged file
  - MARC and Card previews, select all/clear all
  - Item information tab: Cataloging plugins for fields like
    date acquired, barcode
  - Default accounting details tab: Show inactive control

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 9e665fb9a753032fed711959f1d8cc5780655b8c)

(cherry picked from commit 04fc143d25f743b9d58c6fd1f28ba1d9cd0216cb)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt

index a522f70..0e07f20 100644 (file)
@@ -2,7 +2,6 @@
 [% USE Asset %]
 [% USE KohaDates %]
 [% USE Branches %]
-[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; Order staged MARC records
 [% IF ( batch_details ) %]
 </title>
 <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
 [% INCLUDE 'doc-head-close.inc' %]
+[%# As long as cataloging plugins rely on <script> tags added inline, JS must be in the header %]
+[% Asset.js("js/acquisitions-menu.js") | $raw %]
+[% INCLUDE 'datatables.inc' %]
+[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
+[% Asset.js("js/acq.js") | $raw %]
+[% Asset.js("js/funds_sorts.js") | $raw %]
+[% Asset.js("js/addorderiso2709.js") | $raw %]
+<script>
+    var ERR_NO_RECORD_SELECTED = _("There is no record selected");
+    var ERR_INVALID_QUANTITY = _("quantity values are not filled in or are not numbers");
+    var ERR_FUNDS_MISSING = _("Some budgets are not defined in item records");
+    var MSG_LOADING = _("Loading");
+</script>
 </head>
 
 <body id="acq_addorderiso2709" class="acq">
             </div> [% # /div.col-sm-6 %]
        </div> [% # /div.row %]
 
-
-[% MACRO jsinclude BLOCK %]
-    [% Asset.js("js/acquisitions-menu.js") | $raw %]
-    [% INCLUDE 'datatables.inc' %]
-    [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
-    [% Asset.js("js/acq.js") | $raw %]
-    [% Asset.js("js/funds_sorts.js") | $raw %]
-    [% Asset.js("js/addorderiso2709.js") | $raw %]
-    <script>
-        var ERR_NO_RECORD_SELECTED = _("There is no record selected");
-        var ERR_INVALID_QUANTITY = _("quantity values are not filled in or are not numbers");
-        var ERR_FUNDS_MISSING = _("Some budgets are not defined in item records");
-        var MSG_LOADING = _("Loading");
-    </script>
-[% END %]
-
 [% INCLUDE 'intranet-bottom.inc' %]