View | Details | Raw Unified | Return to bug 19754
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (-79 / +82 lines)
Lines 1-89 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Branches %]
2
[% USE Branches %]
3
3
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Acquisitions &rsaquo; Invoices</title>
5
<title>Koha &rsaquo; Acquisitions &rsaquo; Invoices</title>
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
7
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'datatables.inc' %]
9
[% INCLUDE 'calendar.inc' %]
10
<script type="text/javascript">
11
//<![CDATA[
12
$(document).ready(function() {
13
    $(".delete_invoice").click(function(){
14
        return confirmDelete(_("Are you sure you want to delete this invoice?"));
15
    });
16
17
    var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
18
        bPaginate: false,
19
        aoColumnDefs: [
20
            { "bSortable": false, "aTargets": [1, -1] },
21
            { "bVisible": false, "aTargets": [0] },
22
            { "sType": "title-string", "aTargets" : [ "title-string" ] }
23
        ]
24
    }));
25
26
    $("#show_only_subscription").prop("checked", false);
27
8
28
    $("#show_only_subscription").click(function(){
29
        if ( $(this).prop("checked") ) {
30
            resultst.fnFilter( "1", 0, true );
31
        } else {
32
            resultst.fnFilter( '', 0 );
33
        }
34
    });
35
36
    $('#merge').click(function (ev) {
37
        var booksellerid;
38
        var mismatch;
39
        var invoices = [ ];
40
        if ($('.select-invoice:checked').size() < 2) {
41
            alert(_("You must select at least two invoices to merge."));
42
            return false;
43
        }
44
        $('.select-invoice:checked').each(function () {
45
            var row = $(this).parents('tr');
46
            booksellerid = booksellerid || $(row).attr('data-booksellerid');
47
            if (booksellerid !== $(row).attr('data-booksellerid')) {
48
                mismatch = true;
49
            }
50
            invoices.push({ 'invoiceid': $(row).attr('data-invoiceid'),
51
                            'invoicenumber': $(row).find('td:nth-child(2) a').text(),
52
                            'shipmentdate': $(row).attr('data-shipmentdate'),
53
                            'billingdate': $(row).attr('data-billingdate'),
54
                            'shipmentcost': $(row).attr('data-shipmentcost'),
55
                            'shipment_budgetid': $(row).attr('data-shipment_budgetid'),
56
                            'closedate': $(row).attr('data-closedate'), });
57
            $('#merge_invoice_form').append('<input type="hidden" name="merge" value="' + $(row).attr('data-invoiceid') + '" />');
58
        });
59
        if (mismatch) {
60
            alert(_("All invoices for merging must be from the same vendor"));
61
        } else {
62
            $('#merge_table tbody').empty();
63
            $.each(invoices, function (idx, invoice) {
64
                var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>');
65
                $(row).appendTo('#merge_table tbody');
66
                $(row).click(function () {
67
                    $('#merge_table tbody tr').removeClass('active');
68
                    $(this).addClass('active');
69
                    $('#merge_invoicenumber').text(invoice.invoicenumber);
70
                    $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid'], function (idx, prop) {
71
                        $('#merge_' + prop).val(invoice[prop]);
72
                    });
73
                    if (invoice.closedate) {
74
                        $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
75
                    } else {
76
                        $('#merge_status').text(_("Open"));
77
                    }
78
                });
79
            });
80
            $('#merge_table tbody tr:first').click();
81
            $('#merge_invoices').show();
82
        }
83
    });
84
});
85
//]]>
86
</script>
87
</head>
9
</head>
88
10
89
<body id="acq_invoices" class="acq">
11
<body id="acq_invoices" class="acq">
Lines 367-370 $(document).ready(function() { Link Here
367
    [% INCLUDE 'acquisitions-menu.inc' %]
289
    [% INCLUDE 'acquisitions-menu.inc' %]
368
  </div>
290
  </div>
369
</div>
291
</div>
292
293
[% MACRO jsinclude BLOCK %]
294
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
295
    [% INCLUDE 'datatables.inc' %]
296
    [% INCLUDE 'calendar.inc' %]
297
    <script type="text/javascript">
298
        $(document).ready(function() {
299
            $(".delete_invoice").click(function(){
300
                return confirmDelete(_("Are you sure you want to delete this invoice?"));
301
            });
302
            var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
303
                bPaginate: false,
304
                aoColumnDefs: [
305
                    { "bSortable": false, "aTargets": [1, -1] },
306
                    { "bVisible": false, "aTargets": [0] },
307
                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
308
                ]
309
            }));
310
311
            $("#show_only_subscription").prop("checked", false);
312
313
            $("#show_only_subscription").click(function(){
314
                if ( $(this).prop("checked") ) {
315
                    resultst.fnFilter( "1", 0, true );
316
                } else {
317
                    resultst.fnFilter( '', 0 );
318
                }
319
            });
320
321
            $('#merge').click(function (ev) {
322
                var booksellerid;
323
                var mismatch;
324
                var invoices = [ ];
325
                if ($('.select-invoice:checked').size() < 2) {
326
                    alert(_("You must select at least two invoices to merge."));
327
                    return false;
328
                }
329
                $('.select-invoice:checked').each(function () {
330
                    var row = $(this).parents('tr');
331
                    booksellerid = booksellerid || $(row).attr('data-booksellerid');
332
                    if (booksellerid !== $(row).attr('data-booksellerid')) {
333
                        mismatch = true;
334
                    }
335
                    invoices.push({ 'invoiceid': $(row).attr('data-invoiceid'),
336
                                    'invoicenumber': $(row).find('td:nth-child(2) a').text(),
337
                                    'shipmentdate': $(row).attr('data-shipmentdate'),
338
                                    'billingdate': $(row).attr('data-billingdate'),
339
                                    'shipmentcost': $(row).attr('data-shipmentcost'),
340
                                    'shipment_budgetid': $(row).attr('data-shipment_budgetid'),
341
                                    'closedate': $(row).attr('data-closedate'), });
342
                    $('#merge_invoice_form').append('<input type="hidden" name="merge" value="' + $(row).attr('data-invoiceid') + '" />');
343
                });
344
                if (mismatch) {
345
                    alert(_("All invoices for merging must be from the same vendor"));
346
                } else {
347
                    $('#merge_table tbody').empty();
348
                    $.each(invoices, function (idx, invoice) {
349
                        var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>');
350
                        $(row).appendTo('#merge_table tbody');
351
                        $(row).click(function () {
352
                            $('#merge_table tbody tr').removeClass('active');
353
                            $(this).addClass('active');
354
                            $('#merge_invoicenumber').text(invoice.invoicenumber);
355
                            $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid'], function (idx, prop) {
356
                                $('#merge_' + prop).val(invoice[prop]);
357
                            });
358
                            if (invoice.closedate) {
359
                                $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
360
                            } else {
361
                                $('#merge_status').text(_("Open"));
362
                            }
363
                        });
364
                    });
365
                    $('#merge_table tbody tr:first').click();
366
                    $('#merge_invoices').show();
367
                }
368
            });
