Bug 22734: Fund not marked as mandatory when ordering from a staged file
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / addorderiso2709.tt
index 939b466..9947df5 100644 (file)
+[% USE raw %]
+[% 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 ) %]
- &rsaquo; Batch [% import_batch_id %]
+ &rsaquo; Batch [% import_batch_id | html %]
 [% ELSE %]
  &rsaquo; Batch list
 [% END %]
 </title>
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
-<style type="text/css">#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
+<style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
-<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
-<script type="text/JavaScript">
-//<![CDATA[
-    $(document).ready(function() {
-        $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
-            "aoColumnDefs": [
-                { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
-                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
-                { "sType": "title-string", "aTargets" : [ "title-string" ] }
-            ],
-            "sPaginationType": "four_button",
-            "aaSorting": []
-        } ) );
-
-        // keep copy of the inactive budgets
-        disabledBudgetsCopy = $("select[name='all_budget_id']").html();
-        $("select[name='all_budget_id'] .b_inactive").remove();
-        $("select[name='budget_id'] .b_inactive").remove();
-
-        $("#showallbudgets").click(function() {
-            if ($(this).is(":checked")) {
-                $("select[name='budget_id']").html(disabledBudgetsCopy)
-            }
-            else {
-                $("select[name='budget_id'] .b_inactive").remove();
-            }
-        });
-
-        $("#all_showallbudgets").click(function() {
-            if ($(this).is(":checked")) {
-                $("select[name='all_budget_id']").html(disabledBudgetsCopy);
-            }
-            else {
-                $("select[name='all_budget_id'] .b_inactive").remove();
-            }
-        });
-
-        $("select[name='budget_id']").change(function(){
-            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
-            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
-            var destination_sort1 = $(this).parents('fieldset').find('li.sort1').find('input[name="sort1"]');
-            var sort1 = $(destination_sort1).val() || "";
-            if ( destination_sort1.length < 1 ) {
-                destination_sort1 = $(this).parents('fieldset').find('li.sort1 > select[name="sort1"]');
-            }
-            var destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('input[name="sort2"]');
-            var sort2 = $(destination_sort2).val() || "";
-            if ( destination_sort2.length < 1 ) {
-                destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('select[name="sort2"]');
-            }
-            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
-
-            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
-        } );
-
-        $("select[name='budget_id']").change();
-
-        $("select[name='all_budget_id']").change(function(){
-            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
-            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
-            var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
-            if ( destination_sort1.length < 1 ) {
-                destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
-            }
-            var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
-            if ( destination_sort2.length < 1 ) {
-                destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
-            }
-            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
-            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
-            $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
-            $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
-            $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
-            $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
-        } );
-
-        $("select[name='all_budget_id']").change();
-
-        $("#records_to_import fieldset.rows div").hide();
-        $('input:checkbox[name="import_record_id"]').change(function(){
-            var container = $(this).parents("fieldset");
-            if ( $(this).is(':checked') ) {
-                $(container).addClass("selected");
-                $(container).removeClass("unselected");
-                $(container).find("div").toggle(true);
-            } else {
-                $(container).addClass("unselected");
-                $(container).removeClass("selected");
-                $(container).find("div").toggle(false);
-            }
-        } );
-
-        $("input:checkbox").prop("checked", false);
-        $("div.biblio.unselected select").prop('disabled', false);
-        $("div.biblio.unselected input").prop('disabled', false);
-
-        $("#checkAll").click(function(){
-            $("#Aform").checkCheckboxes();
-            $("input:checkbox[name='import_record_id']").change();
-            return false;
-        });
-        $("#unCheckAll").click(function(){
-            $("#Aform").unCheckCheckboxes();
-            $("input:checkbox[name='import_record_id']").change();
-            return false;
-        });
-
-        $("#Aform").on("submit", function(){
-            if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) {
-                alert(_("There is no record selected"));
-                return false;
-            }
-
-            var error = 0;
-            $("input:checkbox[name='import_record_id']:checked").parents('fieldset').find('input[name="quantity"]').each(function(){
-                if ( $(this).val().length < 1 || isNaN( $(this).val() ) ) {
-                    error++;
-                }
-            });
-            if ( error > 0 ) {
-                alert(error + " " + _("quantity values are not filled in or are not numbers"));
-                return false;
-
-            }
-            var error = 0;
-            $("select[name='budget_code']").each(function() {
-                if (!$(this).val()) {
-                    error++;
-                }
-            });
-            if ( error > 0 ) {
-                alert(_("Some budgets are not defined in item records"));
-                return false;
-            }
-
-            return disableUnchecked($(this));
-        });
-        $('#tabs').tabs();
-        $(".previewData").on("click", function(e){
-            e.preventDefault();
-            var ltitle = $(this).text();
-            var page = $(this).attr("href");
-            $("#dataPreviewLabel").text(ltitle);
-            $("#dataPreview .modal-body").load(page + " div");
-            $('#dataPreview').modal({show:true});
-        });
-        $("#dataPreview").on("hidden", function(){
-            $("#dataPreviewLabel").html("");
-            $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
-        });
-    });
-
-    function disableUnchecked(form){
-        $("fieldset.biblio.unselected").each(function(){
-            $(this).remove();
-        });
-        return 1;
-    }
-//]]>
-</script>
 </head>
