From 1582138b0e2a7dccc87dec05fa66616dddf94575 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Wed, 16 Nov 2022 12:08:56 +0000
Subject: [PATCH] Bug 32046: When adding a new records from a staged files,
 there are style issues

This patch modifies the template for adding a record from a staged file
in order to resolve some layout problems introduced by the staff
redesign.

This patch also corrects an problem with addorderiso2709.js: It included
some template markup. The template variables are converted to a JS
variable to prevent a JS error.

Note that the QA tool's js_in_body error is invalid for this template
which requires that the JS stay inside <head>.

To test you must have at least one MARC file staged for import.

- Apply the patch and go to Acquisitions.
- Locate a vendor and create a basket if necessary.
- Add to the basket and choose the option of adding an order from a
  staged file.
- Click "Add orders" next to one of the staged files.
- On the Add orders from MARC file page, test that everything looks
  correct and works correctly:
  - In the first tab, expanding and collapsing order details by checking
    the checkbox or clicking the title.
  - Test the "MARC" and "Card" preview buttons.
  - Under the Item information tab, confirm that the layout looks
    correct and that the form works correctly, including plugin
    operations like auto barcode fill.
  - Test that, under the Default accounting details tab, changing the
    fund automatically sets the fund for each title in the first tab.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 .../prog/css/src/staff-global.scss            |   3 +
 .../prog/en/modules/acqui/addorderiso2709.tt  | 539 +++++++++---------
 .../intranet-tmpl/prog/js/addorderiso2709.js  |  12 +-
 3 files changed, 287 insertions(+), 267 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