369
        });
370
    </script>
371
[% END %]
372
370
[% INCLUDE 'intranet-bottom.inc' %]
373
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt (-62 / +66 lines)
Lines 1-73 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE ColumnsSettings %]
3
[% USE ColumnsSettings %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Acquisitions &rsaquo; Late orders</title>
6
<title>Koha &rsaquo; Acquisitions &rsaquo; Late orders</title>
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
7
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
7
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'datatables.inc' %]
9
[% INCLUDE 'columns_settings.inc' %]
10
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min_[% KOHA_VERSION %].js"></script>
11
[% INCLUDE 'calendar.inc' %]
12
<script type="text/javascript">
13
//<![CDATA[
14
15
var late_orderst;
16
function check_uncheck() {
17
    var all_nodes = $(late_orderst.fnGetNodes());
18
    if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
19
        var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
20
        $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
21
    } else {
22
        $("input:checkbox[name=ordernumber]").prop('disabled', false);
23
    }
24
}
25
26
$(document).ready(function() {
27
28
    var columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) %];
29
    late_orderst = KohaTable("#late_orders", {
30
        "aoColumnDefs": [
31
            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
32
            { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
33
            { "sType": "title-string", "aTargets" : [ "title-string" ] }
34
        ],
35
        "sPaginationType": "four_button",
36
        "bAutoWidth": false,
37
        "fnDrawCallback": function() {
38
            if ( typeof late_orderst != 'undefined' ) {
39
                check_uncheck();
40
                $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
41
            };
42
        }
43
    }, columns_settings );
44
    $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
45
    $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
46
    $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
47
48
    // Generates a dynamic link for exporting the selection's data as CSV
49
    $("#ExportSelected").click(function() {
50
        var all_nodes = $(late_orderst.fnGetNodes());
51
        var selected = $(all_nodes).find("input[name='ordernumber']:checked");
52
53
        if (selected.length == 0) {
54
            alert(_("Please select at least one item to export."));
55
            return false;
56
        }
57
58
        // Building the url from currently checked boxes
59
        var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export';
60
        for (var i = 0; i < selected.length; i++) {
61
            url += '&amp;ordernumber=' + selected[i].value;
62
        }
63
        // And redirecting to the CSV page
64
        location.href = url;
65
        return false;
66
    });
67
});
68
//]]>
69
</script>
70
</head>
9
</head>
10
71
<body id="acq_lateorders" class="acq">
11
<body id="acq_lateorders" class="acq">
72
[% INCLUDE 'header.inc' %]
12
[% INCLUDE 'header.inc' %]
73
[% INCLUDE 'acquisitions-search.inc' %]
13
[% INCLUDE 'acquisitions-search.inc' %]
Lines 249-252 $(document).ready(function() { Link Here
249
[% INCLUDE 'acquisitions-menu.inc' %]
189
[% INCLUDE 'acquisitions-menu.inc' %]
250
</div>
190
</div>
251
</div>
191
</div>
192
193
[% MACRO jsinclude BLOCK %]
194
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
195
    [% INCLUDE 'datatables.inc' %]
196
    [% INCLUDE 'columns_settings.inc' %]
197
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min_[% KOHA_VERSION %].js"></script>
198
    [% INCLUDE 'calendar.inc' %]
199
    <script type="text/javascript">
200
        var late_orderst;
201
        function check_uncheck() {
202
            var all_nodes = $(late_orderst.fnGetNodes());
203
            if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
204
                var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
205
                $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
206
            } else {
207
                $("input:checkbox[name=ordernumber]").prop('disabled', false);
208
            }
209
        }
210
211
        $(document).ready(function() {
212
213
            var columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) %];
214
            late_orderst = KohaTable("#late_orders", {
215
                "aoColumnDefs": [
216
                    { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
217
                    { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
218
                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
219
                ],
220
                "sPaginationType": "four_button",
221
                "bAutoWidth": false,
222
                "fnDrawCallback": function() {
223
                    if ( typeof late_orderst != 'undefined' ) {
224
                        check_uncheck();
225
                        $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
226
                    };
227
                }
228
            }, columns_settings );
229
            $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
230
            $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
231
            $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
232
233
            // Generates a dynamic link for exporting the selection's data as CSV
234
            $("#ExportSelected").click(function() {
235
                var all_nodes = $(late_orderst.fnGetNodes());
236
                var selected = $(all_nodes).find("input[name='ordernumber']:checked");
237
238
                if (selected.length == 0) {
239
                    alert(_("Please select at least one item to export."));
240
                    return false;
241
                }
242
243
                // Building the url from currently checked boxes
244
                var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export';
245
                for (var i = 0; i < selected.length; i++) {
246
                    url += '&amp;ordernumber=' + selected[i].value;
247
                }
248
                // And redirecting to the CSV page
249
                location.href = url;
250
                return false;
251
            });
252
        });
253
    </script>
254
[% END %]
255
252
[% INCLUDE 'intranet-bottom.inc' %]
256
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt (-26 / +31 lines)
Lines 1-34 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Acquisitions &rsaquo; Search existing records</title>
3
<title>Koha &rsaquo; Acquisitions &rsaquo; Search existing records</title>
3
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
4
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'datatables.inc' %]
6
<script type="text/javascript">
7
//<![CDATA[
8
 $(document).ready(function() {
9
    var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
10
        'sDom': 't',
11
        'bPaginate': false,
12
        'bFilter': false,
13
        'bInfo': false,
14
        'bSort': false,
15
    } ) );
