Bug 12395: Save order line's creator
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / parcel.tt
index a894cf4..f6bbf9e 100644 (file)
+[% USE Asset %]
 [% USE Koha %]
 [% USE KohaDates %]
 [% USE Price %]
 [% USE currency = format('%.2f') -%]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( date ) %]
             Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% datereceived | $KohaDates %][% ELSE %]Receive orders from [% name %][% END %]</title>
-<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
+[% Asset.css("css/datatables.css") %]
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
-<style type="text/css">#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
-<script type="text/javascript">
-//<![CDATA[
-
-    dt_overwrite_html_sorting_localeCompare();
-
-    var sticky_filters = [% sticky_filters %];
-
-    $(document).ready(function(){
-      if ( $("#pendingt").length ) {
-        var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
-            "bStateSave": true,
-            "iCookieDuration": 60*60*24*1000, // 1000 days
-            "iDisplayLength": 10,
-            "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
-            "aoColumnDefs": [
-                { "aTargets": [ 4, 9, 10 ], "bSortable": false, "bSearchable": false },
-            ],
-            "aoColumns": [
-                { "sType": "html" },
-                { "sType": "html" },
-                { "sType": "num-html" },
-                { "sType": "anti-the" },
-                null,
-                null,
-                null,
-                null,
-                null,
-                null,
-                null,
-            ],
-            'bAutoWidth': false,
-            "sPaginationType": "four_button"
-        } )
-        ).columnFilter({
-            sPlaceHolder: "head:after",
-            aoColumns: [
-                { type: "text" },
-                { type: "text" },
-                { type: "text" },
-                { type: "text" },
-                null,
-                { type: "text" },
-                { type: "text" },
-                { type: "text" },
-                { type: "text" },
-                null,
-                null
-            ]
-        });
-      }
-
-      if ( $("#receivedt").length ) {
-        var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
-            "bStateSave": true,
-            "iCookieDuration": 60*60*24*1000, // 1000 days
-            "iDisplayLength": 10,
-            "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
-            "aoColumnDefs": [
-                { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
-            ],
-            "aoColumns": [
-                { "sType": "html" },
-                { "sType": "html" },
-                { "sType": "html" },
-                { "sType": "num-html" },
-                { "sType": "anti-the" },
-                null,
-                null,
-                null,
-                null,
-                null,
-                null,
-                null
-            ],
-            "sPaginationType": "four_button"
-        } ) );
-      }
-
-      // Keep filters from finishreceive.pl to parcel.pl
-      $.cookie("filter_parcel_summary", $("#summaryfilter").val());
-      $.cookie("filter_parcel_basketname", $("#basketfilter").val());
-      $.cookie("filter_parcel_orderno", $("#orderfilter").val());
-      $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
-      $.cookie("filter_parcel_ean", $("#eanfilter").val());
-
-      $("#filterform").on('submit', function(){
-        $.cookie("filter_parcel_summary", $("#summaryfilter").val());
-        $.cookie("filter_parcel_basketname", $("#basketfilter").val());
-        $.cookie("filter_parcel_orderno", $("#orderfilter").val());
-        $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
-        $.cookie("filter_parcel_ean", $("#eanfilter").val());
-      });
-
-        $(".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>");
-        });
-
-    });
-
-     // Case-insensitive version of jquery's contains function
-     jQuery.extend(jQuery.expr[':'], {
-           icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
-     });
-
-     // Contains exactly function
-     jQuery.extend(jQuery.expr[':'], {
-          containsExactly: "$(a).text() == m[3]"
-     });
-
-//]]>
-</script>
-<script type="text/javascript">
-//<![CDATA[
-            function transfer_order_popup(ordernumber) {
-                var url = "/cgi-bin/koha/acqui/transferorder.pl?"
-                    + "ordernumber=" + ordernumber
-                window.open(url, 'TransferOrder');
-            }
-
-//]]>
-</script>
 </head>
+
 <body id="acq_parcel" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
     [% IF datereceived %]
         Receipt summary for <i>[% name %]</i>
         [% IF ( invoice ) %]
-            <i>[ [% invoice %] ]</i>
+            <i>[ [% invoice |html %] ]</i>
         [% END %]
         on <i>[% datereceived | $KohaDates %]</i>
     [% ELSE %]
        [% END %]
     <h1>
         [% IF datereceived %]
-            Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice %] ] </i>[% END %] on <i>[% datereceived | $KohaDates %]</i>
+            Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice |html %] ] </i>[% END %] on <i>[% datereceived | $KohaDates %]</i>
         [% ELSE %]
             Receive orders from [% name %]
         [% END %]
 
 [% UNLESS no_orders_to_display %]
 <div id="acqui_receive_summary">
-<p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
+<p><strong>Invoice number:</strong> [% invoice |html %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
 </div>
 [% UNLESS (invoiceclosedate) %]
   <div id="acqui_receive_search">
             <th>Basket group</th>
             <th>Order line</th>
             <th>Summary</th>
-            <th>View record</th>
+            <th>More</th>
             <th>Quantity</th>
             <th>Unit cost</th>
             <th>Order cost</th>
                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]&type=vendor">Add vendor note</a>]
                 [% END %]
                 </td>