+
 <body id="acq_addorderiso2709" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Basket [% basketno %]</a> &rsaquo;  Add orders from iso2709 file</div>
-<div id="doc3" class="yui-t2">
-   <div id="bd">
-       <div id="yui-main">
-           <div class="yui-b">
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Basket [% basketno | html %]</a> &rsaquo; Add orders from MARC file</div>
+    <div class="container-fluid">
+        <div class="row">
+            <div class="col-sm-6 col-sm-offset-3 col-md-8 col-md-offset-2">
              [% IF ( allmatch ) %]<div class="dialog alert">
               <h4>No records imported</h4>
              No record have been imported because they all match an existing record in your catalog.<br />You'll have to treat them individually.
              [% END %]
 
              [% IF ( batch_details ) %]
-                <h1>Add orders from [% comments %]
-                    ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
+                <h1>Add orders from [% comments | html %]
+                    ([% file_name | html %] staged on [% upload_timestamp | $KohaDates  with_hours => 1 %])
                 </h1>
                 <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
                 <div id="tabs" class="toptabs">
                                         <option value="">Do not look for matching records</option>
                                         [% FOREACH available_matcher IN available_matchers %]
                                             [% IF ( available_matcher.code == current_matcher_code ) %]
-                                                <option value="[% available_matcher.matcher_id %]" selected="selected">
-                                                    [% available_matcher.code %] ([% available_matcher.description %])
+                                                <option value="[% available_matcher.matcher_id | html %]" selected="selected">
+                                                    [% available_matcher.code | html %] ([% available_matcher.description | html %])
                                                 </option>
                                             [% ELSE %]
-                                                <option value="[% available_matcher.matcher_id %]">
-                                                    [% available_matcher.code %] ([% available_matcher.description %])
+                                                <option value="[% available_matcher.matcher_id | html %]">
+                                                    [% available_matcher.code | html %] ([% available_matcher.description | html %])
                                                 </option>
                                             [% END %]
                                         [% END %]
                     </div>
 
                         <input type="hidden" name="op" value="import_records"/>
-                        <input type="hidden" name="basketno" value="[% basketno %]" />
-                        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
-                        <input type="hidden" name="import_batch_id" value="[%import_batch_id %]" />
-                        <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
+                        <input type="hidden" name="basketno" value="[% basketno | html %]" />
+                        <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
+                        <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
+                        <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
 
                         [% FOREACH biblio IN biblio_list %]
                         <fieldset class="biblio unselected rows" style="float:none;">
                           <legend>
-                            <label for="record_[% biblio.import_record_id %]" style="width:auto;">
-                              <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id %]" value="[% biblio.import_record_id %]" />
-                              <span class="citation">[% biblio.citation %]</span>
+                            <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.citation | html %]</span>
                             </label>
                             <span class="links" style="font-weight: normal;">