16
    $(".previewMARC").on("click", function(e){
17
        e.preventDefault();
18
        var ltitle = $(this).text();
19
        var page = $(this).attr("href");
20
        $("#marcPreviewLabel").text(ltitle);
21
        $("#marcPreview .modal-body").load(page + " table");
22
        $('#marcPreview').modal({show:true});
23
    });
24
    $("#marcPreview").on("hidden", function(){
25
        $("#marcPreviewLabel").html("");
26
        $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
27
    });
28
 });
29
 //]]>
30
</script>
31
</head>
6
</head>
7
32
<body id="acq_neworderbiblio" class="acq">
8
<body id="acq_neworderbiblio" class="acq">
33
[% INCLUDE 'header.inc' %]
9
[% INCLUDE 'header.inc' %]
34
[% INCLUDE 'acquisitions-search.inc' %]
10
[% INCLUDE 'acquisitions-search.inc' %]
Lines 129-132 Link Here
129
[% INCLUDE 'acquisitions-menu.inc' %]
105
[% INCLUDE 'acquisitions-menu.inc' %]
130
</div>
106
</div>
131
</div>
107
</div>
108
109
[% MACRO jsinclude BLOCK %]
110
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
111
    [% INCLUDE 'datatables.inc' %]
112
    <script type="text/javascript">
113
         $(document).ready(function() {
114
            var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
115
                'sDom': 't',
116
                'bPaginate': false,
117
                'bFilter': false,
118
                'bInfo': false,
119
                'bSort': false,
120
            } ) );
121
            $(".previewMARC").on("click", function(e){
122
                e.preventDefault();
123
                var ltitle = $(this).text();
124
                var page = $(this).attr("href");
125
                $("#marcPreviewLabel").text(ltitle);
126
                $("#marcPreview .modal-body").load(page + " table");
127
                $('#marcPreview').modal({show:true});
128
            });
129
            $("#marcPreview").on("hidden", function(){
130
                $("#marcPreviewLabel").html("");
131
                $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
132
            });
133
         });
134
    </script>
135
[% END %]
136
132
[% INCLUDE 'intranet-bottom.inc' %]
137
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-195 / +194 lines)
Lines 1-203 Link Here
1
[% USE Koha %]
1
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
3
[% USE Koha %]
4
<title>Koha &rsaquo; Acquisitions &rsaquo; Basket [% basketno %] &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</title>
5
<title>Koha &rsaquo; Acquisitions &rsaquo; Basket [% basketno %] &rsaquo; [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
6
7
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
8
[% INCLUDE 'additem.js.inc' %]
9
<script type="text/javascript" src="[% interface %]/[% theme %]/js/additem_[% KOHA_VERSION %].js"></script>
10
<script type="text/javascript" src="[% interface %]/[% theme %]/js/cataloging_[% KOHA_VERSION %].js"></script>
11
<script type="text/javascript" src="[% interface %]/[% theme %]/js/prevent_submit_[% KOHA_VERSION %].js"></script>
12
<script type="text/javascript">
13
//<![CDATA[
14
actTotal = "";
15
16
function Check(ff) {
17
    [% IF (AcqCreateItemOrdering) %]
18
        // Remove last itemblock if it is not in items_list
19
        var lastitemblock = $("#outeritemblock > div:last");
20
        var tobedeleted = true;
21
        var listitems = $("#items_list tr");
22
        $(listitems).each(function(){
23
            if($(this).attr('idblock') == $(lastitemblock).attr('id')){
24
                tobedeleted = false;
25
            }
26
        });
27
        if(tobedeleted){
28
            $(lastitemblock).remove();
29
        }
30
    [% END %]
31
32
    var ok=0;
33
    var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
34
35
    _alertString +="-------------------------------------------------------------------\n\n";
36
37
    if ( isNull(ff.title,1)  &&  isNull(ff.entertitle,1)   ){
38
        ok=1;
39
                    _alertString += "\n- " + _("Title cannot be empty");
40
    }
41
    
42
    if(isNull(ff.budget_id,1)){
43
		ok=1;
44
        _alertString += "\n- "+ _("You must select a fund");
45
    }
46
47
    if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
48
        ok=1;
49
                    _alertString += "\n- " + _("Quantity must be greater than '0'");
50
    }
51
52
    if (!(isNum(ff.listprice,0))){
53
        ok=1;
54
                    _alertString += "\n- " + _("Vendor price must be a number");
55
    }
56
57
    if (!(isNum(ff.total,0))){
58
        ok=1;
59
                    _alertString += "\n- " + _("Total must be a number");
60
    }
61
62
    if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
63
        ok=1;
64
        _alertString += "\n- " + _("Order total (%s) exceeds budget available (%s)").format(ff.total.value, actTotal);
65
    }
