Bug 19755: Move template JavaScript to the footer: Acquisitions, part 3
authorOwen Leonard <oleonard@myacpl.org>
Tue, 5 Dec 2017 18:30:08 +0000 (18:30 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 15 Feb 2018 16:30:23 +0000 (13:30 -0300)
This patch modifies even more staff client acquisitions templates so
that JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of the
modified templates: All button controls, DataTables functionality, tabs,
etc.

- Acquisitions -> Vendor -> Vendor details
  - Contracts datatable
  - Edit vendor
    - Add contacts, form validation
- Acquisitions -> Vendor -> Invoices -> Invoice -> "Go to receipt"
  - Datatables, MARC and Card previews
    - Transfer
      - Confirmation of transfer, window closes
- Acquisitions -> Vendor -> Receive shipments
  - Datatables, date pickers
- Acquisitions -> Available funds table -> Spent report
  - Datatables
- Acquisitions -> Vendor -> Uncertain prices
  - Datatables, form validation
- Acquisitions -> Vendor -> Basket -> Add to basket from external source
  - Select and clear all on search form
  - Search results
    - Datatables, MARC and Card previews, in-table pop-up controls
      (click any table cell)

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/transferorder.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt

index 2e31ed4..2790d5a 100644 (file)
 [% 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_[% KOHA_VERSION %].css" />
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter_[% KOHA_VERSION %].js"></script>
-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min_[% KOHA_VERSION %].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' %]
 [% INCLUDE 'acquisitions-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
+    [% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter_[% KOHA_VERSION %].js"></script>
+    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min_[% KOHA_VERSION %].js"></script>
+    <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' %]
index 7af950a..cf90e34 100644 (file)
@@ -1,37 +1,11 @@
 [% USE KohaDates %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; Receive shipment from vendor [% name %]</title>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
-//<![CDATA[
- $(document).ready(function() {
-    var parcelst = $("#parcelst").dataTable($.extend(true, {}, dataTablesDefaults, {
-        "aoColumnDefs": [
-          { "sType": "title-string", "aTargets" : [ "title-string" ] }
-        ],
-        'bPaginate': false,
-    } ) );
-
-    //keep a copy of all budgets before removing the inactives
-    var budgetId = $("#shipmentcost_budgetid");
-    var disabledBudgetsCopy = budgetId.html();
-    $('.b_inactive').remove();
-
-    $('#showallfunds').click(function() {
-        if ($(this).is(":checked")) {
-            budgetId.html(disabledBudgetsCopy); //Puts back all the funds
-        }
-        else {
-            $('.b_inactive').remove();
-        }
-    });
- });
- //]]>
-</script>
 </head>
+
 <body id="acq_parcels" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
 </form>[% END %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
+    [% INCLUDE 'calendar.inc' %]
+    [% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function() {
+            var parcelst = $("#parcelst").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "aoColumnDefs": [
+                  { "sType": "title-string", "aTargets" : [ "title-string" ] }
+                ],
+                'bPaginate': false,
+            }));
+
+            //keep a copy of all budgets before removing the inactives
+            var budgetId = $("#shipmentcost_budgetid");
+            var disabledBudgetsCopy = budgetId.html();
+            $('.b_inactive').remove();
+
+            $('#showallfunds').click(function() {
+                if ($(this).is(":checked")) {
+                    budgetId.html(disabledBudgetsCopy); //Puts back all the funds
+                }
+                else {
+                    $('.b_inactive').remove();
+                }
+            });
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 328d68a..f608c41 100644 (file)
@@ -1,24 +1,12 @@
 [% USE KohaDates %]
 [% USE ItemTypes %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; Spent</title>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
-//<![CDATA[
- $(document).ready(function() {
-    $("#spent").dataTable($.extend(true, {}, dataTablesDefaults, {
-        "aoColumnDefs": [
-            { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
-            { "sType": "title-string", "aTargets" : [ "title-string" ] }
-        ],
-        "sPaginationType": "four_button"
-    } ) );
- });
- //]]>
-</script>
 </head>
+
 <body id="acq_spent" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
 [% INCLUDE 'acquisitions-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
+    [% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function() {
+            $("#spent").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "aoColumnDefs": [
+                    { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
+                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
+                ],
+                "sPaginationType": "four_button"
+            } ) );
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 0c7b0d0..4e01547 100644 (file)
     [% END %]
 [% END %]
 
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Vendor [% name %]</title>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
-
-<script type="text/javascript">
-//<![CDATA[
-function confirm_deletion() {
-    if (confirm(_("Confirm deletion of this vendor ?"))) {
-        window.location="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]&op=delete";
-    }
-}
-
-function add_contact() {
-    var new_contact = $('#contact-template').clone();
-    var timestamp = new Date().getTime();
-    $(new_contact).removeAttr('id');
-    $('input, textarea', new_contact).each(function () {
-        $(this).attr('id', $(this).attr('id') + '_' + timestamp);
-    });
-    $('label', new_contact).each(function () {
-        $(this).attr('for', $(this).attr('for') + '_' + timestamp);
-    });
-    $(new_contact).insertBefore(this);
-    if ($('.supplier-contact').length === 2) { // First contact
-        $.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_orderacquisition', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
-            $(checkbox, new_contact).click();
-        });
-    }
-    $('input[name="contact_name"]', new_contact).focus();
-    return false;
-}
-
-function delete_contact(ev) {
-    $(this).parents('.supplier-contact').remove();
-    ev.preventDefault();
-}
-
- $(document).ready(function() {
-    var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, {
-        "aoColumnDefs": [
-          { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
-          { "sType": "title-string", "aTargets" : [ "title-string" ] }
-        ],
-        'sDom': 't'
-    } ) );
-    $('body').on('click', '.delete-contact', null, delete_contact);
-    $('#add-contact').click(add_contact);
-    $('body').on('click', '.contact_acqprimary', null, function () {
-        if ($(this).is(':checked')) {
-            $('.contact_acqprimary').filter(':checked').not(this).prop('checked', false);
-            $('.contact_acqprimary_hidden').each(function () {
-                $(this).val('0');
-            });
-        }
-        $(this).next('.contact_acqprimary_hidden').val('1');
-    });
-    $('body').on('click', '.contact_serialsprimary', null, function () {
-        if ($(this).is(':checked')) {
-            $('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false);
-            $('.contact_serialsprimary_hidden').each(function () {
-                $(this).val('0');
-            });
-        }
-        $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
-    });
-    $('body').on('click', '.contact_orderacquisition', null, function () {
-        $(this).next('.contact_orderacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
-    });
-    $('body').on('click', '.contact_claimacquisition', null, function () {
-        $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
-    });
-    $('body').on('click', '.contact_claimissues', null, function () {
-        $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
-    });
- });
-//]]>
-</script>
 </head>
+
 <body id="acq_supplier" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
@@ -422,4 +349,81 @@ function delete_contact(ev) {
 [% INCLUDE 'vendor-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
+    [% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript">
+        function confirm_deletion() {
+            if (confirm(_("Confirm deletion of this vendor ?"))) {
+                window.location="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]&op=delete";
+            }
+        }
+
+        function add_contact() {
+            var new_contact = $('#contact-template').clone();
+            var timestamp = new Date().getTime();
+            $(new_contact).removeAttr('id');
+            $('input, textarea', new_contact).each(function () {
+                $(this).attr('id', $(this).attr('id') + '_' + timestamp);
+            });
+            $('label', new_contact).each(function () {
+                $(this).attr('for', $(this).attr('for') + '_' + timestamp);
+            });
+            $(new_contact).insertBefore(this);
+            if ($('.supplier-contact').length === 2) { // First contact
+                $.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_orderacquisition', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
+                    $(checkbox, new_contact).click();
+                });
+            }
+            $('input[name="contact_name"]', new_contact).focus();
+            return false;
+        }
+
+        function delete_contact(ev) {
+            $(this).parents('.supplier-contact').remove();
+            ev.preventDefault();
+        }
+
+         $(document).ready(function() {
+            var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "aoColumnDefs": [
+                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
+                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
+                ],
+                'sDom': 't'
+            } ) );
+            $('body').on('click', '.delete-contact', null, delete_contact);
+            $('#add-contact').click(add_contact);
+            $('body').on('click', '.contact_acqprimary', null, function () {
+                if ($(this).is(':checked')) {
+                    $('.contact_acqprimary').filter(':checked').not(this).prop('checked', false);
+                    $('.contact_acqprimary_hidden').each(function () {
+                        $(this).val('0');
+                    });
+                }
+                $(this).next('.contact_acqprimary_hidden').val('1');
+            });
+            $('body').on('click', '.contact_serialsprimary', null, function () {
+                if ($(this).is(':checked')) {
+                    $('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false);
+                    $('.contact_serialsprimary_hidden').each(function () {
+                        $(this).val('0');
+                    });
+                }
+                $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
+            });
+            $('body').on('click', '.contact_orderacquisition', null, function () {
+                $(this).next('.contact_orderacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
+            });
+            $('body').on('click', '.contact_claimacquisition', null, function () {
+                $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
+            });
+            $('body').on('click', '.contact_claimissues', null, function () {
+                $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
+            });
+        });
+    </script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 9d06740..d36bc18 100644 (file)
@@ -1,3 +1,4 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; Transfer order</title>
 [%- USE KohaDates -%]
@@ -5,29 +6,8 @@
     <style type="text/css">
     #custom-doc { width:44.46em;*width:43.39em;min-width:578px; margin:auto; text-align:left; }
     </style>
-[% IF transferred %]
-    <script type="text/javascript">
-    //<![CDATA[
-        opener.location.reload();
-        window.close();
-    //]]>
-    </script>
-[% END %]
-
-[% IF ( bookselleridfrom ) %]
-    <script type="text/javascript">
-    //<![CDATA[
-        $(document).ready(function(){
-            $(".confirm_transfer").on("click",function(){
-                return confirm( _("Transfer order to this basket?") );
-            });
-        });
-    //]]>
-    </script>
-[% END %]
-
-
 </head>
+
 <body id="acq_transferorder" class="acq">
 <div id="custom-doc" class="yui-t7">
    <div id="bd">
 
 </div>
 </div>
-</body>
-</html>
+
+[% MACRO jsinclude BLOCK %]
+    [% IF transferred %]
+        <script type="text/javascript">
+            opener.location.reload();
+            window.close();
+        </script>
+    [% END %]
+
+    [% IF ( bookselleridfrom ) %]
+        <script type="text/javascript">
+            $(document).ready(function(){
+                $(".confirm_transfer").on("click",function(){
+                    return confirm( _("Transfer order to this basket?") );
+                });
+            });
+        </script>
+    [% END %]
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' %]
\ No newline at end of file
index 4564bb3..e92456f 100644 (file)
@@ -1,29 +1,11 @@
 [% USE Koha %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( booksellername ) %]Orders with uncertain prices for vendor [% booksellername %][% ELSE %]Orders with uncertain prices[% END %]</title>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
-//<![CDATA[
- $(document).ready(function() {
-    var uncertainpricet = $("#uncertainpricet").dataTable($.extend(true, {}, dataTablesDefaults, {
-        "aoColumnDefs": [
-            { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
-        ],
-        "sPaginationType": "four_button"
-    } ) );
-    $(".check_uncertain").on("change",function(){
-        var form = document.getElementById("uncertainprices");
-        var ordernumber = $(this).data("ordernumber");
-        uncheckbox( form, ordernumber );
-    });
- });
-var MSG_INVALIDPRICE = _("ERROR: Price is not a valid number, please check the price and try again!");
- //]]>
-</script>
-<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
 </head>
+
 <body id="acq_uncertainprice" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
@@ -154,4 +136,27 @@ var MSG_INVALIDPRICE = _("ERROR: Price is not a valid number, please check the p
 [% INCLUDE 'vendor-menu.inc' %]
 </div>
 </div>
+
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
+    [% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript">
+        $(document).ready(function() {
+            var uncertainpricet = $("#uncertainpricet").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "aoColumnDefs": [
+                    { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
+                ],
+                "sPaginationType": "four_button"
+            }));
+            $(".check_uncertain").on("change",function(){
+                var form = document.getElementById("uncertainprices");
+                var ordernumber = $(this).data("ordernumber");
+                uncheckbox( form, ordernumber );
+            });
+        });
+        var MSG_INVALIDPRICE = _("ERROR: Price is not a valid number, please check the price and try again!");
+    </script>
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]
index 8ead4d8..6b9f873 100644 (file)
@@ -1,45 +1,8 @@
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( opsearch ) %]Order from external source[% ELSE %]Order from external source &rsaquo; Search results[% END %]</title>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'datatables.inc' %]
-
-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min_[% KOHA_VERSION %].js"></script>
-<script type="text/javascript">
-//<![CDATA[
-    $(document).ready(function(){
-
-    var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
-        "aoColumnDefs": [
-            { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
-            { "aTargets": [ 1 ], "sType": "nsb-nse" },
-        ],
-        "aaSorting": [[ 1, "asc" ]],
-        "bPaginate": false
-    } ) );
-        /* Inline edit/delete links */
-        $("td").click(function(event){
-            var $tgt = $(event.target);
-            var row = $(this).parent();
-            $(".linktools").hide();
-            $("tr").removeClass("selected");
-            row.addClass("selected");
-            if($tgt.is("a")||$tgt.is(":nth-child(6)")||$tgt.is(":nth-child(7)")){
-                //Don't show inline links for cells containing links of their own.
-            } else {
-                var position = $(this).offset();
-                var top = position.top+5;
-                var left = position.left+5;
-                $(".linktools",row).show().css("position","absolute").css("top",top).css("left",left);
-            }
-        });
-
-});
-
-//]]>
-</script>
-[% INCLUDE 'z3950_search.inc' %]
-<script type="text/javascript" src="[% interface %]/[% theme %]/js/z3950_search_[% KOHA_VERSION %].js"></script>
 <style type="text/css">
 .linktools { background-color:#FFF;border-top:1px solid #DDD; border-left: 1px solid #DDD; border-right: 1px solid #666; border-bottom:1px solid #666;display: none; white-space: nowrap;}
 .linktools a { font-size : 85%; text-decoration:none; padding:.3em;;background-color:#FFF; display:block;float:left;border-right:1px solid #DDD;}
@@ -47,6 +10,7 @@
 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : transparent !important; } #dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }
 </style>
 </head>
+
 <body id="acq_z3950_search" class="acq">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'acquisitions-search.inc' %]
@@ -222,6 +186,40 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
 </div>
 [% IF ( numberpending ) %]<h3 align="center">Still [% numberpending %] servers to search</h3>[% END %]
 
-</body>
-</html>
+[% MACRO jsinclude BLOCK %]
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
+    [% INCLUDE 'datatables.inc' %]
+    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min_[% KOHA_VERSION %].js"></script>
+    <script type="text/javascript">
+        $(document).ready(function(){
+            var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
+                "aoColumnDefs": [
+                    { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
+                    { "aTargets": [ 1 ], "sType": "nsb-nse" },
+                ],
+                "aaSorting": [[ 1, "asc" ]],
+                "bPaginate": false
+            }));
+            /* Inline edit/delete links */
+            $("td").click(function(event){
+                var $tgt = $(event.target);
+                var row = $(this).parent();
+                $(".linktools").hide();
+                $("tr").removeClass("selected");
+                row.addClass("selected");
+                if($tgt.is("a")||$tgt.is(":nth-child(6)")||$tgt.is(":nth-child(7)")){
+                    //Don't show inline links for cells containing links of their own.
+                } else {
+                    var position = $(this).offset();
+                    var top = position.top+5;
+                    var left = position.left+5;
+                    $(".linktools",row).show().css("position","absolute").css("top",top).css("left",left);
+                }
+            });
+        });
+    </script>
+    [% INCLUDE 'z3950_search.inc' %]
+    <script type="text/javascript" src="[% interface %]/[% theme %]/js/z3950_search_[% KOHA_VERSION %].js"></script>
+[% END %]
 
+[% INCLUDE 'intranet-bottom.inc' %]
\ No newline at end of file