|
Lines 379-393
Link Here
|
| 379 |
var PENDING_MULTI_SELECTION = _("Receive selected (%s)"); |
379 |
var PENDING_MULTI_SELECTION = _("Receive selected (%s)"); |
| 380 |
var columns_filter = {}; |
380 |
var columns_filter = {}; |
| 381 |
|
381 |
|
| 382 |
$(document).ready(function(){ |
382 |
$(document).ready(function () { |
| 383 |
|
383 |
$(".cancel_receipt").on("click", function (e) { |
| 384 |
$(".cancel_receipt").on( 'click', function(e){ |
|
|
| 385 |
e.preventDefault(); |
384 |
e.preventDefault(); |
| 386 |
$('#cancel_ordernumber').val( $(this).data('ordernumber') ); |
385 |
$("#cancel_ordernumber").val($(this).data("ordernumber")); |
| 387 |
$('#cancel_receipt').submit(); |
386 |
$("#cancel_receipt").submit(); |
| 388 |
}); |
387 |
}); |
| 389 |
|
388 |
|
| 390 |
if ( $("#receivedt").length ) { |
389 |
if ($("#receivedt").length) { |
| 391 |
var receivedt = $("#receivedt").kohaTable({ |
390 |
var receivedt = $("#receivedt").kohaTable({ |
| 392 |
stateSave: true, // We do not have table settings on this table |
391 |
stateSave: true, // We do not have table settings on this table |
| 393 |
pageLength: 10, |
392 |
pageLength: 10, |
|
Lines 395-537
Link Here
|
| 395 |
[5, 10, 20, 50, 100, -1], |
394 |
[5, 10, 20, 50, 100, -1], |
| 396 |
[5, 10, 20, 50, 100, _("All")], |
395 |
[5, 10, 20, 50, 100, _("All")], |
| 397 |
], |
396 |
], |
| 398 |
columns: [ |
397 |
columns: [{ type: "html" }, { type: "html" }, { type: "html" }, { type: "num-html" }, { type: "anti-the" }, null, null, null, null, null, null, null, null], |
| 399 |
{ type: "html" }, |
|
|
| 400 |
{ type: "html" }, |
| 401 |
{ type: "html" }, |
| 402 |
{ type: "num-html" }, |
| 403 |
{ type: "anti-the" }, |
| 404 |
null, |
| 405 |
null, |
| 406 |
null, |
| 407 |
null, |
| 408 |
null, |
| 409 |
null, |
| 410 |
null, |
| 411 |
null, |
| 412 |
], |
| 413 |
pagingType: "full", |
398 |
pagingType: "full", |
| 414 |
}); |
399 |
}); |
| 415 |
} |
400 |
} |
| 416 |
|
401 |
|
| 417 |
var options = { |
402 |
var options = { |
| 418 |
ajax: { |
403 |
ajax: { |
| 419 |
"url": '/api/v1/acquisitions/orders?only_active=1' |
404 |
url: "/api/v1/acquisitions/orders?only_active=1", |
| 420 |
}, |
405 |
}, |
| 421 |
embed: [ |
406 |
embed: ["basket.basket_group", "biblio.uncancelled_orders+count", "biblio.holds+count", "biblio.items+count", "biblio.suggestions.suggester", "fund", "current_item_level_holds+count", "items"], |
| 422 |
"basket.basket_group", |
|
|
| 423 |
"biblio.uncancelled_orders+count", |
| 424 |
"biblio.holds+count", |
| 425 |
"biblio.items+count", |
| 426 |
"biblio.suggestions.suggester", |
| 427 |
"fund", |
| 428 |
"current_item_level_holds+count", |
| 429 |
"items" |
| 430 |
], |
| 431 |
columns: [ |
407 |
columns: [ |
| 432 |
{ data: "basket.name", |
408 |
{ |
| 433 |
searchable: true, |
409 |
data: "basket.name", |
| 434 |
orderable: true, |
410 |
searchable: true, |
| 435 |
render: function(data, type, row, meta) { |
411 |
orderable: true, |
| 436 |
if (type != 'display') return escape_str(data); |
412 |
render: function (data, type, row, meta) { |
| 437 |
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>"; |
413 |
if (type != "display") return escape_str(data); |
| 438 |
} |
414 |
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>"; |
|
|
415 |
}, |
| 439 |
}, |
416 |
}, |
| 440 |
{ data: "basket.basket_group.name", |
417 |
{ |
| 441 |
orderable: true, |
418 |
data: "basket.basket_group.name", |
| 442 |
render: function(data, type, row, meta) { |
419 |
orderable: true, |
| 443 |
if ( type != 'display' ) { |
420 |
render: function (data, type, row, meta) { |
| 444 |
return escape_str(data); |
421 |
if (type != "display") { |
| 445 |
} |
422 |
return escape_str(data); |
| 446 |
if ( row.basket.basket_group_id == null ) { |
423 |
} |
| 447 |
return _("No basket group"); |
424 |
if (row.basket.basket_group_id == null) { |
| 448 |
} |
425 |
return _("No basket group"); |
| 449 |
else { |
426 |
} else { |
| 450 |
return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=" |
427 |
return ( |
| 451 |
+ encodeURIComponent(row.basket.vendor_id) + "&basketgroupid=" |
428 |
'<a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=' + |
| 452 |
+ encodeURIComponent(row.basket.basket_group_id) + "\">" |
429 |
encodeURIComponent(row.basket.vendor_id) + |
| 453 |
+ escape_str(row.basket.basket_group.name) + " (" + escape_str(row.basket.basket_group_id) + ")</a>"; |
430 |
"&basketgroupid=" + |
| 454 |
} |
431 |
encodeURIComponent(row.basket.basket_group_id) + |
| 455 |
} |
432 |
'">' + |
|
|
433 |
escape_str(row.basket.basket_group.name) + |
| 434 |
" (" + |
| 435 |
escape_str(row.basket.basket_group_id) + |
| 436 |
")</a>" |
| 437 |
); |
| 438 |
} |
| 439 |
}, |
| 456 |
}, |
440 |
}, |
| 457 |
{ |
441 |
{ |
| 458 |
data: "order_id", |
442 |
data: "order_id", |
| 459 |
render: function(data, type, row, meta) { |
443 |
render: function (data, type, row, meta) { |
| 460 |
if (type != 'display') return escape_str(data); |
444 |
if (type != "display") return escape_str(data); |
| 461 |
return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+escape_str(data)+"</a>"; |
445 |
return '<a href="neworderempty.pl?ordernumber=' + encodeURIComponent(data) + "&booksellerid=" + encodeURIComponent(row.basket.vendor_id) + '">' + escape_str(data) + "</a>"; |
| 462 |
} |
446 |
}, |
| 463 |
}, |
447 |
}, |
| 464 |
{ |
448 |
{ |
| 465 |
data: summary_fields, |
449 |
data: summary_fields, |
| 466 |
render: function(data, type, row, meta) { |
450 |
render: function (data, type, row, meta) { |
| 467 |
var result = ''; |
451 |
var result = ""; |
| 468 |
if ( row && row.biblio_id != null ) { |
452 |
if (row && row.biblio_id != null) { |
| 469 |
result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+escape_str(row.biblio.title)+"</a>"; |
453 |
result = '<p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + encodeURIComponent(row.biblio_id) + '">' + escape_str(row.biblio.title) + "</a>"; |
| 470 |
if ( row.biblio.author != null ) |
454 |
if (row.biblio.author != null) result += _(" by ") + escape_str(row.biblio.author); |
| 471 |
result += _(" by ") + escape_str(row.biblio.author); |
455 |
if (row.biblio.isbn != null) result += " – " + escape_str(row.biblio.isbn); |
| 472 |
if ( row.biblio.isbn != null ) |
456 |
if (prefs.marcflavour == "UNIMARC" && row.biblio.ean != null) { |
| 473 |
result += " – " + escape_str(row.biblio.isbn); |
457 |
result += " – EAN:" + escape_str(row.biblio.ean); |
| 474 |
if (prefs.marcflavour == 'UNIMARC' && row.biblio.ean != null ) { |
458 |
} |
| 475 |
result += " – EAN:" + escape_str(row.biblio.ean); |
459 |
if (row.biblio.publisher != null) { |
| 476 |
} |
|
|
| 477 |
if ( row.biblio.publisher != null ) { |
| 478 |
result += "<br/>" + _("Publisher: ") + escape_str(row.biblio.publisher); |
460 |
result += "<br/>" + _("Publisher: ") + escape_str(row.biblio.publisher); |
| 479 |
if ( row.biblio.publication_year != null ) { |
461 |
if (row.biblio.publication_year != null) { |
| 480 |
result += ", " + escape_str(row.biblio.publication_year); |
462 |
result += ", " + escape_str(row.biblio.publication_year); |
| 481 |
} |
463 |
} else if (row.biblio.copyright_date != null) { |
| 482 |
else if ( row.biblio.copyright_date != null ) { |
|
|
| 483 |
result += escape_str(row.biblio.copyright_date); |
464 |
result += escape_str(row.biblio.copyright_date); |
| 484 |
} |
465 |
} |
| 485 |
} |
466 |
} |
| 486 |
var suggestions = row.biblio.suggestions; |
467 |
var suggestions = row.biblio.suggestions; |
| 487 |
if ( suggestions != null && suggestions.length > 0 ) { |
468 |
if (suggestions != null && suggestions.length > 0) { |
| 488 |
var suggestion = suggestions[0]; |
469 |
var suggestion = suggestions[0]; |
| 489 |
if ( suggestion.suggester != null ) { |
470 |
if (suggestion.suggester != null) { |
| 490 |
var suggester = suggestion.suggester; |
471 |
var suggester = suggestion.suggester; |
| 491 |
var suggested_by = []; |
472 |
var suggested_by = []; |
| 492 |
if ( suggester.surname != null ) { |
473 |
if (suggester.surname != null) { |
| 493 |
suggested_by.push(escape_str(suggester.surname)); |
474 |
suggested_by.push(escape_str(suggester.surname)); |
| 494 |
} |
475 |
} |
| 495 |
if ( suggester.firstname != null ) { |
476 |
if (suggester.firstname != null) { |
| 496 |
suggested_by.push(escape_str(suggester.firstname)); |
477 |
suggested_by.push(escape_str(suggester.firstname)); |
| 497 |
} |
478 |
} |
| 498 |
|
479 |
|
| 499 |
result += "<br/>" + _("Suggested by: ") + |
480 |
result += |
| 500 |
'<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=' |
481 |
"<br/>" + |
| 501 |
+ encodeURIComponent(suggestion.suggestionid) |
482 |
_("Suggested by: ") + |
| 502 |
+ '&op=show">' |
483 |
'<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=' + |
| 503 |
+ suggested_by.join(", ") |
484 |
encodeURIComponent(suggestion.suggestionid) + |
| 504 |
+ " (#" + escape_str(suggestions[0].suggestionid) + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions |
485 |
'&op=show">' + |
|
|
486 |
suggested_by.join(", ") + |
| 487 |
" (#" + |
| 488 |
escape_str(suggestions[0].suggestionid) + |
| 489 |
")</a>"; // FIXME: could be changed if we allow matching multiple suggestions |
| 505 |
} |
490 |
} |
| 506 |
} |
491 |
} |
| 507 |
result += '</p>'; |
492 |
result += "</p>"; |
| 508 |
} |
493 |
} |
| 509 |
|
494 |
|
| 510 |
var internal_note = row.internal_note; |
495 |
var internal_note = row.internal_note; |
| 511 |
if ( internal_note != null && internal_note != '' ) { |
496 |
if (internal_note != null && internal_note != "") { |
| 512 |
result += '<p class="ordernote"><strong>' |
497 |
result += |
| 513 |
+ _("Internal note: ") |
498 |
'<p class="ordernote"><strong>' + |
| 514 |
+ '</strong>' + escape_str(internal_note) |
499 |
_("Internal note: ") + |
| 515 |
+ ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=' |
500 |
"</strong>" + |
| 516 |
+ encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=' + invoice_id |
501 |
escape_str(internal_note) + |
| 517 |
+ '&type=internal">' + _("Change internal note") + '</a>]</p>'; |
502 |
' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=' + |
| 518 |
} |
503 |
encodeURIComponent(row.order_id) + |
| 519 |
else { |
504 |
"&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=" + |
| 520 |
result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=' |
505 |
invoice_id + |
| 521 |
+ encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=' + invoice_id |
506 |
'&type=internal">' + |
| 522 |
+ '&type=internal">' + _("Add internal note") + '</a>]'; |
507 |
_("Change internal note") + |
|
|
508 |
"</a>]</p>"; |
| 509 |
} else { |
| 510 |
result += |
| 511 |
' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=' + |
| 512 |
encodeURIComponent(row.order_id) + |
| 513 |
"&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=" + |
| 514 |
invoice_id + |
| 515 |
'&type=internal">' + |
| 516 |
_("Add internal note") + |
| 517 |
"</a>]"; |
| 523 |
} |
518 |
} |
| 524 |
|
519 |
|
| 525 |
var vendor_note = row.vendor_note; |
520 |
var vendor_note = row.vendor_note; |
| 526 |
if ( vendor_note != null && vendor_note != '' ) { |
521 |
if (vendor_note != null && vendor_note != "") { |
| 527 |
result += '<p class="ordernote"><strong>' |
522 |
result += '<p class="ordernote"><strong>' + _("Vendor note: ") + "</strong>" + escape_str(vendor_note) + "</p>"; |
| 528 |
+ _("Vendor note: ") |
523 |
} else { |
| 529 |
+ '</strong>' + escape_str(vendor_note) + '</p>'; |
524 |
result += |
| 530 |
} |
525 |
' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=' + |
| 531 |
else { |
526 |
encodeURIComponent(row.order_id) + |
| 532 |
result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=' |
527 |
"&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=" + |
| 533 |
+ encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=' + invoice_id |
528 |
invoice_id + |
| 534 |
+ '&type=vendor">' + _("Add vendor note") + '</a>]'; |
529 |
'&type=vendor">' + |
|
|
530 |
_("Add vendor note") + |
| 531 |
"</a>]"; |
| 535 |
} |
532 |
} |
| 536 |
|
533 |
|
| 537 |
return result; |
534 |
return result; |
|
Lines 540-737
Link Here
|
| 540 |
}, |
537 |
}, |
| 541 |
{ |
538 |
{ |
| 542 |
data: "", |
539 |
data: "", |
| 543 |
render: function(data, type, row, meta) { |
540 |
render: function (data, type, row, meta) { |
| 544 |
var result = '<div class="btn-group dropup">'; |
541 |
var result = '<div class="btn-group dropup">'; |
| 545 |
|
542 |
|
| 546 |
result += '<button id="view' + row.order_id + '" type="button" class="btn btn-default btn-xs">' + _("View") + '</button>'; |
543 |
result += '<button id="view' + row.order_id + '" type="button" class="btn btn-default btn-xs">' + _("View") + "</button>"; |
| 547 |
result += '<button type="button" class="btn btn-default btn-xs dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"><span class="visually-hidden">Toggle dropdown</span></button>'; |
544 |
result += |
|
|
545 |
'<button type="button" class="btn btn-default btn-xs dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"><span class="visually-hidden">Toggle dropdown</span></button>'; |
| 548 |
|
546 |
|
| 549 |
result += '<ul class="dropdown-menu" aria-labelledby="view' + row.order_id + '">'; |
547 |
result += '<ul class="dropdown-menu" aria-labelledby="view' + row.order_id + '">'; |
| 550 |
result += '<li><a class="dropdown-item previewData" href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '">' + i18n.order + '</a></li>'; |
548 |
result += '<li><a class="dropdown-item previewData" href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '">' + i18n.order + "</a></li>"; |
| 551 |
result += '<li><a class="dropdown-item previewData" href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '">' + _("MARC") + '</a></li>'; |
549 |
result += '<li><a class="dropdown-item previewData" href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '">' + _("MARC") + "</a></li>"; |
| 552 |
result += '<li><a class="dropdown-item previewData" href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=' + encodeURIComponent(row.biblio_id) + '">' + _("Card") + '</a></li>'; |
550 |
result += '<li><a class="dropdown-item previewData" href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=' + encodeURIComponent(row.biblio_id) + '">' + _("Card") + "</a></li>"; |
| 553 |
result += '</ul>'; |
551 |
result += "</ul>"; |
| 554 |
result += '</div>'; |
552 |
result += "</div>"; |
| 555 |
return result; |
553 |
return result; |
| 556 |
}, |
554 |
}, |
| 557 |
orderable: false, |
555 |
orderable: false, |
| 558 |
searchable: false |
556 |
searchable: false, |
| 559 |
}, |
557 |
}, |
| 560 |
{ |
558 |
{ |
| 561 |
data: "replacement_price", |
559 |
data: "replacement_price", |
| 562 |
render: function(data, type, row, meta) { |
560 |
render: function (data, type, row, meta) { |
| 563 |
return escape_price(row.replacement_price); |
561 |
return escape_price(row.replacement_price); |
| 564 |
}, |
562 |
}, |
| 565 |
}, |
563 |
}, |
| 566 |
{ |
564 |
{ |
| 567 |
data: "quantity", |
565 |
data: "quantity", |
| 568 |
orderable: true |
566 |
orderable: true, |
| 569 |
}, |
567 |
}, |
| 570 |
{ |
568 |
{ |
| 571 |
data: "ecost", |
569 |
data: "ecost", |
| 572 |
render: function(data, type, row, meta) { |
570 |
render: function (data, type, row, meta) { |
| 573 |
return escape_price(row.ecost); |
571 |
return escape_price(row.ecost); |
| 574 |
}, |
572 |
}, |
| 575 |
}, |
573 |
}, |
| 576 |
{ |
574 |
{ |
| 577 |
data: "", |
575 |
data: "", |
| 578 |
render: function(data, type, row, meta) { |
576 |
render: function (data, type, row, meta) { |
| 579 |
return escape_price(row.quantity * row.ecost); |
577 |
return escape_price(row.quantity * row.ecost); |
| 580 |
}, |
578 |
}, |
| 581 |
orderable: false, // FIXME: How can we do it in DBIC? |
579 |
orderable: false, // FIXME: How can we do it in DBIC? |
| 582 |
searchable: false |
580 |
searchable: false, |
| 583 |
}, |
581 |
}, |
| 584 |
{ |
582 |
{ |
| 585 |
data: "fund.name", |
583 |
data: "fund.name", |
| 586 |
render: function(data, type, row, meta) { |
584 |
render: function (data, type, row, meta) { |
| 587 |
if (type != 'display') return escape_str(data); |
585 |
if (type != "display") return escape_str(data); |
| 588 |
return escape_str(row.fund.name); |
586 |
return escape_str(row.fund.name); |
| 589 |
} |
587 |
}, |
| 590 |
}, |
588 |
}, |
| 591 |
{ |
589 |
{ |
| 592 |
data: "", |
590 |
data: "", |
| 593 |
render: function(data, type, row, meta) { |
591 |
render: function (data, type, row, meta) { |
| 594 |
return '<a href="orderreceive.pl?multiple_orders=' |
592 |
return ( |
| 595 |
+ encodeURIComponent(row.order_id) + '&invoiceid=' + invoice_id + '">' |
593 |
'<a href="orderreceive.pl?multiple_orders=' + |
| 596 |
+ _("Receive") + '</a><br/>' |
594 |
encodeURIComponent(row.order_id) + |
| 597 |
+ '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">' |
595 |
"&invoiceid=" + |
| 598 |
+ _("Transfer") + '</a>'; |
596 |
invoice_id + |
|
|
597 |
'">' + |
| 598 |
_("Receive") + |
| 599 |
"</a><br/>" + |
| 600 |
'<a href="#" onclick="transfer_order_popup(' + |
| 601 |
escape_str(row.order_id) + |
| 602 |
'); return false;">' + |
| 603 |
_("Transfer") + |
| 604 |
"</a>" |
| 605 |
); |
| 599 |
}, |
606 |
}, |
| 600 |
orderable: false, |
607 |
orderable: false, |
| 601 |
searchable: false |
608 |
searchable: false, |
| 602 |
}, |
609 |
}, |
| 603 |
{ |
610 |
{ |
| 604 |
data: "", |
611 |
data: "", |
| 605 |
render: function(data, type, row, meta) { |
612 |
render: function (data, type, row, meta) { |
| 606 |
var result = ""; |
613 |
var result = ""; |
| 607 |
|
614 |
|
| 608 |
if ( row.current_holds_count > 0 ) { |
615 |
if (row.current_holds_count > 0) { |
| 609 |
result += '<span class="button" title="' |
616 |
result += |
| 610 |
+ _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( escape_str(row.holds_count) ) + '">' |
617 |
'<span class="button" title="' + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format(escape_str(row.holds_count)) + '">' + _("Can't cancel order") + "</span><br/>"; |
| 611 |
+ _("Can't cancel order") + '</span><br/>'; |
618 |
} else { |
| 612 |
} |
619 |
result += |
| 613 |
else { |
620 |
'<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=' + |
| 614 |
result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=' |
621 |
encodeURIComponent(row.order_id) + |
| 615 |
+ encodeURIComponent(row.order_id) |
622 |
"&biblionumber=" + |
| 616 |
+ '&biblionumber=' + encodeURIComponent(row.biblio_id) |
623 |
encodeURIComponent(row.biblio_id) + |
| 617 |
+ '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=' + invoice_id |
624 |
"&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=" + |
| 618 |
+ _("Cancel order") + '</a><br/>'; |
625 |
invoice_id + |
|
|
626 |
_("Cancel order") + |
| 627 |
"</a><br/>"; |
| 619 |
} |
628 |
} |
| 620 |
|
629 |
|
| 621 |
if ( row.biblio != null ) { |
630 |
if (row.biblio != null) { |
| 622 |
if ( row.biblio.items_count - row.items.length > 0 || |
631 |
if (row.biblio.items_count - row.items.length > 0 || row.biblio.uncancelled_orders_count > 1 || row.biblio.subscriptions_count > 0 || row.biblio.holds_count > 0) { |
| 623 |
row.biblio.uncancelled_orders_count > 1 || |
632 |
// biblio can be deleted |
| 624 |
row.biblio.subscriptions_count > 0 || |
633 |
result += '<span class="button" title="' + _("Can't delete catalog record, see constraints below") + '">' + _("Can't cancel order and delete catalog record") + "</span><br>"; |
| 625 |
row.biblio.holds_count > 0 ) { // biblio can be deleted |
634 |
} else { |
| 626 |
result += '<span class="button" title="' |
635 |
result += |
| 627 |
+ _("Can't delete catalog record, see constraints below") + '">' |
636 |
'<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=' + |
| 628 |
+ _("Can't cancel order and delete catalog record") + '</span><br>'; |
637 |
encodeURIComponent(row.order_id) + |
| 629 |
} |
638 |
"&biblionumber=" + |
| 630 |
else { |
639 |
encodeURIComponent(row.biblio_id) + |
| 631 |
result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=' |
640 |
'&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">' + |
| 632 |
+ encodeURIComponent(row.order_id) + '&biblionumber=' + encodeURIComponent(row.biblio_id) |
641 |
_("Cancel order and catalog record") + |
| 633 |
+ '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">' |
642 |
"</a><br/>"; |
| 634 |
+ _("Cancel order and catalog record") + '</a><br/>'; |
|
|
| 635 |
} |
643 |
} |
| 636 |
|
644 |
|
| 637 |
if ( row.biblio.items_count - row.items.length > 0 ) { |
645 |
if (row.biblio.items_count - row.items.length > 0) { |
| 638 |
result += '<strong title="' |
646 |
result += |
| 639 |
+ _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length) |
647 |
'<strong title="' + |
| 640 |
+'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</strong><br/>'; |
648 |
_("Can't delete catalog record, because of %s existing item(s)").format(row.items.length) + |
|
|
649 |
'">' + |
| 650 |
(row.biblio.items_count - row.items.length) + |
| 651 |
_(" item(s) left") + |
| 652 |
"</strong><br/>"; |
| 641 |
} |
653 |
} |
| 642 |
|
654 |
|
| 643 |
if ( row.biblio.uncancelled_orders_count > 1 ) { |
655 |
if (row.biblio.uncancelled_orders_count > 1) { |
| 644 |
result += '<strong title="' |
656 |
result += '<strong title="' + _("Can't delete catalog record, delete other orders linked to it first") + '">' + (row.biblio.uncancelled_orders_count - 1) + _(" order(s) left") + "</strong><br/>"; |
| 645 |
+ _("Can't delete catalog record, delete other orders linked to it first") + '">' |
|
|
| 646 |
+ (row.biblio.uncancelled_orders_count - 1) + _(" order(s) left") + '</strong><br/>'; |
| 647 |
} |
657 |
} |
| 648 |
|
658 |
|
| 649 |
if ( row.biblio.subscriptions_count > 0 ) { |
659 |
if (row.biblio.subscriptions_count > 0) { |
| 650 |
result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">' |
660 |
result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">' + _("%s subscription(s) left").format(row.biblio.subscriptions_count) + "</strong><br>"; |
| 651 |
+ _("%s subscription(s) left").format(row.biblio.subscriptions_count) |
|
|
| 652 |
+ '</strong><br>'; |
| 653 |
} |
661 |
} |
| 654 |
|
662 |
|
| 655 |
if ( row.biblio.holds_count > 0 ) { |
663 |
if (row.biblio.holds_count > 0) { |
| 656 |
result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">' |
664 |
result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">' + _("%s hold(s) left").format(row.biblio.holds_count) + "</strong>"; |
| 657 |
+ _("%s hold(s) left").format(row.biblio.holds_count) + '</strong>'; |
|
|
| 658 |
} |
665 |
} |
| 659 |
} |
666 |
} |
| 660 |
|
667 |
|
| 661 |
return result; |
668 |
return result; |
| 662 |
}, |
669 |
}, |
| 663 |
orderable: false, |
670 |
orderable: false, |
| 664 |
searchable: false |
671 |
searchable: false, |
| 665 |
} |
672 |
}, |
| 666 |
] |
673 |
], |
| 667 |
}; |
674 |
}; |
| 668 |
|
675 |
|
| 669 |
var selected_rows = {}; |
676 |
var selected_rows = {}; |
| 670 |
$('#select_multiple').click(function () { |
677 |
$("#select_multiple") |
| 671 |
var ids = Object.keys(selected_rows); |
678 |
.click(function () { |
| 672 |
if (!ids.length) return; |
679 |
var ids = Object.keys(selected_rows); |
| 673 |
location.href = 'orderreceive.pl?multiple_orders=' + ids.join(',') + '&invoiceid=' + invoiceid |
680 |
if (!ids.length) return; |
| 674 |
}).html(PENDING_MULTI_SELECTION.format('0')) |
681 |
location.href = "orderreceive.pl?multiple_orders=" + ids.join(",") + "&invoiceid=" + invoiceid; |
| 675 |
options.order = [[1, 'asc']]; |
682 |
}) |
|
|
683 |
.html(PENDING_MULTI_SELECTION.format("0")); |
| 684 |
options.order = [[1, "asc"]]; |
| 676 |
options.columns.unshift({ |
685 |
options.columns.unshift({ |
| 677 |
data: function (row, type, val, meta) { |
686 |
data: function (row, type, val, meta) { |
| 678 |
return '<input type="checkbox" class="selOrder" />'; |
687 |
return '<input type="checkbox" class="selOrder" />'; |
| 679 |
}, |
688 |
}, |
| 680 |
searchable: false, |
689 |
searchable: false, |
| 681 |
orderable: false |
690 |
orderable: false, |
| 682 |
}); |
691 |
}); |
| 683 |
|
692 |
|
| 684 |
var pending_orders_table = $("#pending_orders").kohaTable(options, table_settings, 1, { "basket.vendor_id": vendor_id }); |
693 |
var pending_orders_table = $("#pending_orders").kohaTable(options, table_settings, 1, { "basket.vendor_id": vendor_id }); |
| 685 |
|
694 |
|
| 686 |
var api = pending_orders_table.api(); |
695 |
var api = pending_orders_table.api(); |
| 687 |
api.on('draw', function () { |
696 |
api.on("draw", function () { |
| 688 |
api.rows().every(function () { |
697 |
api.rows().every(function () { |
| 689 |
var row = this; |
698 |
var row = this; |
| 690 |
var data = row.data(); |
699 |
var data = row.data(); |
| 691 |
$('.selOrder', row.node()).on('click', function (event) { |
700 |
$(".selOrder", row.node()).on("click", function (event) { |
| 692 |
if ($(this).prop('checked')) { |
701 |
if ($(this).prop("checked")) { |
| 693 |
selected_rows[data.order_id] = data; |
702 |
selected_rows[data.order_id] = data; |
| 694 |
} else { |
703 |
} else { |
| 695 |
delete selected_rows[data.order_id]; |
704 |
delete selected_rows[data.order_id]; |
| 696 |
} |
705 |
} |
| 697 |
$('#select_multiple').html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length)); |
706 |
$("#select_multiple").html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length)); |
| 698 |
}); |
707 |
}); |
| 699 |
if (selected_rows[data.order_id]) { |
708 |
if (selected_rows[data.order_id]) { |
| 700 |
$('.selOrder', row.node()).prop('checked', true); |
709 |
$(".selOrder", row.node()).prop("checked", true); |
| 701 |
} |
710 |
} |
| 702 |
}); |
711 |
}); |
| 703 |
}); |
712 |
}); |
| 704 |
|
713 |
|
| 705 |
$("#dataPreview").on("hidden.bs.modal", function(){ |
714 |
$("#dataPreview").on("hidden.bs.modal", function () { |
| 706 |
$("#dataPreviewLabel").html(""); |
715 |
$("#dataPreviewLabel").html(""); |
| 707 |
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
716 |
$("#dataPreview .modal-body").html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>"); |
| 708 |
}); |
717 |
}); |
| 709 |
|
718 |
|
| 710 |
$("body").on("click", ".previewData", function(e){ |
719 |
$("body").on("click", ".previewData", function (e) { |
| 711 |
e.preventDefault(); |
720 |
e.preventDefault(); |
| 712 |
var ltitle = $(this).text(); |
721 |
var ltitle = $(this).text(); |
| 713 |
var page = $(this).attr("href"); |
722 |
var page = $(this).attr("href"); |
| 714 |
$("#dataPreviewLabel").text(ltitle); |
723 |
$("#dataPreviewLabel").text(ltitle); |
| 715 |
$("#dataPreview .modal-body").load(page + " div"); |
724 |
$("#dataPreview .modal-body").load(page + " div"); |
| 716 |
$('#dataPreview').modal("show"); |
725 |
$("#dataPreview").modal("show"); |
| 717 |
}); |
726 |
}); |
| 718 |
|
|
|
| 719 |
}); |
727 |
}); |
| 720 |
|
728 |
|
| 721 |
// Case-insensitive version of jquery's contains function |
729 |
// Case-insensitive version of jquery's contains function |
| 722 |
jQuery.extend(jQuery.expr[':'], { |
730 |
jQuery.extend(jQuery.expr[":"], { |
| 723 |
icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0" |
731 |
icontains: "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0", |
| 724 |
}); |
732 |
}); |
| 725 |
|
733 |
|
| 726 |
// Contains exactly function |
734 |
// Contains exactly function |
| 727 |
jQuery.extend(jQuery.expr[':'], { |
735 |
jQuery.extend(jQuery.expr[":"], { |
| 728 |
containsExactly: "$(a).text() == m[3]" |
736 |
containsExactly: "$(a).text() == m[3]", |
| 729 |
}); |
737 |
}); |
| 730 |
|
738 |
|
| 731 |
function transfer_order_popup(ordernumber) { |
739 |
function transfer_order_popup(ordernumber) { |
| 732 |
var url = "/cgi-bin/koha/acqui/transferorder.pl?" |
740 |
var url = "/cgi-bin/koha/acqui/transferorder.pl?" + "ordernumber=" + ordernumber; |
| 733 |
+ "ordernumber=" + ordernumber |
741 |
window.open(url, "TransferOrder"); |
| 734 |
window.open(url, 'TransferOrder'); |
|
|
| 735 |
} |
742 |
} |
| 736 |
</script> |
743 |
</script> |
| 737 |
[% END %] |
744 |
[% END %] |
| 738 |
- |
|
|