66
67
    if ( ff.field_value ) {
68
        var empty_item_mandatory = CheckMandatorySubfields(ff);
69
        if (empty_item_mandatory > 0) {
70
            ok = 1;
71
            _alertString +=
72
                "\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory);
73
        }
74
75
    }
76
77
    if (ok) {
78
        alert(_alertString);
79
        [% IF (AcqCreateItemOrdering) %]
80
            if(tobedeleted) {
81
                $(lastitemblock).appendTo('#outeritemblock');
82
            }
83
        [% END %]
84
        return false;
85
    }
86
87
    [% IF (AcqCreateItemOrdering) %]
88
        if(check_additem('[% UniqueItemFields %]') == false) {
89
            alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
90
            if(tobedeleted) {
91
                $(lastitemblock).appendTo('#outeritemblock');
92
            }
93
            return false;
94
        }
95
    [% END %]
96
}
97
98
$(document).ready(function() 
99
    {
100
        [% IF AcqCreateItemOrdering and not basket.is_standing %]
101
            cloneItemBlock(0, '[% UniqueItemFields %]');
102
        [% END %]
103
104
        [% IF ( suggestionid ) %]updateCosts();[% END %]
105
        $("#quantity").change(function() {
106
            updateCosts();
107
        });
108
109
        //We apply the fonction only for modify option
110
        [% IF ( quantityrec ) %]
111
        [% IF ( acqcreate ) %]
112
        $('#quantity').blur(function() 
113
        {
114
            // if user decreases the quantity
115
            if($(this).val() < [% quantityrec %]) 
116
            {
117
                alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
118
                return true;
119
            } 
120
            else 
121
            {
122
                // if user increases the quantity
123
                alert(_("You can't add a new item, please create a new order line"));
124
                // and we replace the original value
125
                $(this).val([% quantityrec %])
126
                updateCosts(); // blur is invoked after change which updated values
127
                return false;
128
            }
129
        });
130
        [% END %]
131
        [% END %]
132
        
133
        //keep a copy of all budgets before removing the inactives
134
        disabledBudgetsCopy = $('#budget_id').html();
135
        $('#budget_id .b_inactive').remove();
136
137
        $('#showallbudgets').click(function() {
138
            if ($(this).is(":checked")) {
139
                $('#budget_id').html(disabledBudgetsCopy); //Puts back all the funds
140
            }
141
            else {
142
                $('#budget_id .b_inactive').remove();
143
            }
144
        });
145
146
        $("#budget_id").change(function(){
147
            var destination_sort1 = $(this).parents('fieldset.rows').find('input[name="sort1"]');
148
            var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
149
            var sort1 = $(destination_sort1).val() || "";
150
            if ( destination_sort1.length < 1 ) {
151
                destination_sort1 = $(this).parents('fieldset.rows').find('select[name="sort1"]');
152
            }
153
            var destination_sort2 = $(this).parents('fieldset.rows').find('input[name="sort2"]');
154
            var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
155
            var sort2 = $(destination_sort2).val() || "";
156
            if ( destination_sort2.length < 1 ) {
157
                destination_sort2 = $(this).parents('fieldset.rows').find('select[name="sort2"]');
158
            }
159
            getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
160
            getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
161
        });
162
        $("#budget_id").change();
163
    });
164
165
    function UserSearchPopup(f) {
166
        window.open(
167
            "/cgi-bin/koha/acqui/add_user_search.pl",
168
            'UserSearchPopup',
169
            'width=740, height=450, scrollbars=yes, toolbar=no,'
170
         );
171
    }
172
173
    function add_user(borrowernumber, borrowername) {
174
        var ids = $("#users_ids").val();
175
        if(ids.length > 0) {
176
            ids = ids.split(':');
177
        } else {
178
            ids = new Array;
179
        }
180
        if (ids.indexOf(borrowernumber) < 0) {
181
            ids.push(borrowernumber);
182
            $("#users_ids").val(ids.join(':'));
183
            var li = '<li id="user_'+borrowernumber+'">'+borrowername
184
                + ' [<a style="cursor:pointer" onclick="del_user('+borrowernumber+');">'
185
                + _("Delete user") + '</a>]</li>';
186
            $("#users_names").append(li);
187
            return 0;
188
        }
189
        return -1;
190
    }
191
192
    function del_user(borrowernumber) {
193
      $("#user_"+borrowernumber).remove();
194
      var ids = $("#users_ids").val().split(':');
195
      ids.splice(ids.indexOf(borrowernumber.toString()), 1);
196
      $("#users_ids").val(ids.join(':'));
197
    }