-                              ( <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% biblio.import_record_id %]" class="previewData">Card</a> | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;breedingid=[% biblio.import_record_id %]&amp;import_batch_id=[% biblio.import_batch_id %]&amp;biblionumber=[% biblio.match_biblionumber %]">Add order</a> )
+                              ( <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">
                                 [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
                                     Match found
                                 [% ELSE %]
-                                    [% biblio_lis.overlay_status %]
+                                    [% biblio_lis.overlay_status | html %]
                                 [% END %]
                                 [% IF ( biblio.match_biblionumber ) %]
-                                  Matches biblio [% biblio.match_biblionumber %] (score = [% biblio.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.match_biblionumber %]">[% biblio.match_citation %]</a>
+                                  Matches biblio [% biblio.match_biblionumber | uri %] (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 %]" class="required">Quantity: </label>
-                                <input id="quantity_record_[% biblio.import_record_id %]" type="text" value="[% biblio.quantity.length ? biblio.quantity : 1 %]" name="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 %]">Price: </label>
-                                <input id="price_record_[% biblio.import_record_id %]" type="text" value="[% biblio.price %]" name="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="discount">
-                                <label for="discount_record_[% biblio.import_record_id %]">Discount: </label>
-                                <input id="discount_record_[% biblio.import_record_id %]" type="text" value="[% biblio.discount %]" name="discount" size="6" /> %
-                                (If empty, discount rate from vendor will be used)
+                                <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="budget">
-                                <label for="fund_record_[% biblio.import_record_id %]">Fund: </label>
+                            <li class="fund">
                                 [% IF ( close ) %]
-                                  <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
+                                    <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 %]
-                                  <select id="fund_record_[% biblio.import_record_id %]" size="1" name="budget_id">
+                                    <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
+                                    <select id="fund_record_[% biblio.import_record_id | html %]" size="1" name="budget_id">
                                     <option value="">Select a fund</option>
                                     [% FOREACH budget IN budget_loop %]
                                         [% IF ( budget.b_id == biblio.budget_id ) %]
                                           [% IF budget.b_active %]
-                                            <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]" selected="selected">[% budget.b_txt %]</option>
+                                            <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 %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]" selected="selected">[% budget.b_txt %] (inactive)</option>
+                                            <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 %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %]</option>
-                                            [% ELSE %]<option value="[% budget.b_id %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %] (inactive)</option>
+                                            [% 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 %]">Statistic 1: </label>
-                                <input id="sort1_record_[% biblio.import_record_id %]" type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
+                                <label for="sort1_record_[% biblio.import_record_id | html %]">Statistic 1: </label>
+                                <input id="sort1_record_[% biblio.import_record_id | html %]" type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 | html %]" />
                             </li>
                             <li class="sort2">
-                                <label for="sort2_record_[% biblio.import_record_id %]">Statistic 2: </label>
-                                <input id="sort2_record_[% biblio.import_record_id %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
+                                <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label>
+                                <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 | html %]" />
                             </li>
                           </ol>
                         </div>
                         <div style="float:right">
-                        [% IF item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
+                        [% 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 %]</legend>
+                        <legend>Item Record [% item.item_id | html %]</legend>
                         <ol>
                         <li>
-                        <label for="homebranch_item_[% item.item_id %]">homebranch</label><select id="homebranch_item_[% item.item_id %]" name="homebranch_[% item.biblio_count %]">
+                        <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 %]" selected="selected">[% l.branchname %]</option>
+                            <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
                           [% ELSE %]
-                            <option value="[% l.branchcode %]">[% l.branchname %]</option>
+                            <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
                           [% END %]
                         [% END %]
                         </select>
                         </li>
 
-                        <li><label for="holdingbranch_item_[% item.item_id %]">holdingbranch</label><select id="holdingbranch_item_[% item.item_id %]" name="holdingbranch_[% item.biblio_count %]">
+                        <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 %]" selected="selected">[% l.branchname %]</option>
+                            <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
                           [% ELSE %]
-                            <option value="[% l.branchcode %]">[% l.branchname %]</option>
+                            <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
                           [% END %]
                         [% END %]
                         </select>
                         </li>
-                        <li><label for="itype_item_[% item.item_id %]">itype</label><select id="itype_item_[% item.item_id %]" name="itype_[% item.biblio_count %]">
+                        <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 itypeloo IN itypeloop %]
-                          [% IF ( itypeloo.value ) == ( item.itype ) %]
-                            <option value="[% itypeloo.itemtype %]" selected="selected">[% itypeloo.description |html %]</option>
+                          [% IF ( itypeloo.itemtype ) == ( item.itype ) %]
+                            <option value="[% itypeloo.itemtype | html %]" selected="selected">[% itypeloo.description | html %]</option>
                           [% ELSE %]