-                <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_order.biblionumber %]" class="previewData">Card</a></td>
+                <td>
+                  <a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=[% loop_order.ordernumber %]" class="previewData">Order</a><br>
+                  <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" class="previewData">MARC</a><br>
+                  <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_order.biblionumber %]" class="previewData">Card</a>
+                </td>
                 <td>[% loop_order.quantity %]</td>
                 <td>[% loop_order.ecost | $Price %]</td>
                 <td>[% loop_order.total | $Price %]</td>
           <th>Basket</th>
           <th>Basket group</th>
           <th>Order line</th>
-          <th>Holds</th>
+          <th title="Item holds / Total holds">Holds</th>
           <th>Summary</th>
           <th>View record</th>
           <th>Quantity</th>
                   [% END %]
                 </td>
                 <td>
-                  [% IF order.holds > 0 %]
-                    <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber %]">[% order.holds %]</a></span>
+                  [% IF order.total_holds > 0 %]
+                    [% IF order.item_holds > 0 %]
+                      <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber %]">[% order.item_holds %]</a></span>
+                    [% ELSE %]
+                      0
+                    [% END %]
+                    /
+                    <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber %]">[% order.total_holds %]</a></span>
                   [% ELSE %]
                     0
                   [% END %]
                 <td>[% order.unitprice | $Price %]</td>
                 <td>[% order.total | $Price %]</td>
                 <td>
-                    [% IF loop_receive.cannot_cancel or ( Koha.Preference("AcqCreateItem") == "receiving" and loop_receive.holds > 0 ) %]
+                    [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
                       [% IF loop_receive.cannot_cancel %]
                         [% span_title = BLOCK %]
                             Cannot cancel receipt of this order line because it
 [% INCLUDE 'acquisitions-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    [% Asset.js("js/acquisitions-menu.js") %]
+    [% INCLUDE 'datatables.inc' %]
+    [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") %]
+    [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") %]
+    <style type="text/css">#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
+    <script type="text/javascript">
+
+        dt_overwrite_html_sorting_localeCompare();
+        var sticky_filters = [% sticky_filters %];
+
+        $(document).ready(function(){
+            if ( $("#pendingt").length ) {
+                var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
+                    "bStateSave": true,
+                    "iCookieDuration": 60*60*24*1000, // 1000 days
+                    "iDisplayLength": 10,
+                    "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
+                    "aoColumnDefs": [
+                        { "aTargets": [ 4, 9, 10 ], "bSortable": false, "bSearchable": false },
+                    ],
+                    "aoColumns": [
+                        { "sType": "html" },
+                        { "sType": "html" },
+                        { "sType": "num-html" },
+                        { "sType": "anti-the" },
+                        null,
+                        null,
+                        null,
+                        null,
+                        null,
+                        null,
+                        null,
+                    ],
+                    'bAutoWidth': false,
+                    "sPaginationType": "four_button"
+                })
+                ).columnFilter({
+                    sPlaceHolder: "head:after",
+                    aoColumns: [
+                        { type: "text" },
+                        { type: "text" },
+                        { type: "text" },
+                        { type: "text" },
+                        null,
+                        { type: "text" },
+                        { type: "text" },
+                        { type: "text" },
+                        { type: "text" },
+                        null,
+                        null
+                    ]
+                });
+            }
+
+            if ( $("#receivedt").length ) {
+                var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
+                    "bStateSave": true,
+                    "iCookieDuration": 60*60*24*1000, // 1000 days
+                    "iDisplayLength": 10,
+                    "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
+                    "aoColumnDefs": [
+                        { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
+                    ],
+                    "aoColumns": [
+                        { "sType": "html" },
+                        { "sType": "html" },
+                        { "sType": "html" },
+                        { "sType": "num-html" },
+                        { "sType": "anti-the" },
+                        null,
+                        null,
+                        null,
+                        null,
+                        null,
+                        null,
+                        null
+                    ],
+                    "sPaginationType": "four_button"
+                }));
+            }
+
+            // Keep filters from finishreceive.pl to parcel.pl
+            $.cookie("filter_parcel_summary", $("#summaryfilter").val());
+            $.cookie("filter_parcel_basketname", $("#basketfilter").val());
+            $.cookie("filter_parcel_orderno", $("#orderfilter").val());
+            $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
+            $.cookie("filter_parcel_ean", $("#eanfilter").val());
+
+            $("#filterform").on('submit', function(){
+                $.cookie("filter_parcel_summary", $("#summaryfilter").val());
+                $.cookie("filter_parcel_basketname", $("#basketfilter").val());
+                $.cookie("filter_parcel_orderno", $("#orderfilter").val());
+                $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
+                $.cookie("filter_parcel_ean", $("#eanfilter").val());
+            });
+
+            $(".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>");
+            });
+
+        });
+
+        // Case-insensitive version of jquery's contains function
+        jQuery.extend(jQuery.expr[':'], {
+            icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
+        });
+
+         // Contains exactly function
+        jQuery.extend(jQuery.expr[':'], {
+            containsExactly: "$(a).text() == m[3]"
+        });
+
+        function transfer_order_popup(ordernumber) {
+            var url = "/cgi-bin/koha/acqui/transferorder.pl?"
+                + "ordernumber=" + ordernumber
+                window.open(url, 'TransferOrder');
+        }
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]