198
//]]>
199
</script>
200
</head>
7
</head>
8
201
<body id="acq_neworderempty" class="acq">
9
<body id="acq_neworderempty" class="acq">
202
10
203
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
Lines 679-682 $(document).ready(function() Link Here
679
[% INCLUDE 'acquisitions-menu.inc' %]
487
[% INCLUDE 'acquisitions-menu.inc' %]
680
</div>
488
</div>
681
</div>
489
</div>
490
491
[% MACRO jsinclude BLOCK %]
492
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
493
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq_[% KOHA_VERSION %].js"></script>
494
    [% INCLUDE 'additem.js.inc' %]
495
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/additem_[% KOHA_VERSION %].js"></script>
496
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/cataloging_[% KOHA_VERSION %].js"></script>
497
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/prevent_submit_[% KOHA_VERSION %].js"></script>
498
    <script type="text/javascript">
499
        actTotal = "";
500
501
        function Check(ff) {
502
            [% IF (AcqCreateItemOrdering) %]
503
                // Remove last itemblock if it is not in items_list
504
                var lastitemblock = $("#outeritemblock > div:last");
505
                var tobedeleted = true;
506
                var listitems = $("#items_list tr");
507
                $(listitems).each(function(){
508
                    if($(this).attr('idblock') == $(lastitemblock).attr('id')){
509
                        tobedeleted = false;
510
                    }
511
                });
512
                if(tobedeleted){
513
                    $(lastitemblock).remove();
514
                }
515
            [% END %]
516
517
            var ok=0;
518
            var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
519
520
            _alertString +="-------------------------------------------------------------------\n\n";
521
522
            if ( isNull(ff.title,1)  &&  isNull(ff.entertitle,1)   ){
523
                ok=1;
524
                            _alertString += "\n- " + _("Title cannot be empty");
525
            }
526
527
            if(isNull(ff.budget_id,1)){
528
                ok=1;
529
                _alertString += "\n- "+ _("You must select a fund");
530
            }
531
532
            if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
533
                ok=1;
534
                            _alertString += "\n- " + _("Quantity must be greater than '0'");
535
            }
536
537
            if (!(isNum(ff.listprice,0))){
538
                ok=1;
539
                            _alertString += "\n- " + _("Vendor price must be a number");
540
            }
541
542
            if (!(isNum(ff.total,0))){
543
                ok=1;
544
                            _alertString += "\n- " + _("Total must be a number");
545
            }
546
547
            if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
548
                ok=1;
549
                _alertString += "\n- " + _("Order total (%s) exceeds budget available (%s)").format(ff.total.value, actTotal);
550
            }
551
552
            if ( ff.field_value ) {
553
                var empty_item_mandatory = CheckMandatorySubfields(ff);
554
                if (empty_item_mandatory > 0) {
555
                    ok = 1;
556
                    _alertString +=
557
                        "\n- " + _("%s item mandatory fields empty").format(empty_item_mandatory);
558
                }
559
560
            }
561
562
            if (ok) {
563
                alert(_alertString);
564
                [% IF (AcqCreateItemOrdering) %]
565
                    if(tobedeleted) {
566
                        $(lastitemblock).appendTo('#outeritemblock');
567
                    }
568
                [% END %]
569
                return false;
570
            }
571
572
            [% IF (AcqCreateItemOrdering) %]
573
                if(check_additem('[% UniqueItemFields %]') == false) {
574
                    alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
575
                    if(tobedeleted) {
576
                        $(lastitemblock).appendTo('#outeritemblock');
577
                    }
578
                    return false;
579
                }
580
            [% END %]
581
        }
582
583
        $(document).ready(function(){
584
            [% IF AcqCreateItemOrdering and not basket.is_standing %]
585
                cloneItemBlock(0, '[% UniqueItemFields %]');
586
            [% END %]
587
588
            [% IF ( suggestionid ) %]updateCosts();[% END %]
589
            $("#quantity").change(function() {
590
                updateCosts();
591
            });
592
593
            //We apply the fonction only for modify option
594
            [% IF ( quantityrec ) %]
595
                [% IF ( acqcreate ) %]
596
                    $('#quantity').blur(function(){
597
                        // if user decreases the quantity
598
                        if($(this).val() < [% quantityrec %]){
599
                            alert(_("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"));
600
                            return true;
601
                        } else {
602
                            // if user increases the quantity
603
                            alert(_("You can't add a new item, please create a new order line"));
604
                            // and we replace the original value
605
                            $(this).val([% quantityrec %])
606
                            updateCosts(); // blur is invoked after change which updated values
607
                            return false;
608
                        }
609
                    });
610
                [% END %]
611
            [% END %]
612
613
            //keep a copy of all budgets before removing the inactives
614
            disabledBudgetsCopy = $('#budget_id').html();
615
            $('#budget_id .b_inactive').remove();
616
617
            $('#showallbudgets').click(function() {
618
                if ($(this).is(":checked")) {
619
                    $('#budget_id').html(disabledBudgetsCopy); //Puts back all the funds
620
                }
621
                else {
622
                    $('#budget_id .b_inactive').remove();
623
                }
624
            });
625
626
            $("#budget_id").change(function(){
627
                var destination_sort1 = $(this).parents('fieldset.rows').find('input[name="sort1"]');
628
                var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
629
                var sort1 = $(destination_sort1).val() || "";
630
                if ( destination_sort1.length < 1 ) {
631
                    destination_sort1 = $(this).parents('fieldset.rows').find('select[name="sort1"]');
632
                }
633
                var destination_sort2 = $(this).parents('fieldset.rows').find('input[name="sort2"]');
634
                var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
635
                var sort2 = $(destination_sort2).val() || "";
636
                if ( destination_sort2.length < 1 ) {
637
                    destination_sort2 = $(this).parents('fieldset.rows').find('select[name="sort2"]');
638
                }
639
                getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
640
                getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
641
            });
642
            $("#budget_id").change();
643
        });
644
645
        function UserSearchPopup(f) {
646
            window.open(
647
                "/cgi-bin/koha/acqui/add_user_search.pl",
648
                'UserSearchPopup',
649
                'width=740, height=450, scrollbars=yes, toolbar=no,'
650
             );
651
        }
652
653
        function add_user(borrowernumber, borrowername) {
654
            var ids = $("#users_ids").val();
655
            if(ids.length > 0) {
656
                ids = ids.split(':');
657
            } else {
658
                ids = new Array;
659
            }
660
            if (ids.indexOf(borrowernumber) < 0) {
661
                ids.push(borrowernumber);
662
                $("#users_ids").val(ids.join(':'));
663
                var li = '<li id="user_'+borrowernumber+'">'+borrowername
664
                    + ' [<a style="cursor:pointer" onclick="del_user('+borrowernumber+');">'
665
                    + _("Delete user") + '</a>]</li>';
666
                $("#users_names").append(li);
667
                return 0;
668
            }
669
            return -1;
670
        }