-                            <option value="[% itypeloo.itemtype %]">[% itypeloo.description |html %]</option>
+                            <option value="[% itypeloo.itemtype | html %]">[% itypeloo.description | html %]</option>
                           [% END %]
                         [% END %]
                         </select>
                         </li>
 
-                        <li><label for="nonpublic_note_item_[% item.item_id %]">nonpublic_note</label><input type="text" id="nonpublic_note_item_[% item.item_id %]" name="nonpublic_note_[% item.biblio_count %]" value="[% item.nonpublic_note %]"></li>
-                        <li><label for="public_note_item_[% item.item_id %]">public_note</label><input type="text" id="public_note_item_[% item.item_id %]" name="public_note_[% item.biblio_count %]" value="[% item.public_note %]"></li>
-                        <li><label for="loc_item_[% item.item_id %]">loc</label><select id="loc_item_[% item.item_id %]" name="loc_[% item.biblio_count %]">
+                        <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 %]" selected="selected">[% locationloo.description %]</option>[% ELSE %]<option value="[% locationloo.code %]">[% locationloo.description %]</option>[% END %]
+                            [% 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="ccode_item_[% item.item_id %]">ccode</label><select id="ccode_item_[% item.item_id %]" name="ccode_[% item.biblio_count %]">
+                        <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 %]">
                         [% FOREACH ccodeloo IN ccodeloop %]
-                            [% IF ( ccodeloo.code ) == (item.ccode) %]<option value="[% ccodeloo.code %]" selected="selected">[% ccodeloo.description %]</option>[% ELSE %]<option value="[% ccodeloo.code %]">[% ccodeloo.description %]</option>[% END %]
+                            [% 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 %]">notforloan</label><input type="text" id="notforloan_item_[% item.item_id %]" name="notforloan_[% item.biblio_count %]" value="[% item.notforloan %]"></li>
-                        <li><label for="uri_item_[% item.item_id %]">uri</label><input type="text" id="uri_item_[% item.item_id %]" name="uri_[% item.biblio_count %]" value="[% item.uri %]"></li>
-                        <li><label for="copyno_item_[% item.item_id %]">copyno</label><input type="text" id="copyno_item_[% item.item_id %]" name="copyno_[% item.biblio_count %]" value="[% item.copyno %]"></li>
-                        <li><label for="budget_code_item_[% item.item_id %]">budget_code</label><select id="budget_code_item_[% item.item_id %]" name="budget_code_[% item.biblio_count %]">
+                        <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 %]">
+                        [% 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 id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% item.biblio_count | html %]">
                         <option value="">Select a fund</option>
                         [% FOREACH budget_loo IN budget_loop %]