index 054b6bf3a8..f739d19071 100644
--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
@@ -2105,6 +2105,9 @@ li {
 }
 
 td {
+    &.actions {
+        white-space: nowrap;
+    }
     &.bookcoverimg {
         background: #FFF url("../img/spinner-small.gif") center center no-repeat;
         min-width: 120px;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
index 77fbe6e770..ada220608c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
@@ -10,9 +10,13 @@
     Batch list
 [% END %] &rsaquo; Order staged MARC records &rsaquo; Acquisitions &rsaquo; Koha
 </title>
-<style>@media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
+[% Asset.css("css/addbiblio.css") | $raw %]
+<style>.biblio { padding: 0 .5em;margin:0; }@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 %]
+<script>
+    const template_path = "[% interface | html %]/[% theme | html %]";
+</script>
 [% Asset.js("js/acquisitions-menu.js") | $raw %]
 [% INCLUDE 'datatables.inc' %]
 [% Asset.js("js/acq.js") | $raw %]
@@ -51,7 +55,7 @@
 
     <div class="container-fluid">
         <div class="row">
-            <div class="col-sm-6 col-sm-offset-3 col-md-8 col-md-offset-2">
+            <div class="col-md-10 col-md-offset-1">
                 [% IF ( allmatch ) %]
                     <div class="dialog alert">
                         <h4>No records imported</h4>
@@ -112,228 +116,237 @@
                                     <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
                                     <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
 
-                                    [% FOREACH biblio IN import_biblio_list %]
-                                        <fieldset class="biblio unselected rows" style="float:none;">
-                                            <legend>
-                                                <label for="record_[% biblio.import_record_id | html %]" style="width:auto;">
-                                                    <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id | html %]" value="[% biblio.import_record_id | html %]" />
-                                                    <span class="citation">
-                                                        [%- biblio.import_biblio.title | html -%]
-                                                         [% biblio.import_biblio.author | html -%]
-                                                        [% IF (biblio.import_biblio.isbn || biblio.import_biblio.issn) -%]
-                                                            ([%- biblio.import_biblio.isbn | html -%]
-                                                            [%- IF (biblio.import_biblio.isbn && biblio.import_biblio.issn ) %] & [%- END -%]
-                                                            [%- biblio.import_biblio.issn | html %])
-                                                        [%- END -%]
-                                                    </span>
-                                                </label>
-                                                <span class="links" style="font-weight: normal;">
-                                                    ( <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id | uri %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% biblio.import_record_id | html %]" class="previewData">Card</a> | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]&amp;breedingid=[% biblio.import_record_id | html %]&amp;import_batch_id=[% biblio.import_batch_id | html %]&amp;biblionumber=[% biblio.match_biblionumber | html %]">Add order</a> )
-                                                </span>
-                                            </legend>
-                                            <div style="float:left">
-                                                <ol>
-                                                    <li class="status">
-                                                        <span class="match">
-                                                            [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
-                                                            <span>No match</span>
-                                                            [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
-                                                            <span>Match applied</span>
-                                                            [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
-                                                            <span>Match found</span>
-                                                            [% ELSE %]
-                                                                [% biblio_lis.overlay_status | html %]
-                                                            [% END %]
-                                                            [% IF ( biblio.match_biblionumber ) %]
-                                                            <span>Matches biblio [% biblio.match_biblionumber | uri %]</span> (score = [% biblio.match_score | html %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.match_biblionumber | uri %]">[% biblio.match_citation | html %]</a>
-                                                            [% END %]
-                                                        </span>
-                                                    </li>
-                                                    <li class="quantity">
-                                                        <label for="quantity_record_[% biblio.import_record_id | html %]" class="required">Quantity: </label>
-                                                        <input id="quantity_record_[% biblio.import_record_id | html %]" type="text" pattern="[0-9]+" value="[% biblio.quantity.length ? biblio.quantity : 1 | html %]" name="quantity" />
-                                                        <span class="required">Required</span>
-                                                    </li>
-                                                    <li class="price">
-                                                        <label for="price_record_[% biblio.import_record_id | html %]">Price: </label>
-                                                        <input id="price_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.price | html %]" name="price" />
-                                                    </li>
-                                                    <li class="replacementprice">
-                                                        <label for="replacementprice_record_[% biblio.import_record_id | html %]">Replacement price: </label>
-                                                        <input id="replacementprice_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.replacementprice | html %]" name="replacementprice" />
-                                                    </li>
-                                                    <li class="discount">
-                                                        <label for="discount_record_[% biblio.import_record_id | html %]">Discount: </label>
-                                                        <input id="discount_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.discount | html %]" name="discount" size="6" /> %
-                                                        <div class="hint">If empty, discount rate from vendor will be used</div>
-                                                    </li>
-                                                    <li class="fund">
-                                                        [% IF ( close ) %]
-                                                            <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
-                                                            <input type="hidden" size="20" name="budget_id" value="[% budget_id | html %]" />[% Budget_name | html %]
-                                                        [% ELSE %]
-                                                            <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
-                                                            <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id">
-                                                                <option value="">Select a fund (will use default if set)</option>
-                                                                [% FOREACH budget IN budget_loop %]
-                                                                    [% IF ( budget.b_id == biblio.budget_id ) %]
-                                                                    [% IF budget.b_active %]
-                                                                        <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" selected="selected">[% budget.b_txt | html %]</option>
-                                                                    [% ELSE %]
-                                                                    <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" selected="selected">[% budget.b_txt | html %] (inactive)</option>
-                                                                [% END %]
-                                                                [% ELSE %]
-                                                                    [% IF budget.b_active %]<option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %]</option>
-                                                                    [% ELSE %]<option value="[% budget.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %] (inactive)</option>
-                                                                    [% END %]
-                                                                    [% END %]
-                                                                [% END %]
-                                                            </select>
-                                                            <span class="required" style="display:none">Required</span>
-                                                        [% END %]
-                                                    </li>
-                                                    <li class="sort1">
-                                                        <label for="sort1_record_[% biblio.import_record_id | html %]">Statistic 1: </label>
-                                                        <input id="sort1_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort1" value="[% biblio.sort1 | html %]" />
-                                                    </li>
-                                                    <li class="sort2">
-                                                        <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label>
-                                                        <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2" value="[% biblio.sort2 | html %]" />
-                                                    </li>
-                                                </ol>
-                                            </div>
-                                            <div style="float:right">
-                                                [% IF biblio.item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
-                                                [% FOREACH item IN biblio.iteminfos %]
-                                                    <fieldset>
-                                                        <legend>Item record [% item.item_id | html %]</legend>
-                                                        <ol>
-                                                            <li>
-                                                                <label for="homebranch_item_[% item.item_id | html %]">homebranch</label>
-                                                                <select id="homebranch_item_[% item.item_id | html %]" name="homebranch_[% item.biblio_count | html %]">
-                                                                    [% FOREACH l IN libraries %]
-                                                                        [% IF l.branchcode == item.homebranch %]
-                                                                            <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
-                                                                        [% ELSE %]
-                                                                            <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
-                                                                        [% END %]
-                                                                    [% END %]
-                                                                </select>
-                                                            </li>
-
-                                                            <li>
-                                                                <label for="holdingbranch_item_[% item.item_id | html %]">holdingbranch</label>
-                                                                <select id="holdingbranch_item_[% item.item_id | html %]" name="holdingbranch_[% item.biblio_count | html %]">
-                                                                    [% FOREACH l IN libraries %]
-                                                                        [% IF l.branchcode == item.holdingbranch %]
-                                                                            <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
+                                    <table class="biblio unselected dataTable">
+                                        <tbody>
+                                            [% FOREACH biblio IN import_biblio_list %]
+                                                <tr>
+                                                    <td>
+                                                        <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id | html %]" value="[% biblio.import_record_id | html %]" />
+                                                    </td>
+                                                    <td>
+                                                        <label for="record_[% biblio.import_record_id | html %]">
+                                                            <span class="title citation">
+                                                                [%- biblio.import_biblio.title | html -%]
+                                                                [% biblio.import_biblio.author | html -%]
+                                                                [% IF (biblio.import_biblio.isbn || biblio.import_biblio.issn) -%]
+                                                                    ([%- biblio.import_biblio.isbn | html -%]
+                                                                    [%- IF (biblio.import_biblio.isbn && biblio.import_biblio.issn ) %] & [%- END -%]
+                                                                    [%- biblio.import_biblio.issn | html %])
+                                                                [%- END -%]
+                                                            </span>
+                                                        </label>
+                                                        <fieldset class="rows order_details">
+                                                            <ol>
+                                                                <li class="status">
+                                                                    <span class="label">Match:</span>
+                                                                    <span class="match">
+                                                                        [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
+                                                                        <span>No match</span>
+                                                                        [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
+                                                                        <span>Match applied</span>
+                                                                        [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
+                                                                        <span>Match found</span>
                                                                         [% ELSE %]
-                                                                            <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
+                                                                            [% biblio_lis.overlay_status | html %]
                                                                         [% END %]
-                                                                    [% END %]
-                                                                </select>
-                                                            </li>
-                                                            <li>
-                                                                <label for="itype_item_[% item.item_id | html %]">itype</label>
-                                                                <select id="itype_item_[% item.item_id | html %]" name="itype_[% item.biblio_count | html %]">
-                                                                    [% FOREACH itemtype IN itemtypes %]
-                                                                        [% IF itemtype.itemtype == item.itype %]
-                                                                            <option value="[% itemtype.itemtype | html %]" selected="selected">[% itemtype.description | html %]</option>
-                                                                        [% ELSE %]
-                                                                            <option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
+                                                                        [% IF ( biblio.match_biblionumber ) %]
+                                                                        <span>Matches biblio [% biblio.match_biblionumber | uri %]</span> (score = [% biblio.match_score | html %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.match_biblionumber | uri %]">[% biblio.match_citation | html %]</a>
                                                                         [% END %]
+                                                                    </span>
+                                                                </li>
+                                                                <li class="quantity">
+                                                                    <label for="quantity_record_[% biblio.import_record_id | html %]" class="required">Quantity: </label>
+                                                                    <input id="quantity_record_[% biblio.import_record_id | html %]" type="text" pattern="[0-9]+" value="[% biblio.quantity.length ? biblio.quantity : 1 | html %]" name="quantity" />
+                                                                    <span class="required">Required</span>
+                                                                </li>
+                                                                <li class="price">
+                                                                    <label for="price_record_[% biblio.import_record_id | html %]">Price: </label>
+                                                                    <input id="price_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.price | html %]" name="price" />
+                                                                </li>
+                                                                <li class="replacementprice">
+                                                                    <label for="replacementprice_record_[% biblio.import_record_id | html %]">Replacement price: </label>
+                                                                    <input id="replacementprice_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.replacementprice | html %]" name="replacementprice" />
+                                                                </li>
+                                                                <li class="discount">
+                                                                    <label for="discount_record_[% biblio.import_record_id | html %]">Discount: </label>
+                                                                    <input id="discount_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.discount | html %]" name="discount" size="6" /> %
+                                                                    <div class="hint">If empty, discount rate from vendor will be used</div>
+                                                                </li>
+                                                                <li class="fund">
+                                                                    [% IF ( close ) %]
+                                                                        <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
+                                                                        <input type="hidden" size="20" name="budget_id" value="[% budget_id | html %]" />[% Budget_name | html %]
+                                                                    [% ELSE %]
+                                                                        <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
+                                                                        <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id">
+                                                                            <option value="">Select a fund (will use default if set)</option>
+                                                                            [% FOREACH budget IN budget_loop %]
+                                                                                [% IF ( budget.b_id == biblio.budget_id ) %]
+                                                                                [% IF budget.b_active %]
+                                                                                    <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" selected="selected">[% budget.b_txt | html %]</option>
+                                                                                [% ELSE %]
+                                                                                <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" selected="selected">[% budget.b_txt | html %] (inactive)</option>
+                                                                            [% END %]
+                                                                            [% ELSE %]
+                                                                                [% IF budget.b_active %]<option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %]</option>
+                                                                                [% ELSE %]<option value="[% budget.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %] (inactive)</option>
+                                                                                [% END %]
+                                                                                [% END %]
+                                                                            [% END %]
+                                                                        </select>
+                                                                        <span class="required" style="display:none">Required</span>
                                                                     [% END %]
-                                                                </select>
-                                                            </li>
+                                                                </li>
+                                                                <li class="sort1">
+                                                                    <label for="sort1_record_[% biblio.import_record_id | html %]">Statistic 1: </label>
+                                                                    <input id="sort1_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort1" value="[% biblio.sort1 | html %]" />
+                                                                </li>
+                                                                <li class="sort2">
+                                                                    <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label>
+                                                                    <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2" value="[% biblio.sort2 | html %]" />
+                                                                </li>
+                                                            </ol>
+                                                        </fieldset>
+                                                        <div style="float:right">
+                                                            [% IF biblio.item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
+                                                            [% FOREACH item IN biblio.iteminfos %]
+                                                                <fieldset>
+                                                                    <legend>Item record [% item.item_id | html %]</legend>
+                                                                    <ol>
+                                                                        <li>
+                                                                            <label for="homebranch_item_[% item.item_id | html %]">homebranch</label>
+                                                                            <select id="homebranch_item_[% item.item_id | html %]" name="homebranch_[% item.biblio_count | html %]">
+                                                                                [% FOREACH l IN libraries %]
+                                                                                    [% IF l.branchcode == item.homebranch %]
+                                                                                        <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
+                                                                                    [% ELSE %]
+                                                                                        <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
+                                                                                    [% END %]
+                                                                                [% END %]
+                                                                            </select>
+                                                                        </li>
 
-                                                            <li>
-                                                                <label for="nonpublic_note_item_[% item.item_id | html %]">nonpublic_note</label>
-                                                                <input type="text" id="nonpublic_note_item_[% item.item_id | html %]" name="nonpublic_note_[% item.biblio_count | html %]" value="[% item.nonpublic_note | html %]">
-                                                            </li>
-                                                            <li>
-                                                                <label for="public_note_item_[% item.item_id | html %]">public_note</label>
-                                                                <input type="text" id="public_note_item_[% item.item_id | html %]" name="public_note_[% item.biblio_count | html %]" value="[% item.public_note | html %]">
-                                                            </li>
-                                                            <li>
-                                                                <label for="loc_item_[% item.item_id | html %]">loc</label>
-                                                                <select id="loc_item_[% item.item_id | html %]" name="loc_[% item.biblio_count | html %]">
-                                                                    <option value=""> </option>
-                                                                    [% FOREACH locationloo IN locationloop %]
-                                                                        [% IF ( locationloo.code ) == (item.loc) %]
-                                                                            <option value="[% locationloo.code | html %]" selected="selected">[% locationloo.description | html %]</option>
-                                                                        [% ELSE %]
-                                                                            <option value="[% locationloo.code | html %]">[% locationloo.description | html %]</option>
-                                                                        [% END %]
-                                                                    [% END %]
-                                                                </select>
-                                                            </li>
+                                                                        <li>
+                                                                            <label for="holdingbranch_item_[% item.item_id | html %]">holdingbranch</label>
+                                                                            <select id="holdingbranch_item_[% item.item_id | html %]" name="holdingbranch_[% item.biblio_count | html %]">
+                                                                                [% FOREACH l IN libraries %]
+                                                                                    [% IF l.branchcode == item.holdingbranch %]
+                                                                                        <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
+                                                                                    [% ELSE %]
+                                                                                        <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
+                                                                                    [% END %]
+                                                                                [% END %]
+                                                                            </select>
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="itype_item_[% item.item_id | html %]">itype</label>
+                                                                            <select id="itype_item_[% item.item_id | html %]" name="itype_[% item.biblio_count | html %]">
+                                                                                [% FOREACH itemtype IN itemtypes %]
+                                                                                    [% IF itemtype.itemtype == item.itype %]
+                                                                                        <option value="[% itemtype.itemtype | html %]" selected="selected">[% itemtype.description | html %]</option>
+                                                                                    [% ELSE %]
+                                                                                        <option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
+                                                                                    [% END %]
+                                                                                [% END %]
+                                                                            </select>
+                                                                        </li>
 
-                                                            <li>
-                                                                <label for="ccode_item_[% item.item_id | html %]">ccode</label>
-                                                                <select id="ccode_item_[% item.item_id | html %]" name="ccode_[% item.biblio_count | html %]">
-                                                                    <option value=""> </option>
-                                                                    [% FOREACH ccodeloo IN ccodeloop %]
-                                                                        [% IF ( ccodeloo.code ) == (item.ccode) %]
-                                                                            <option value="[% ccodeloo.code | html %]" selected="selected">[% ccodeloo.description | html %]</option>
-                                                                        [% ELSE %]
-                                                                            <option value="[% ccodeloo.code | html %]">[% ccodeloo.description | html %]</option>
-                                                                        [% END %]
-                                                                    [% END %]
-                                                                </select>
-                                                            </li>
+                                                                        <li>
+                                                                            <label for="nonpublic_note_item_[% item.item_id | html %]">nonpublic_note</label>
+                                                                            <input type="text" id="nonpublic_note_item_[% item.item_id | html %]" name="nonpublic_note_[% item.biblio_count | html %]" value="[% item.nonpublic_note | html %]">
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="public_note_item_[% item.item_id | html %]">public_note</label>
+                                                                            <input type="text" id="public_note_item_[% item.item_id | html %]" name="public_note_[% item.biblio_count | html %]" value="[% item.public_note | html %]">
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="loc_item_[% item.item_id | html %]">loc</label>
+                                                                            <select id="loc_item_[% item.item_id | html %]" name="loc_[% item.biblio_count | html %]">
+                                                                                <option value=""> </option>
+                                                                                [% FOREACH locationloo IN locationloop %]
+                                                                                    [% IF ( locationloo.code ) == (item.loc) %]
+                                                                                        <option value="[% locationloo.code | html %]" selected="selected">[% locationloo.description | html %]</option>
+                                                                                    [% ELSE %]
+                                                                                        <option value="[% locationloo.code | html %]">[% locationloo.description | html %]</option>
+                                                                                    [% END %]
+                                                                                [% END %]
+                                                                            </select>
+                                                                        </li>
 
-                                                            <li>
-                                                                <label for="notforloan_item_[% item.item_id | html %]">notforloan</label>
-                                                                <select id="notforloan_item_[% item.item_id | html %]" name="notforloan_[% item.biblio_count | html %]">
-                                                                    <option value=""> </option>
-                                                                    [% FOREACH n IN notforloanloop %]
-                                                                        [% IF n.code == item.notforloan %]
-                                                                            <option value="[% n.code | html %]" selected="selected">[% n.description | html %]</option>
-                                                                        [% ELSE %]
-                                                                            <option value="[% n.code | html %]">[% n.description | html %]</option>
-                                                                        [% END %]
-                                                                    [% END %]
-                                                                </select>
-                                                            </li>
-                                                            <li>
-                                                                <label for="uri_item_[% item.item_id | html %]">uri</label>
-                                                                <input type="text" id="uri_item_[% item.item_id | html %]" name="uri_[% item.biblio_count | html %]" value="[% item.uri | html %]">
-                                                            </li>
-                                                            <li>
-                                                                <label for="copyno_item_[% item.item_id | html %]">copyno</label>
-                                                                <input type="text" id="copyno_item_[% item.item_id | html %]" name="copyno_[% item.biblio_count | html %]" value="[% item.copyno | html %]">
-                                                            </li>
-                                                            <li>
-                                                                <label for="budget_code_item_[% item.item_id | html %]">budget_code</label>
-                                                                <select class="budget_code_item" id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% item.biblio_count | html %]">
-                                                                    <option value="">Select a fund (will use default if set)</option>
-                                                                    [% FOREACH budget_loo IN budget_loop %]
-                                                                        [% IF ( budget_loo.b_id ) == ( item.budget_id ) %]<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
-                                                                        [% ELSE %]<option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
-                                                                        [% END %]
-                                                                    [% END %]
-                                                                </select>
-                                                                <span class="item_fund required">Required</span>
-                                                            </li>
-                                                            <li>
-                                                                <label for="price_item_[% item.item_id | html %]">price</label>
-                                                                <input type="text" id="price_item_[% item.item_id | html %]" name="itemprice_[% item.biblio_count | html %]" value="[% item.itemprice | html %]">
-                                                            </li>
-                                                            <li>
-                                                                <label for="replacementprice_item_[% item.item_id | html %]">replacement price</label>
-                                                                <input type="text" id="replacementprice_item_[% item.item_id | html %]" name="replacementprice_[% item.biblio_count | html %]" value="[% item.replacementprice | html %]">
-                                                            </li>
-                                                            <li>
-                                                                <label for="callnumber_item_[% item.item_id | html %]">callnumber</label>
-                                                                <input type="text" id="callnumber_item_[% item.item_id | html %]" name="itemcallnumber_[% item.biblio_count | html %]" value="[% item.itemcallnumber | html %]">
-                                                            </li>
-                                                        </ol>
-                                                    </fieldset>
-                                                [% END # /FOREACH item %]
-                                            </div>
-                                        </fieldset> <!-- .biblio.unselected.rows -->
+                                                                        <li>
+                                                                            <label for="ccode_item_[% item.item_id | html %]">ccode</label>
+                                                                            <select id="ccode_item_[% item.item_id | html %]" name="ccode_[% item.biblio_count | html %]">
+                                                                                <option value=""> </option>
+                                                                                [% FOREACH ccodeloo IN ccodeloop %]
+                                                                                    [% IF ( ccodeloo.code ) == (item.ccode) %]
+                                                                                        <option value="[% ccodeloo.code | html %]" selected="selected">[% ccodeloo.description | html %]</option>
+                                                                                    [% ELSE %]
+                                                                                        <option value="[% ccodeloo.code | html %]">[% ccodeloo.description | html %]</option>
+                                                                                    [% END %]
+                                                                                [% END %]
+                                                                            </select>
+                                                                        </li>
+
+                                                                        <li>
+                                                                            <label for="notforloan_item_[% item.item_id | html %]">notforloan</label>
+                                                                            <select id="notforloan_item_[% item.item_id | html %]" name="notforloan_[% item.biblio_count | html %]">
+                                                                                <option value=""> </option>
+                                                                                [% FOREACH n IN notforloanloop %]
+                                                                                    [% IF n.code == item.notforloan %]
+                                                                                        <option value="[% n.code | html %]" selected="selected">[% n.description | html %]</option>
+                                                                                    [% ELSE %]
+                                                                                        <option value="[% n.code | html %]">[% n.description | html %]</option>
+                                                                                    [% END %]
+                                                                                [% END %]
+                                                                            </select>
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="uri_item_[% item.item_id | html %]">uri</label>
+                                                                            <input type="text" id="uri_item_[% item.item_id | html %]" name="uri_[% item.biblio_count | html %]" value="[% item.uri | html %]">
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="copyno_item_[% item.item_id | html %]">copyno</label>
+                                                                            <input type="text" id="copyno_item_[% item.item_id | html %]" name="copyno_[% item.biblio_count | html %]" value="[% item.copyno | html %]">
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="budget_code_item_[% item.item_id | html %]">budget_code</label>
+                                                                            <select class="budget_code_item" id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% item.biblio_count | html %]">
+                                                                                <option value="">Select a fund (will use default if set)</option>
+                                                                                [% FOREACH budget_loo IN budget_loop %]
+                                                                                    [% IF ( budget_loo.b_id ) == ( item.budget_id ) %]<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
+                                                                                    [% ELSE %]<option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
+                                                                                    [% END %]
+                                                                                [% END %]
+                                                                            </select>
+                                                                            <span class="item_fund required">Required</span>
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="price_item_[% item.item_id | html %]">price</label>
+                                                                            <input type="text" id="price_item_[% item.item_id | html %]" name="itemprice_[% item.biblio_count | html %]" value="[% item.itemprice | html %]">
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="replacementprice_item_[% item.item_id | html %]">replacement price</label>
+                                                                            <input type="text" id="replacementprice_item_[% item.item_id | html %]" name="replacementprice_[% item.biblio_count | html %]" value="[% item.replacementprice | html %]">
+                                                                        </li>
+                                                                        <li>
+                                                                            <label for="callnumber_item_[% item.item_id | html %]">callnumber</label>
+                                                                            <input type="text" id="callnumber_item_[% item.item_id | html %]" name="itemcallnumber_[% item.biblio_count | html %]" value="[% item.itemcallnumber | html %]">
+                                                                        </li>
+                                                                    </ol>
+                                                                </fieldset>
+                                                            [% END # /FOREACH item %]
+                                                        </div>
+                                                    </td>
+                                                    <td class="actions">
+                                                        <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id | uri %]" class="previewData btn btn-default btn-xs">MARC</a>
+                                                        <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% biblio.import_record_id | uri %]" class="previewData btn btn-default btn-xs">Card</a>
+                                                        <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid | uri %]&amp;basketno=[% basketno | uri %]&amp;breedingid=[% biblio.import_record_id | uri %]&amp;import_batch_id=[% biblio.import_batch_id | uri %]&amp;biblionumber=[% biblio.match_biblionumber | uri %]" class="btn btn-default btn-xs">Add order</a>
+                                                    </td>
+                                                </tr>
+                                            [% END # /FOREACH biblio %]
+                                        </tbody>
+                                    </table> <!-- .biblio.unselected.rows -->
 
-                                    [% END # /FOREACH biblio %]
                                     <div class="modal" id="dataPreview" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel">
                                         <div class="modal-dialog modal-lg" role="document">
                                             <div class="modal-content">
@@ -358,53 +371,55 @@
                                     <p>Import all the checked items in the basket with the following parameters:</p>
 
                                     [% IF ( items ) %]
-                                        <fieldset class="rows" style="float:none;">
-                                            <legend>Item</legend>
-                                            [% IF ( NoACQframework ) %]
-                                                <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
-                                            [% END %]
-                                            [% FOREACH item IN items %]
-                                                <div id="outeritemblock">
-                                                    <div id="itemblock">
-                                                        <ol>
-                                                            [% FOREACH iteminformatio IN item.iteminformation %]
-                                                                <li style="[% iteminformatio.hidden | html %];">
-                                                                    <div class="subfield_line" id="subfield[% iteminformatio.serialid | html %][% iteminformatio.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]">
-                                                                        [% IF (iteminformatio.mandatory) %]
-                                                                            <label class="required">[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
-                                                                        [% ELSE %]
-                                                                            <label>[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
-                                                                        [% END %]
+                                        <div id="cataloguing_additem_newitem">
+                                            <fieldset class="rows" style="float:none;">
+                                                <legend>Item</legend>
+                                                [% IF ( NoACQframework ) %]
+                                                    <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
+                                                [% END %]
+                                                [% FOREACH item IN items %]
+                                                    <div id="outeritemblock">
+                                                        <div id="itemblock">
+                                                            <ol>
+                                                                [% FOREACH iteminformatio IN item.iteminformation %]
+                                                                    <li style="[% iteminformatio.hidden | html %];">
+                                                                        <div class="subfield_line" id="subfield[% iteminformatio.serialid | html %][% iteminformatio.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]">
+                                                                            [% IF (iteminformatio.mandatory) %]
+                                                                                <label class="required">[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
+                                                                            [% ELSE %]
+                                                                                <label>[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
+                                                                            [% END %]
 
-                                                                        [% IF ( iteminformatio.marc_value.type == 'select' ) %]
-                                                                            <select name="field_value" class="input_marceditor">
-                                                                                [% FOREACH value IN iteminformatio.marc_value.values %]
-                                                                                    [% IF ( value == iteminformatio.marc_value.default ) %]
-                                                                                        <option value="[% value | html %]" selected="selected">[% iteminformatio.marc_value.labels.$value | html %]</option>
-                                                                                    [% ELSE %]
-                                                                                        <option value="[% value | html %]">[% iteminformatio.marc_value.labels.$value | html %]</option>
+                                                                            [% IF ( iteminformatio.marc_value.type == 'select' ) %]
+                                                                                <select name="field_value" class="input_marceditor">
+                                                                                    [% FOREACH value IN iteminformatio.marc_value.values %]
+                                                                                        [% IF ( value == iteminformatio.marc_value.default ) %]
+                                                                                            <option value="[% value | html %]" selected="selected">[% iteminformatio.marc_value.labels.$value | html %]</option>
+                                                                                        [% ELSE %]
+                                                                                            <option value="[% value | html %]">[% iteminformatio.marc_value.labels.$value | html %]</option>
+                                                                                        [% END %]
                                                                                     [% END %]
-                                                                                [% END %]
-                                                                            </select>
-                                                                        [% ELSE %]
-                                                                        [% iteminformatio.marc_value | $raw %]
-                                                                        [% END %]
-                                                                        <input type="hidden" name="itemid" value="1" />
-                                                                        <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield | html %]" />
-                                                                        <input type="hidden" name="tag" value="[% iteminformatio.tag | html %]" />
-                                                                        <input type="hidden" name="subfield" value="[% iteminformatio.subfield | html %]" />
-                                                                        <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory | html %]" />
-                                                                        [% IF ( iteminformatio.mandatory ) %]
-                                                                            <span class="required">Required</span>
-                                                                        [% END %]
-                                                                    </div>
-                                                                </li>
-                                                            [% END %]
-                                                        </ol>
-                                                    </div><!-- /#itemblock -->
-                                                </div> <!-- /#outeritemblock -->
-                                            [% END #/FOREACH item %]
-                                        </fieldset>
+                                                                                </select>
+                                                                            [% ELSE %]
+                                                                            [% iteminformatio.marc_value | $raw %]
+                                                                            [% END %]
+                                                                            <input type="hidden" name="itemid" value="1" />
+                                                                            <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield | html %]" />
+                                                                            <input type="hidden" name="tag" value="[% iteminformatio.tag | html %]" />
+                                                                            <input type="hidden" name="subfield" value="[% iteminformatio.subfield | html %]" />
+                                                                            <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory | html %]" />
+                                                                            [% IF ( iteminformatio.mandatory ) %]
+                                                                                <span class="required">Required</span>
+                                                                            [% END %]
+                                                                        </div>
+                                                                    </li>
+                                                                [% END %]
+                                                            </ol>
+                                                        </div><!-- /#itemblock -->
+                                                    </div> <!-- /#outeritemblock -->
+                                                [% END #/FOREACH item %]
+                                            </fieldset>
+                                        </div>
                                     [% END # /IF items %]
                                 </div> <!-- /#items_info -->
 
@@ -461,6 +476,8 @@
                                             </li>
                                             <li>
                                                 <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
+                                            </li>
+                                            <li>
                                                 <label for="all_sort1">Statistic 1: </label>
                                                 <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
                                             </li>
diff --git a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js
index 34785cda2c..18bc211d8e 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js
@@ -1,4 +1,4 @@
-/* global dataTablesDefaults __ */
+/* global dataTablesDefaults __ template_path */
 
 $(document).ready(function() {
     $("#Aform").preventDoubleFormSubmit();
@@ -18,17 +18,17 @@ $(document).ready(function() {
         checkOrderBudgets();
     });
 
-    $("#records_to_import fieldset.rows div").hide();
+    $(".order_details").hide();
     $('input:checkbox[name="import_record_id"]').change(function(){
-        var container = $(this).parents("fieldset");
+        var container = $(this).parents("tr");
         if ( $(this).is(':checked') ) {
             $(container).addClass("selected");
             $(container).removeClass("unselected");
-            $(container).find("div").toggle(true);
+            $(container).find(".order_details").toggle(true);
         } else {
             $(container).addClass("unselected");
             $(container).removeClass("selected");
-            $(container).find("div").toggle(false);
+            $(container).find(".order_details").toggle(false);
         }
     } );
 
@@ -94,7 +94,7 @@ $(document).ready(function() {
     });
     $("#dataPreview").on("hidden.bs.modal", function(){
         $("#dataPreviewLabel").html("");
-        $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + __("Loading") + "</div>");
+        $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"" + template_path + "/img/spinner-small.gif\" alt=\"\" /> " + __("Loading") + "</div>");
     });
 });
 
-- 
2.30.2