671
672
        function del_user(borrowernumber) {
673
            $("#user_"+borrowernumber).remove();
674
            var ids = $("#users_ids").val().split(':');
675
            ids.splice(ids.indexOf(borrowernumber.toString()), 1);
676
            $("#users_ids").val(ids.join(':'));
677
        }
678
    </script>
679
[% END %]
680
682
[% INCLUDE 'intranet-bottom.inc' %]
681
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt (-31 / +36 lines)
Lines 1-42 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Serials [% biblionumber %]</title>
6
<title>Koha &rsaquo; Serials [% biblionumber %]</title>
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
7
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
7
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'datatables.inc' %]
9
<script type="text/javascript">
10
//<![CDATA[
11
    function updateRowsVisibility(show_only_renewed) {
12
        if ( show_only_renewed ) {
13
            $("#srlt [data-reneweddate='']").hide();
14
        } else {
15
            $("#srlt > tbody > tr").show();
16
        }
17
    }
18
19
    $(document).ready(function() {
20
        $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, {
21
            "aoColumnDefs": [
22
                { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
23
                { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
24
                { "sType": "title-string", "aTargets" : [ "title-string" ] }
25
            ],
26
            "sPaginationType": "four_button"
27
        } ) )
28
29
        $("#show_only_renewed").click(function(){
30
            updateRowsVisibility( $(this).is(":checked") );
31
        });
32
        $("#show_only_renewed").prop('checked', false);
33
        updateRowsVisibility(false);
34
35
        $("#advsearch_form").show();
36
    });
37
 //]]>
38
</script>
39
</head>
9
</head>
10
40
<body id="acq_newordersubscription" class="acq">
11
<body id="acq_newordersubscription" class="acq">
41
[% INCLUDE 'header.inc' %]
12
[% INCLUDE 'header.inc' %]
42
[% INCLUDE 'acquisitions-search.inc' %]
13
[% INCLUDE 'acquisitions-search.inc' %]
Lines 123-126 Link Here
123
        [% INCLUDE 'acquisitions-menu.inc' %]
94
        [% INCLUDE 'acquisitions-menu.inc' %]
124
    </div>
95
    </div>
125
</div>
96
</div>
97
98
[% MACRO jsinclude BLOCK %]
99
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
100
    [% INCLUDE 'datatables.inc' %]
101
    <script type="text/javascript">
102
        function updateRowsVisibility(show_only_renewed) {
103
            if ( show_only_renewed ) {
104
                $("#srlt [data-reneweddate='']").hide();
105
            } else {
106
                $("#srlt > tbody > tr").show();
107
            }
108
        }
109
110
        $(document).ready(function() {
111
            $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, {
112
                "aoColumnDefs": [
113
                    { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
114
                    { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
115
                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
116
                ],
117
                "sPaginationType": "four_button"
118
            }));
119
120
            $("#show_only_renewed").click(function(){
121
                updateRowsVisibility( $(this).is(":checked") );
122
            });
123
            $("#show_only_renewed").prop('checked', false);
124
            updateRowsVisibility(false);
125
126
            $("#advsearch_form").show();
127
        });
128
    </script>
129
[% END %]
130
126
[% INCLUDE 'intranet-bottom.inc' %]
131
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt (-22 / +27 lines)
Lines 1-30 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Acquisitions &rsaquo; Add order from a suggestion</title>
3
<title>Koha &rsaquo; Acquisitions &rsaquo; Add order from a suggestion</title>
3
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
4
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'datatables.inc' %]
6
<script type="text/javascript">
7
//<![CDATA[
8
 $(document).ready(function() {
9
    var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
10
        "aoColumnDefs": [
11
            { "aTargets": [ 0 ],  "bVisible": false, "bSearchable": true }, // must be searchable for fnFilter
12
            { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
13
        ],
14
        "sPaginationType": "four_button"
15
    } ) );
16
    $("#show_only_mine").on('click', function(e){
17
        e.preventDefault();
18
        suggestionst.fnFilter('^[% loggedinuser %]$', 0, true);
19
    });
20
    $("#show_all").on('click', function(e){
21
        e.preventDefault();
22
        suggestionst.fnFilter('', 0 );
23
    });
24
 });
25
 //]]>
26
</script>
27
</head>
6
</head>
7
28
<body id="acq_newordersuggestion" class="acq">
8
<body id="acq_newordersuggestion" class="acq">
29
[% INCLUDE 'header.inc' %]
9
[% INCLUDE 'header.inc' %]
30
[% INCLUDE 'suggestions-add-search.inc' %]
10
[% INCLUDE 'suggestions-add-search.inc' %]
Lines 92-95 Link Here
92
[% INCLUDE 'acquisitions-menu.inc' %]
72
[% INCLUDE 'acquisitions-menu.inc' %]
93
</div>
73
</div>
94
</div>
74
</div>
75
76
[% MACRO jsinclude BLOCK %]
77
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
78
    [% INCLUDE 'datatables.inc' %]
79
    <script type="text/javascript">
80
    $(document).ready(function() {
81
        var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, {
82
            "aoColumnDefs": [
83
                { "aTargets": [ 0 ],  "bVisible": false, "bSearchable": true }, // must be searchable for fnFilter
84
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
85
            ],
86
            "sPaginationType": "four_button"
87
        }));
88
        $("#show_only_mine").on('click', function(e){
89
            e.preventDefault();
90
            suggestionst.fnFilter('^[% loggedinuser %]$', 0, true);
91
        });
92
        $("#show_all").on('click', function(e){
93
            e.preventDefault();
94
            suggestionst.fnFilter('', 0 );
95
        });
96
     });
97
    </script>