-                            [% IF ( budget_loo.b_code ) == ( item.budget_code ) %]<option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
-                            [% ELSE %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
+                            [% 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>
                         </li>
-                        <li><label for="price_item_[% item.item_id %]">price</label><input type="text" id="price_item_[% item.item_id %]" name="itemprice_[% item.biblio_count %]" value="[% item.itemprice %]"></li>
-                        <li><label for="replacementprice_item_[% item.item_id %]">replacement price</label><input type="text" id="replacementprice_item_[% item.item_id %]" name="replacementprice_[% item.biblio_count %]" value="[% item.replacementprice %]"></li>
-                        <li><label for="callnumber_item_[% item.item_id %]">callnumber</label><input type="text" id="callnumber_item_[% item.item_id %]" name="itemcallnumber_[% item.biblio_count %]" value="[% item.itemcallnumber %]"></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 %]
                                     <h3 id="dataPreviewLabel">MARC preview</h3>
                                 </div>
                                 <div class="modal-body">
-                                    <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
+                                    <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
                                 </div>
                                 <div class="modal-footer">
                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
                             <div id="outeritemblock">
                             <div id="itemblock">
                                 <ol>
-                                [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
-                                    <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
+                                [% 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 %] - [% iteminformatio.marc_lib %]</label>
+                                            <label class="required">[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
                                         [% ELSE %]
-                                            <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
+                                            <label>[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
                                         [% END %]
 
                                         [% IF ( iteminformatio.marc_value.type == 'select' ) %]
                                             <select name="field_value" size="1">
                                             [% FOREACH value IN iteminformatio.marc_value.values %]
                                                 [% IF ( value == iteminformatio.marc_value.default ) %]
-                                                    <option value="[% value %]" selected="selected">[% iteminformatio.marc_value.labels.$value %]</option>
+                                                    <option value="[% value | html %]" selected="selected">[% iteminformatio.marc_value.labels.$value | html %]</option>
                                                 [% ELSE %]
-                                                    <option value="[% value %]">[% iteminformatio.marc_value.labels.$value %]</option>
+                                                    <option value="[% value | html %]">[% iteminformatio.marc_value.labels.$value | html %]</option>
                                                 [% END %]
                                             [% END %]
                                             </select>
                                         [% ELSE %]
-                                        [% iteminformatio.marc_value %]
+                                        [% iteminformatio.marc_value | $raw %]
                                         [% END %]
                                         <input type="hidden" name="itemid" value="1" />
-                                        <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
-                                        <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
-                                        <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
-                                        <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
+                                        <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 %]
                             <legend>Accounting details</legend>
                             <ol>
                                 <li>
-                                    <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
+                                    <!-- 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" />
                                 </li>
                                 <li>
                                     [% IF ( close ) %]
                                         <span class="label">Fund: </span>
-                                        <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
+                                        <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id | html %]" />[% Budget_name | html %]
                                     [% ELSE %]
                                         <li>
                                             <label for="all_currency">Currency:</label>
                                             <select name="all_currency" id="all_currency">
                                             [% FOREACH currency IN currencies %]
                                                 [% IF currency.currency == bookseller.listprice %]
-                                                    <option value="[% currency.currency %]" selected="selected">[% currency.currency %]</option>
+                                                    <option value="[% currency.currency | html %]" selected="selected">[% currency.currency | html %]</option>
                                                 [% ELSIF not currency.archived %]
-                                                    <option value="[% currency.currency %]">[% currency.currency %]</option>
+                                                    <option value="[% currency.currency | html %]">[% currency.currency | html %]</option>
                                                 [% END %]
                                             [% END %]
                                             </select>
                                             <select id="all_budget_id" size="1" name="all_budget_id">
                                               <option value="">Select a fund</option>
                                             [% FOREACH budget_loo IN budget_loop %]
-                                                [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option>
-                                                [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %] (inactive)</option>
+                                                [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %]</option>
+                                                [% ELSE %]<option value="[% budget_loo.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %] (inactive)</option>
                                                 [% END %]
                                             [% END %]
                                             </select>
                       </div>
 
                       <fieldset class="action">
-                          <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
+                          <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Cancel</a>
                       </fieldset>
                     </form>
                 [% ELSE %]
                         <th>Comments</th>
                         <th>Status</th>
                         <th class="title-string">Staged</th>
-                        <th># Bibs</th>
+                        <th># Bibliographic records</th>
                         <th class="NoSort">&nbsp;</th>
                       </tr>
                     </thead>
                     <tbody>
                       [% FOREACH batch_lis IN batch_list %]
                       <tr>
-                        <td>[% batch_lis.file_name %]</td>
-                        <td>[% batch_lis.comments %]</td>
+                        <td>[% batch_lis.file_name | html %]</td>
+                        <td>[% batch_lis.comments | html %]</td>
                         <td>
                           [% IF ( batch_lis.import_status == 'cleaned' ) %]
                             Cleaned
                           [% ELSIF ( batch_lis.import_status == 'staged' ) %]
                             Staged
                           [% ELSE %]
-                            [% batch_lis.import_status %]
+                            [% batch_lis.import_status | html %]
                           [% END %]
                         </td>
-                        <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
-                        <td>[% batch_lis.num_records %]</td>
-                        <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
+                        <td><span title="[% batch_lis.staged_date | html %]">[% batch_lis.staged_date | $KohaDates  with_hours => 1 %]</span></td>
+                        <td>[% batch_lis.num_records | html %]</td>
+                        <td class="actions">
+                            <a href="[% batch_lis.scriptname | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]&amp;basketno=[% basketno | uri %]&amp;booksellerid=[% booksellerid | uri %]" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add orders</a>
+                        </td>
                       </tr>
                       [% END %]
                     </tbody>
                   </table>
                 </div>
                 [% END %]
-           </div>
-       </div>
-   </div>
-</div>
-</body>
-</html>
+            </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' %]