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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-32 / +25 lines)
Lines 333-345 Link Here
333
        dt_overwrite_html_sorting_localeCompare();
333
        dt_overwrite_html_sorting_localeCompare();
334
        var columns_filter = {};
334
        var columns_filter = {};
335
335
336
        function _escape_str(s){
337
            return s != null ? s.escapeHtml() : "";
338
        }
339
        function _escape_price(p){
340
            return p != null ? p.escapeHtml().format_price() : "";
341
        }
342
343
        $(document).ready(function(){
336
        $(document).ready(function(){
344
337
345
            if ( $("#receivedt").length ) {
338
            if ( $("#receivedt").length ) {
Lines 400-414 Link Here
400
                    "searchable": true,
393
                    "searchable": true,
401
                      "orderable": true,
394
                      "orderable": true,
402
                      "render": function(data, type, row, meta) {
395
                      "render": function(data, type, row, meta) {
403
                        if (type != 'display') return _escape_str(data);
396
                        if (type != 'display') return escape_str(data);
404
                        return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + encodeURIComponent(row.basket.basket_id) + "\">" + _escape_str(data) + " (" + _escape_str(row.basket.basket_id) + ")</a>";
397
                        return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + encodeURIComponent(row.basket.basket_id) + "\">" + escape_str(data) + " (" + escape_str(row.basket.basket_id) + ")</a>";
405
                      }
398
                      }
406
                    },
399
                    },
407
                    { "data": "basket.basket_group.name",
400
                    { "data": "basket.basket_group.name",
408
                      "orderable": true,
401
                      "orderable": true,
409
                      "render": function(data, type, row, meta) {
402
                      "render": function(data, type, row, meta) {
410
                        if ( type != 'display' ) {
403
                        if ( type != 'display' ) {
411
                            return _escape_str(data);
404
                            return escape_str(data);
412
                        }
405
                        }
413
                        if ( row.basket.basket_group_id == null ) {
406
                        if ( row.basket.basket_group_id == null ) {
414
                            return _("No basket group");
407
                            return _("No basket group");
Lines 417-431 Link Here
417
                            return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid="
410
                            return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&amp;booksellerid="
418
                                    + encodeURIComponent(row.basket.vendor_id) + "&amp;basketgroupid="
411
                                    + encodeURIComponent(row.basket.vendor_id) + "&amp;basketgroupid="
419
                                    + encodeURIComponent(row.basket.basket_group_id) + "\">"
412
                                    + encodeURIComponent(row.basket.basket_group_id) + "\">"
420
                                    + _escape_str(row.basket.basket_group.name) + " (" + _escape_str(row.basket.basket_group_id) + ")</a>";
413
                                    + escape_str(row.basket.basket_group.name) + " (" + escape_str(row.basket.basket_group_id) + ")</a>";
421
                        }
414
                        }
422
                      }
415
                      }
423
                    },
416
                    },
424
                    {
417
                    {
425
                        "data": "order_id",
418
                        "data": "order_id",
426
                        "render": function(data, type, row, meta) {
419
                        "render": function(data, type, row, meta) {
427
                            if (type != 'display') return _escape_str(data);
420
                            if (type != 'display') return escape_str(data);
428
                            return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&amp;booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+_escape_str(data)+"</a>";
421
                            return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&amp;booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+escape_str(data)+"</a>";
429
                        }
422
                        }
430
                    },
423
                    },
431
                    {
424
                    {
Lines 435-456 Link Here
435
                        "render": function(data, type, row, meta) {
428
                        "render": function(data, type, row, meta) {
436
                            var result = '';
429
                            var result = '';
437
                            if ( row && row.biblio_id != null ) {
430
                            if ( row && row.biblio_id != null ) {
438
                                result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+_escape_str(row.biblio.title)+"</a>";
431
                                result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+escape_str(row.biblio.title)+"</a>";
439
                                if ( row.biblio.author != null )
432
                                if ( row.biblio.author != null )
440
                                    result += _(" by ") + _escape_str(row.biblio.author);
433
                                    result += _(" by ") + escape_str(row.biblio.author);
441
                                if ( row.biblio.isbn != null )
434
                                if ( row.biblio.isbn != null )
442
                                    result += " &ndash; " + _escape_str(row.biblio.isbn);
435
                                    result += " &ndash; " + escape_str(row.biblio.isbn);
443
                                [% IF Koha.Preference('marcflavour')=='UNIMARC' %]
436
                                [% IF Koha.Preference('marcflavour')=='UNIMARC' %]
444
                                    if ( row.biblio.ean != null )
437
                                    if ( row.biblio.ean != null )
445
                                        result += " &ndash; EAN:" + _escape_str(row.biblio.ean);
438
                                        result += " &ndash; EAN:" + escape_str(row.biblio.ean);
446
                                [% END %]
439
                                [% END %]
447
                                if ( row.biblio.publisher != null ) {
440
                                if ( row.biblio.publisher != null ) {
448
                                    result += "<br/>" + _("Publisher: ") + _escape_str(row.biblio.publisher);
441
                                    result += "<br/>" + _("Publisher: ") + escape_str(row.biblio.publisher);
449
                                    if ( row.biblio.publication_year != null ) {
442
                                    if ( row.biblio.publication_year != null ) {
450
                                        result += ", " + _escape_str(row.biblio.publication_year);
443
                                        result += ", " + escape_str(row.biblio.publication_year);
451
                                    }
444
                                    }
452
                                    else if ( row.biblio.copyright_date != null ) {
445
                                    else if ( row.biblio.copyright_date != null ) {
453
                                        result += _escape_str(row.biblio.copyright_date);
446
                                        result += escape_str(row.biblio.copyright_date);
454
                                    }
447
                                    }
455
                                }
448
                                }
456
                                var suggestions = row.biblio.suggestions;
449
                                var suggestions = row.biblio.suggestions;
Lines 460-469 Link Here
460
                                        var suggester = suggestion.suggester;
453
                                        var suggester = suggestion.suggester;
461
                                        var suggested_by = [];
454
                                        var suggested_by = [];
462
                                        if ( suggester.surname != null ) {
455
                                        if ( suggester.surname != null ) {
463
                                            suggested_by.push(_escape_str(suggester.surname));
456
                                            suggested_by.push(escape_str(suggester.surname));
464
                                        }
457
                                        }
465
                                        if ( suggester.firstname != null ) {
458
                                        if ( suggester.firstname != null ) {
466
                                            suggested_by.push(_escape_str(suggester.firstname));
459
                                            suggested_by.push(escape_str(suggester.firstname));
467
                                        }
460
                                        }
468
461
469
                                            result += "<br/>" + _("Suggested by: ") +
462
                                            result += "<br/>" + _("Suggested by: ") +
Lines 471-477 Link Here
471
                                                            + encodeURIComponent(suggestion.suggestionid)
464
                                                            + encodeURIComponent(suggestion.suggestionid)
472
                                                            + '&amp;op=show">'
465
                                                            + '&amp;op=show">'
473
                                                            + suggested_by.join(", ")
466
                                                            + suggested_by.join(", ")
474
                                                            + " (#" + _escape_str(suggestions[0].suggestionid) + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
467
                                                            + " (#" + escape_str(suggestions[0].suggestionid) + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
475
                                    }
468
                                    }
476
                                }
469
                                }
477
                                result += '</p>';
470
                                result += '</p>';
Lines 481-487 Link Here
481
                            if ( internal_note != null && internal_note != '' ) {
474
                            if ( internal_note != null && internal_note != '' ) {
482
                                result += '<p class="ordernote"><strong>'
475
                                result += '<p class="ordernote"><strong>'
483
                                            + _("Internal note: ")
476
                                            + _("Internal note: ")
484
                                            + '</strong>' + _escape_str(internal_note)
477
                                            + '</strong>' + escape_str(internal_note)
485
                                            + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
478
                                            + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
486
                                            + encodeURIComponent(row.order_id) + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
479
                                            + encodeURIComponent(row.order_id) + '&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
487
                                            + '&type=internal">' + _("Change internal note") + '</a>]</p>';
480
                                            + '&type=internal">' + _("Change internal note") + '</a>]</p>';
Lines 496-502 Link Here
496
                            if ( vendor_note != null && vendor_note != '' ) {
489
                            if ( vendor_note != null && vendor_note != '' ) {
497
                                result += '<p class="ordernote"><strong>'
490
                                result += '<p class="ordernote"><strong>'
498
                                            + _("Vendor note: ")
491
                                            + _("Vendor note: ")
499
                                            + '</strong>' + _escape_str(vendor_note) + '</p>';
492
                                            + '</strong>' + escape_str(vendor_note) + '</p>';
500
                            }
493
                            }
501
                            else {
494
                            else {
502
                                result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
495
                                result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
Lines 522-528 Link Here
522
                    {
515
                    {
523
                        "data": "replacement_price",
516
                        "data": "replacement_price",
524
                        "render": function(data, type, row, meta) {
517
                        "render": function(data, type, row, meta) {
525
                            return _escape_price(row.replacement_price);
518
                            return escape_price(row.replacement_price);
526
                        },
519
                        },
527
                    },
520
                    },
528
                    {
521
                    {
Lines 532-544 Link Here
532
                    {
525
                    {
533
                        "data": "ecost",
526
                        "data": "ecost",
534
                        "render": function(data, type, row, meta) {
527
                        "render": function(data, type, row, meta) {
535
                            return _escape_price(row.ecost);
528
                            return escape_price(row.ecost);
536
                        },
529
                        },
537
                    },
530
                    },
538
                    {
531
                    {
539
                        "data": "",
532
                        "data": "",
540
                        "render": function(data, type, row, meta) {
533
                        "render": function(data, type, row, meta) {
541
                            return _escape_price(row.quantity * row.ecost);
534
                            return escape_price(row.quantity * row.ecost);
542
                        },
535
                        },
543
                        "orderable": false, // FIXME: How can we do it in DBIC?
536
                        "orderable": false, // FIXME: How can we do it in DBIC?
544
                        "searchable": false
537
                        "searchable": false
Lines 546-553 Link Here
546
                    {
539
                    {
547
                        "data": "fund.name",
540
                        "data": "fund.name",
548
                        "render": function(data, type, row, meta) {
541
                        "render": function(data, type, row, meta) {
549
                            if (type != 'display') return _escape_str(data);
542
                            if (type != 'display') return escape_str(data);
550
                            return _escape_str(row.fund.name);
543
                            return escape_str(row.fund.name);
551
                        }
544
                        }
552
                    },
545
                    },
553
                    {
546
                    {
Lines 556-562 Link Here
556
                            return '<a href="orderreceive.pl?ordernumber='
549
                            return '<a href="orderreceive.pl?ordernumber='
557
                                    + encodeURIComponent(row.order_id) + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
550
                                    + encodeURIComponent(row.order_id) + '&amp;invoiceid=[% invoiceid | uri %]' + '">'
558
                                    + _("Receive") + '</a><br/>'
551
                                    + _("Receive") + '</a><br/>'
559
                                    + '<a href="#" onclick="transfer_order_popup(' + _escape_str(row.order_id) + '); return false;">'
552
                                    + '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">'
560
                                    + _("Transfer") + '</a>';
553
                                    + _("Transfer") + '</a>';
561
                        },
554
                        },
562
                        "orderable": false,
555
                        "orderable": false,
Lines 569-575 Link Here
569
562
570
                            if ( row.current_holds_count > 0 ) {
563
                            if ( row.current_holds_count > 0 ) {
571
                                result += '<span class="button" title="'
564
                                result += '<span class="button" title="'
572
                                        + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( _escape_str(row.holds_count) ) + '">'
565
                                        + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( escape_str(row.holds_count) ) + '">'
573
                                        + _("Can't cancel order") + '</span><br/>';
566
                                        + _("Can't cancel order") + '</span><br/>';
574
                            }
567
                            }
575
                            else {
568
                            else {
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-1 / +6 lines)
Lines 26-31 String.prototype.escapeHtml = function() { Link Here
26
        return HtmlCharsToEscape[c] || c;
26
        return HtmlCharsToEscape[c] || c;
27
    });
27
    });
28
};
28
};
29
function escape_str(s){
30
    return s != null ? s.escapeHtml() : "";
31
}
29
32
30
/*
33
/*
31
 * Void method for numbers, for consistency
34
 * Void method for numbers, for consistency
Lines 33-38 String.prototype.escapeHtml = function() { Link Here
33
Number.prototype.escapeHtml = function() {
36
Number.prototype.escapeHtml = function() {
34
    return this;
37
    return this;
35
};
38
};
39
function escape_price(p){
40
    return p != null ? p.escapeHtml().format_price() : "";
41
}
36
42
37
// http://stackoverflow.com/questions/14859281/select-tab-by-name-in-jquery-ui-1-10-0/16550804#16550804
43
// http://stackoverflow.com/questions/14859281/select-tab-by-name-in-jquery-ui-1-10-0/16550804#16550804
38
$.fn.tabIndex = function () {
44
$.fn.tabIndex = function () {
39
- 

Return to bug 27930