98
[% END %]
99
95
[% INCLUDE 'intranet-bottom.inc' %]
100
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt (-14 / +19 lines)
Lines 1-24 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE ItemTypes %]
2
[% USE ItemTypes %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Acquisitions &rsaquo; Ordered</title>
5
<title>Koha &rsaquo; Acquisitions &rsaquo; Ordered</title>
5
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
6
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
6
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'datatables.inc' %]
8
<script type="text/javascript">
9
//<![CDATA[
10
 $(document).ready(function() {
11
    $("#spent").dataTable($.extend(true, {}, dataTablesDefaults, {
12
        "aoColumnDefs": [
13
            { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
14
            { "sType": "title-string", "aTargets" : [ "title-string" ] }
15
        ],
16
        "sPaginationType": "four_button"
17
    } ) );
18
 });
19
 //]]>
20
</script>
21
</head>
8
</head>
9
22
<body id="acq_ordered" class="acq">
10
<body id="acq_ordered" class="acq">
23
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
24
[% INCLUDE 'acquisitions-search.inc' %]
12
[% INCLUDE 'acquisitions-search.inc' %]
Lines 106-109 Link Here
106
[% INCLUDE 'acquisitions-menu.inc' %]
94
[% INCLUDE 'acquisitions-menu.inc' %]
107
</div>
95
</div>
108
</div>
96
</div>
97
98
[% MACRO jsinclude BLOCK %]
99
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
100
    [% INCLUDE 'datatables.inc' %]
101
    <script type="text/javascript">
102
        $(document).ready(function() {
103
            $("#spent").dataTable($.extend(true, {}, dataTablesDefaults, {
104
                "aoColumnDefs": [
105
                    { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
106
                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
107
                ],
108
                "sPaginationType": "four_button"
109
            }));
110
        });
111
    </script>
112
[% END %]
113
109
[% INCLUDE 'intranet-bottom.inc' %]
114
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-117 / +121 lines)
Lines 1-126 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE Price %]
3
[% USE Price %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Acquisitions &rsaquo; Receipt summary for : [% name %] [% IF ( invoice ) %]invoice, [% invoice %][% END %]</title>
6
<title>Koha &rsaquo; Acquisitions &rsaquo; Receipt summary for : [% name %] [% IF ( invoice ) %]invoice, [% invoice %][% END %]</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'calendar.inc' %]
8
[% INCLUDE 'additem.js.inc' %]
9
<script type="text/javascript" src="[% interface %]/[% theme %]/js/additem_[% KOHA_VERSION %].js"></script>
10
<script type="text/javascript" src="[% interface %]/[% theme %]/js/cataloging_[% KOHA_VERSION %].js"></script>
11
<script type="text/javascript" src="[% interface %]/[% theme %]/js/prevent_submit_[% KOHA_VERSION %].js"></script>
12
<script type="text/javascript">
13
//<![CDATA[
14
    function Check(form) {
15
        [% IF (AcqCreateItemReceiving) %]
16
            var total_errors = CheckMandatorySubfields(form);
17
            if (total_errors != 0) {
18
                var alertString = _("Form not submitted because of the following problem(s)");
19
                alertString += "\n------------------------------------------------------------------------------------\n";
20
                alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
21
                alert(alertString);
22
                return false;
23
            }
24
25
            if(check_additem('[% UniqueItemFields %]') == false){
26
                alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
27
                return false;
28
            };
29
30
            // Remove last itemblock if it is not in items_list
31
            var lastitemblock = $("#outeritemblock > div:last");
32
            var tobedeleted = true;
33
            var listitems = $("#items_list tr");
34
            $(listitems).each(function(){
35
                if($(this).attr('idblock') == $(lastitemblock).attr('id')){
36
                    tobedeleted = false;
37
                }
38
            });
39
            if(tobedeleted){
40
                $(lastitemblock).remove();
41
            }
42
43
            if(check_additem('[% UniqueItemFields %]') == false){
44
                alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
45
                if(tobedeleted) {
46
                    $(lastitemblock).appendTo("#outeritemblock");
47
                }
48
                return false;
49
            };
50
        [% END %]
51
52
        return true;
53
    }
54
55
    [% IF (AcqCreateItem == 'ordering') %]
56
        var items_columns = [null, null, 'barcode', 'homebranchname',
57
            'holdingbranchname', 'notforloan', 'restricted', 'location',
58
            'itemcallnumber', 'copynumber', 'stocknumber', 'collection',
59
            'itemtype', 'materials', 'itemnotes'];
60
61
        function PopupEditPage(biblionumber, itemnumber) {
62
            var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber="
63
                + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem";
64
            var w = window.open(url);
65
            var watchClose = setInterval(function() {
66
                if (w.closed) {
67
                    clearTimeout(watchClose);
68
                    $.getJSON('/cgi-bin/koha/catalogue/getitem-ajax.pl',
69
                        {
70
                            'itemnumber': itemnumber
71
                        },
72
                        function(item) {
73
                            var tds = $("#item_"+itemnumber+" td");
74
                            for(var i=2; i<tds.length; i++) {
75
                                var column = items_columns[i];
76
                                var text = item[column];
77
                                if ( text == null ) text = '';
78
                                $(tds[i]).text(text);
79
                            }
80
                        }
81
                    );
82
                }
83
            }, 500);
84
        }
85
86
        function CalcQtyToReceive() {
87
            var qty = $("input[name='items_to_receive']:checked").length;
88
            $("#quantity").val(qty);
89
        }
90
91
        function CheckNItems(n) {
92
            $("input[name='items_to_receive']").each(function() {
93
                $(this).prop('checked', false);
94
            });
95
            $("input[name='items_to_receive']:lt("+n+")").each(function () {
96
                $(this).prop('checked', true);
97
            });
98
        }
99
    [% END %]
100
101
    $(document).ready(function() {
102
        [% IF (AcqCreateItemReceiving) %]
103
            cloneItemBlock(0, '[% UniqueItemFields %]');
104
        [% ELSIF (AcqCreateItem == 'ordering') && not subscriptionid %]
105
            $("input[name='items_to_receive']").change(function() {
106
                CalcQtyToReceive();
107
            });
108
            CalcQtyToReceive();
109
            $("#quantity").keyup(function() {
110
                var qty = parseInt($("#quantity").val());
111
                var qtyto = parseInt($("#quantity_to_receive").val());
112
                if(qty > qtyto) {
113
                    $("#qtyrecerror").show();
114
                } else {
115
                    $("#qtyrecerror").hide();
116
                }
117
                CheckNItems($(this).val());
118
            });
119
        [% END %]
120
    });
121
//]]>
122
</script>
123
</head>
8
</head>
9
124
<body id="acq_orderreceive" class="acq">
10
<body id="acq_orderreceive" class="acq">
125
[% INCLUDE 'header.inc' %]
11
[% INCLUDE 'header.inc' %]
126
[% INCLUDE 'acquisitions-search.inc' %]
12
[% INCLUDE 'acquisitions-search.inc' %]
Lines 374-377 Link Here
374
[% INCLUDE 'acquisitions-menu.inc' %]
260
[% INCLUDE 'acquisitions-menu.inc' %]
375
</div>
261
</div>
376
</div>
262
</div>
263
264
[% MACRO jsinclude BLOCK %]
265
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
266
[% INCLUDE 'calendar.inc' %]
267
    [% INCLUDE 'additem.js.inc' %]
268
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/additem_[% KOHA_VERSION %].js"></script>
269
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/cataloging_[% KOHA_VERSION %].js"></script>
270
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/prevent_submit_[% KOHA_VERSION %].js"></script>
271
    <script type="text/javascript">
272
        function Check(form) {
273
            [% IF (AcqCreateItemReceiving) %]
274
                var total_errors = CheckMandatorySubfields(form);
275
                if (total_errors != 0) {
276
                    var alertString = _("Form not submitted because of the following problem(s)");
277
                    alertString += "\n------------------------------------------------------------------------------------\n";
278
                    alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
279
                    alert(alertString);
280
                    return false;
281
                }
282
283
                if(check_additem('[% UniqueItemFields %]') == false){
284
                    alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
285
                    return false;
286
                };
287
288
                // Remove last itemblock if it is not in items_list
289
                var lastitemblock = $("#outeritemblock > div:last");
290
                var tobedeleted = true;
291
                var listitems = $("#items_list tr");
292
                $(listitems).each(function(){
293
                    if($(this).attr('idblock') == $(lastitemblock).attr('id')){
294
                        tobedeleted = false;
295
                    }
296
                });
297
                if(tobedeleted){
298
                    $(lastitemblock).remove();
299
                }
300
301
                if(check_additem('[% UniqueItemFields %]') == false){
302
                    alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
303
                    if(tobedeleted) {
304
                        $(lastitemblock).appendTo("#outeritemblock");
305
                    }
306
                    return false;
307
                };
308
            [% END %]
309
310
            return true;
311
        }
312
313
        [% IF (AcqCreateItem == 'ordering') %]
314
            var items_columns = [null, null, 'barcode', 'homebranchname',
315
                'holdingbranchname', 'notforloan', 'restricted', 'location',
316
                'itemcallnumber', 'copynumber', 'stocknumber', 'collection',
317
                'itemtype', 'materials', 'itemnotes'];
318
319
            function PopupEditPage(biblionumber, itemnumber) {
320
                var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber="
321
                    + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem";
322
                var w = window.open(url);
323
                var watchClose = setInterval(function() {
324
                    if (w.closed) {
325
                        clearTimeout(watchClose);
326
                        $.getJSON('/cgi-bin/koha/catalogue/getitem-ajax.pl',
327
                            {
328
                                'itemnumber': itemnumber
329
                            },
330
                            function(item) {
331
                                var tds = $("#item_"+itemnumber+" td");
332
                                for(var i=2; i<tds.length; i++) {
333
                                    var column = items_columns[i];
334
                                    var text = item[column];
335
                                    if ( text == null ) text = '';
336
                                    $(tds[i]).text(text);
337
                                }
338
                            }
339
                        );
340
                    }
341
                }, 500);
342
            }
343
344
            function CalcQtyToReceive() {
345
                var qty = $("input[name='items_to_receive']:checked").length;
346
                $("#quantity").val(qty);
347
            }
348
349
            function CheckNItems(n) {
350
                $("input[name='items_to_receive']").each(function() {
351
                    $(this).prop('checked', false);
352
                });
353
                $("input[name='items_to_receive']:lt("+n+")").each(function () {
354
                    $(this).prop('checked', true);
355
                });
356
            }
357
        [% END %]
358
359
        $(document).ready(function() {
360
            [% IF (AcqCreateItemReceiving) %]
361
                cloneItemBlock(0, '[% UniqueItemFields %]');
362
            [% ELSIF (AcqCreateItem == 'ordering') && not subscriptionid %]
363
                $("input[name='items_to_receive']").change(function() {
364
                    CalcQtyToReceive();
365
                });
366
                CalcQtyToReceive();
367
                $("#quantity").keyup(function() {
368
                    var qty = parseInt($("#quantity").val());
369
                    var qtyto = parseInt($("#quantity_to_receive").val());
370
                    if(qty > qtyto) {
371
                        $("#qtyrecerror").show();
372
                    } else {
373
                        $("#qtyrecerror").hide();
374
                    }
375
                    CheckNItems($(this).val());
376
                });
377
            [% END %]
378
        });
379
    </script>
380
[% END %]
381
377
[% INCLUDE 'intranet-bottom.inc' %]
382
[% INCLUDE 'intranet-bottom.inc' %]
378
- 

Return to bug 19754