6 [% USE currency = format('%.2f') -%]
7 [% PROCESS 'i18n.inc' %]
9 [% INCLUDE 'doc-head-open.inc' %]
11 Koha › Acquisitions ›
12 [% IF ( invoiceclosedate ) %]
13 Receipt summary for [% name | html %] [% IF ( invoice ) %]invoice [% invoice | html %][% END %]
15 Receive orders from [% name | html %]
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="acq_parcel" class="acq">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'acquisitions-search.inc' %]
25 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> ›
26 [% IF invoiceclosedate %]
27 Receipt summary for <em>[% name | html %]</em>
29 <em>[ [% invoice | html %] ]</em>
32 Receive orders from [% name | html %]
37 <div class="main container-fluid">
39 <div class="col-sm-10 col-sm-push-2">
42 [% IF ( receive_error ) %]
43 <div class="dialog alert">
44 <h3>Error adding items:</h3>
46 [% FOREACH error_loo IN error_loop %]
47 <li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
53 [% IF ( invoiceclosedate ) %]
54 Receipt summary for <em>[% name | html %]</em> [% IF ( invoice ) %] <em> [ [% invoice | html %] ] </em>[% END %]
56 Receive orders from [% name | html %]
60 [% IF ( success_delorder ) %]
61 <div class="dialog message">The order has been successfully canceled.</div>
63 [% IF ( error_delitem ) %]
64 <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
66 [% IF ( error_delbiblio ) %]
67 <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
71 [% IF (error_cancelling_receipt) %]
72 <div class="dialog alert">
73 Cannot cancel receipt. Possible reasons :
76 The order line you are trying to cancel was created from a partial receipt
77 of another order line which is already received. Try to cancel this
81 The order line you are trying to cancel was created from a partial receipt
82 of another order line which has been deleted. Cancellation is not
89 [% IF error_invoice_not_known %]
90 <div class="dialog alert">
91 The invoice referenced by this invoiceid does not exist.
95 [% UNLESS no_orders_to_display %]
96 <div id="acqui_receive_summary">
97 <p><strong>Invoice number:</strong> [% invoice | html %] <strong>Shipment date:</strong> [% shipmentdate | $KohaDates %]</p>
99 [% UNLESS (invoiceclosedate) %]
100 <div id="acqui_receive_search">
101 <h3>Pending orders</h3>
102 <table id="pending_orders" class="table table-bordered table-striped">
106 <th>Basket group</th>
108 <th class="hidden">Title</th>
109 <th class="hidden">Author</th>
110 <th class="hidden">ISBN</th>
113 <th>Replacement price</th>
122 <th><div class="input-group input-group-sm"><input id="basket_name_column_search" type="text" class="form-control column-filter" data-search-fields='["basket.name"]'></div></th>
123 <th><div class="input-group input-group-sm"><input type="text" class="form-control column-filter" data-search-fields='["basket.basket_group.name"]'></div></th>
124 <th><div class="input-group input-group-sm"><input type="text" class="form-control column-filter" data-search-fields='["me.order_id"]'></div></th>
125 <th class="hidden"> </th>
126 <th class="hidden"> </th>
127 <th class="hidden"> </th>
128 <th><div class="input-group input-group-sm"><input type="text" class="form-control column-filter" data-search-fields='["me.internal_note","me.vendor_note","biblio.title","biblio.author","biblio.isbn","biblio.publisher","biblio.publication_year","biblio.copyright_date","biblio.suggestions.suggester.surname","biblio.suggestions.suggester.firstname"]'></div></th>
130 <th><div class="input-group input-group-sm"><input type="text" class="form-control column-filter" data-search-fields='["me.replacement_price"]'></div></th>
131 <th><div class="input-group input-group-sm"><input type="text" class="form-control column-filter" data-search-fields='["me.quantity"]'></div></th>
132 <th><div class="input-group input-group-sm"><input type="text" class="form-control column-filter" data-search-fields='["me.ecost"]'></div></th>
134 <!--th><div class="input-group input-group-sm"><input type="text" class="form-control column-filter" data-search-fields='["order_cost"]'></div></th-->
135 <th><div class="input-group input-group-sm"><input type="text" class="form-control column-filter" data-search-fields='["fund.name"]'></div></th>
144 Invoice is closed, so you can't receive orders anymore.
145 [% IF CAN_user_acquisition_reopen_closed_invoices %]
146 <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid | uri %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]">Reopen it</a>.
151 <div id="acqui_receive_receivelist">
152 <h3>Already received</h3>
154 [% IF ( loop_received ) %]
155 <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
156 <table id="receivedt">
160 <th>Basket group</th>
162 <th title="Item holds / Total holds">Holds</th>
165 <th>Replacement price</th>
175 [% FOREACH key IN subtotal_for_funds.keys.sort %]
177 [% IF invoiceincgst %]
178 <td colspan="6" class="total">(Tax inc.)</td>
180 <td colspan="6" class="total">(Tax exc.)</td>
182 <td colspan="3"><em>Subtotal for</em> [% key | html %]</td>
183 <td>[% subtotal_for_funds.$key.ecost | $Price %]</td>
184 <td>[% subtotal_for_funds.$key.unitprice | $Price %]</td>
190 <th colspan="11" class="total">Total tax exc.</th>
191 <th>[% total_tax_excluded | $Price %]</th>
194 [% FOREACH book_foot IN book_foot_loop %]
196 <th colspan="11">Total (GST [% book_foot.tax_rate * 100 | html %]%)</th>
197 <th>[% book_foot.tax_value | $Price %]</th>
202 <th colspan="11" class="total">Total tax inc.</th>
203 <th>[% total_tax_included | $Price %]</th>
207 <tbody class="filterclass">
208 [% FOREACH order IN loop_received %]
210 <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]"> [% order.basketname | html %] ([% order.basketno | html %])</a></td>
212 [% IF order.basketgroupid %]
213 <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | uri %]">[% order.basketgroupname | html %] ([% order.basketgroupid | html %])</a>
219 <a href="neworderempty.pl?ordernumber=[% order.ordernumber | uri %]&booksellerid=[% booksellerid | uri %]">[% order.ordernumber | html %]</a>
220 [% IF (order.parent_ordernumber && (order.parent_ordernumber != order.ordernumber)) %]
221 (<a href="neworderempty.pl?ordernumber=[% order.parent_ordernumber | uri %]&booksellerid=[% booksellerid | uri %]" title="Original order line">[% order.parent_ordernumber | html %]</a>)
225 [% IF order.total_holds > 0 %]
226 [% IF order.item_holds > 0 %]
227 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.item_holds | html %]</a></span>
232 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.total_holds | html %]</a></span>
237 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title | html %]</a>
238 [% IF ( order.author ) %] / [% order.author | html %][% END %]
239 [% IF ( order.isbn ) %] - [% order.isbn | html %][% END %]
240 [% IF ( order.publishercode ) %]
241 <br />Publisher: [% order.publishercode | html %]
242 [%- IF ( order.publicationyear > 0) -%], [% order.publicationyear | html %]
243 [%- ELSIF ( order.copyrightdate > 0) -%] [% order.copyrightdate | html %]
246 [% IF ( order.suggestionid ) %]
248 Suggested by: [% order.surnamesuggestedby | html %][% IF ( order.firstnamesuggestedby ) %], [% order.firstnamesuggestedby | html %] [% END %]
249 (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% order.suggestionid | uri %]&op=show">suggestion #[% order.suggestionid | html %]</a>)
252 [% IF ( order.order_internalnote ) %]
253 <p class="ordernote"><strong>Internal note: </strong>[% order.order_internalnote | html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% order.ordernumber | uri %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=internal">Change internal note</a>]</p>
255 [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% order.ordernumber | uri %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=internal">Add internal note</a>]
257 [% IF ( order.order_vendornote ) %]
258 <p class="ordernote"><strong>Vendor note: </strong>[% order.order_vendornote | html %]</p>
260 [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% order.ordernumber | uri %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=vendor">Add vendor note</a>]
264 <a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=[% order.ordernumber | uri %]" class="previewData">[% tp('noun', 'Order') | html %]</a><br>
265 <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% order.biblionumber | uri %]" class="previewData">MARC</a><br>
266 <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% order.biblionumber | uri %]" class="previewData">Card</a>
268 <td>[% order.replacementprice | $Price %]</td>
269 <td>[% order.quantityreceived | html %]</td>
270 <td>[% order.budget.budget_name | html %]</td>
271 <td>[% order.ecost | $Price %]</td>
272 <td>[% order.unitprice | $Price %]</td>
273 <td>[% order.total | $Price %]</td>
275 [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
276 [% IF loop_receive.cannot_cancel %]
277 [% span_title = BLOCK %]
278 Cannot cancel receipt of this order line because it
279 was created from a partial receipt of order line no.
280 [% order.parent_ordernumber | html %], which is
281 already received. Try cancelling this one first and
285 [%# FIXME Here we block the cancellation if holds exist. Actually it could be possible if items will be exist after the deletion %]
286 [%# Some additional checks should be added in the pl file %]
287 [% span_title = BLOCK %]
288 Cannot cancel receipt of this order line because at least one reservation exists on the records.
291 <span title="[% span_title | collapse | html %]">
295 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]&op=cancelreceipt&ordernumber=[% order.ordernumber | uri %]">Cancel receipt</a>
304 [% ELSE %]There are no received orders.[% END %]
307 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
308 <div class="modal-dialog">
309 <div class="modal-content">
310 <div class="modal-header">
311 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
312 <h3 id="dataPreviewLabel">MARC preview</h3>
314 <div class="modal-body">
315 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
317 <div class="modal-footer">
318 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
324 [% IF (invoiceclosedate) %]
325 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | uri %]">View invoice</a>
327 <form action="/cgi-bin/koha/acqui/invoice.pl" method="get">
328 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
329 <fieldset class="action">
330 <input type="submit" value="Finish receiving" />
338 </div> <!-- /.col-sm-10.col-sm-push-2 -->
340 <div class="col-sm-2 col-sm-pull-10">
343 <form action="/cgi-bin/koha/acqui/parcel.pl" id="filterform" method="post">
344 <fieldset class="brief">
348 <label for="summaryfilter">ISBN, author or title:</label>
349 <input type="text" name="summaryfilter" id="summaryfilter" value="[% summaryfilter | html %]"/>
352 <label for="basketfilter">Basket name:</label>
353 <input type="text" name="basketfilter" id="basketfilter" value="[% basketfilter | html %]"/>
356 <label for="basketgroupnamefilter">Basket group name:</label>
357 <input type="text" name="basketgroupnamefilter" id="basketgroupnamefilter" value="[% basketgroupnamefilter | html %]" />
360 <label for="orderfilter">Order line:</label>
361 <input type="text" name="orderfilter" id="orderfilter" value="[% orderfilter | html %]"/>
365 <label for="eanfilter">EAN:</label>
366 <input type="text" name="eanfilter" id="eanfilter" value="[% eanfilter | html %]"/>
370 <fieldset class="action">
371 <input type="hidden" value="search" name="op" />
372 <input type="hidden" value="[% invoiceid | html %]" name="invoiceid" />
373 <input type="submit" value="Filter" />
374 <a href="#" id="clear_form_filters">Clear</a>
378 [% INCLUDE 'acquisitions-menu.inc' %]
380 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
381 </div> <!-- /.row -->
383 [% MACRO jsinclude BLOCK %]
384 [% Asset.js("js/acquisitions-menu.js") | $raw %]
385 [% INCLUDE 'datatables.inc' %]
386 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
387 [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
388 <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
390 dt_overwrite_html_sorting_localeCompare();
391 var sticky_filters = [% sticky_filters | html %];
392 var columns_filter = {};
394 function query_from_filters( base_query ) {
398 var summary = $("#summaryfilter").val();
399 var basket_group = $("#basketgroupnamefilter").val();
400 var basket_name = $("#basketfilter").val();
401 var order_id = $("#orderfilter").val();
402 var ean = $("#eanfilter").val();
404 // ean == undefined if the HTML doesn't have it
405 ean = (ean === undefined) ? '' : ean;
407 if ( basket_name != "" ) {
408 query_and.push( { "basket.name": { "like": '%'+basket_name+'%' } } );
410 if (basket_group != "") {
411 query_and.push( { "basket.basket_group.name": { "like": '%'+basket_group+'%' } } );
414 query_and.push( { "-or": [{"biblio.title": { "like": '%'+summary+'%' } },
415 {"biblio.author": { "like": '%'+summary+'%' } },
416 {"biblio.isbn": { "like": '%'+summary+'%' } } ] } );
419 query_and.push( { "biblio.ean": ean } );
422 $(".column-filter").each(function () {
423 var search_fields = $(this).data('search-fields');
424 var value = this.value;
427 value != undefined ) { // skip if empty
429 var columns_filters = [];
431 search_fields.forEach( function (item) {
432 if ( item === "me.order_id" ||
433 item === "me.replacement_price" ||
434 item === "me.quantity" ||
435 item === "me.ecost" ) {
436 // For numbers, we do 'starts with'
438 object[item] = { "like": value+'%' };
439 columns_filters.push( object );
443 object[item] = { "like": '%'+value+'%' };
444 columns_filters.push( object );
448 if ( columns_filters.length > 1 ) {
449 query_and.push( { "-or": columns_filters } );
451 else if ( columns_filters.length > 0 ) {
452 query_and.push( columns_filters[0] );
457 var query_params = [];
459 if ( query_and.length > 0 ) {
460 query_and.push(base_query);
461 query_params.push('q=' + encodeURIComponent(JSON.stringify({ "-and": query_and })));
464 if ( order_id != "" ) {
465 query_params.push("order_id="+order_id);
471 function _escape_str(s){
472 return s != null ? s.escapeHtml() : "";
474 function _escape_price(p){
475 return p != null ? p.escapeHtml().format_price() : "";
478 $(document).ready(function(){
480 if ( $("#receivedt").length ) {
481 var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
483 "iCookieDuration": 60*60*24*1000, // 1000 days
484 "iDisplayLength": 10,
485 "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
487 { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
493 { "sType": "num-html" },
494 { "sType": "anti-the" },
504 "sPaginationType": "full"
508 var base_query = { "basket.vendor_id": [% booksellerid | html %] };
509 var query_params = query_from_filters( base_query );
511 var THE_query = query_params.join("&");
513 var pending_orders_url = '/api/v1/acquisitions/orders?only_active=1';
514 var pending_orders_table = $("#pending_orders").api({
516 "url": pending_orders_url + '&' + THE_query
518 "header_filter": true,
520 "basket.basket_group",
521 "biblio.active_orders+count",
522 "biblio.holds+count",
523 "biblio.items+count",
524 "biblio.suggestions.suggester",
526 "current_item_level_holds+count",
529 "stateSave": true, // remember state on page reload
530 "orderCellsTop": true, // tell the datatable sorting is done on the top row
532 'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
533 "drawCallback": function (settings) {
534 $(".previewData").on("click", function(e){
536 var ltitle = $(this).text();
537 var page = $(this).attr("href");
538 $("#dataPreviewLabel").text(ltitle);
539 $("#dataPreview .modal-body").load(page + " div");
540 $('#dataPreview').modal({show:true});
544 "targets": [3,4,5,9],
545 "render": function (data, type, row, meta) {
546 return _escape_str(data);
551 "render": function (data, type, row, meta) {
552 return _escape_price(data);
556 { "data": "basket.name",
558 "render": function(data, type, row, meta) {
559 if (type != 'display') return _escape_str(data);
560 return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + encodeURIComponent(row.basket.basket_id) + "\">" + data.escapeHtml() + " (" + row.basket.basket_id.escapeHtml() + ")</a>";
563 { "data": "basket.basket_group.name",
565 "render": function(data, type, row, meta) {
566 if ( type != 'display' ) {
567 return _escape_str(data);
569 if ( row.basket.basket_group_id == null ) {
570 return _("No basket group");
573 return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid="
574 + encodeURIComponent(row.basket.vendor_id) + "&basketgroupid="
575 + encodeURIComponent(row.basket.basket_group_id) + "\">"
576 + row.basket.basket_group.name.escapeHtml() + " (" + row.basket.basket_group_id.escapeHtml() + ")</a>";
582 "render": function(data, type, row, meta) {
583 if (type != 'display') return _escape_str(data);
584 return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+data.escapeHtml()+"</a>";
588 "data": "biblio.author",
594 "data": "biblio.title",
600 "data": "biblio.isbn",
606 "data": function(row, type, val, meta) {
608 if ( row.biblio_id != null ) {
609 result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+row.biblio.title.escapeHtml()+"</a>";
610 if ( row.biblio.author != null )
611 result += _(" by ") + row.biblio.author.escapeHtml();
612 if ( row.biblio.isbn != null )
613 result += " – " + row.biblio.isbn.escapeHtml();
614 if ( row.biblio.publisher != null ) {
615 result += "<br/>" + _("Publisher: ") + row.biblio.publisher.escapeHtml();
616 if ( row.biblio.publication_year != null ) {
617 result += ", " + row.biblio.publication_year.escapeHtml();
619 else if ( row.biblio.copyright_date != null ) {
620 result += row.biblio.copyright_date.escapeHtml();
623 var suggestions = row.biblio.suggestions;
624 if ( suggestions != null && suggestions.length > 0 ) {
625 var suggestion = suggestions[0];
626 if ( suggestion.suggester != null ) {
627 var suggester = suggestion.suggester;
628 var suggested_by = [];
629 if ( suggester.surname != null ) {
630 suggested_by.push(suggester.surname.escapeHtml());
632 if ( suggester.firstname != null ) {
633 suggested_by.push(suggester.firstname.escapeHtml());
636 result += "<br/>" + _("Suggested by: ") +
637 '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
638 + encodeURIComponent(suggestion.suggestionid)
640 + suggested_by.join(", ")
641 + " (#" + suggestions[0].suggestionid.escapeHtml() + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
647 var internal_note = row.internal_note;
648 if ( internal_note != null && internal_note != '' ) {
649 result += '<p class="ordernote"><strong>'
650 + _("Internal note: ")
651 + '</strong>' + internal_note.escapeHtml()
652 + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
653 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
654 + '&type=internal">' + _("Change internal note") + '</a>]</p>';
657 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
658 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
659 + '&type=internal">' + _("Add internal note") + '</a>]';
662 var vendor_note = row.vendor_note;
663 if ( vendor_note != null && vendor_note != '' ) {
664 result += '<p class="ordernote"><strong>'
666 + '</strong>' + vendor_note.escapeHtml() + '</p>';
669 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
670 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
671 + '&type=vendor">' + _("Add vendor note") + '</a>]';
679 "data": function( row, type, val, meta) {
680 var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '" class="previewData">' + _("Order") + '</a><br>'
681 + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("MARC") + '</a><br>'
682 + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("Card") + '</a>';
688 "data": "replacement_price"
698 "data": function ( row, type, val, meta ) {
699 return (row.quantity * row.ecost).format_price();
701 "orderable": false // FIXME: How can we do it in DBIC?
705 "render": function(data, type, row, meta) {
706 if (type != 'display') return data.escapeHtml();
707 return row.fund.name.escapeHtml();
711 "data": function( row, type, val, meta ) {
712 return '<a href="orderreceive.pl?ordernumber='
713 + encodeURIComponent(row.order_id) + '&invoiceid=[% invoiceid | uri %]' + '">'
714 + _("Receive") + '</a><br/>'
715 + '<a href="#" onclick="transfer_order_popup(' + row.order_id.escapeHtml() + '); return false;">'
716 + _("Transfer") + '</a>';
721 "data": function( row, type, val, meta ) {
724 if ( row.current_holds_count > 0 ) {
725 result += '<span class="button" title="'
726 + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( row.holds_count.escapeHtml() ) + '">'
727 + _("Can't cancel order") + '</span><br/>';
730 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
731 + encodeURIComponent(row.order_id)
732 + '&biblionumber=' + encodeURIComponent(row.biblio_id)
733 + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
734 + _("Cancel order") + '</a><br/>';
737 if ( row.biblio != null ) {
738 if ( row.biblio.items_count - row.items.length > 0 ||
739 row.biblio.active_orders_count > 1 ||
740 row.biblio.subscriptions_count > 0 ||
741 row.biblio.holds_count > 0 ) { // biblio can be deleted
742 result += '<span class="button" title="'
743 + _("Can't delete catalog record, see constraints below") + '">'
744 + _("Can't cancel order and delete catalog record") + '</span><br>';
747 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
748 + encodeURIComponent(row.order_id) + '&biblionumber=' + encodeURIComponent(row.biblio_id)
749 + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
750 + _("Cancel order and catalog record") + '</a><br/>';
753 if ( row.biblio.items_count - row.items.length > 0 ) {
754 result += '<strong title="'
755 + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
756 +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</strong><br/>';
759 if ( row.biblio.active_orders_count > 1 ) {
760 result += '<strong title="'
761 + _("Can't delete catalog record, delete other orders linked to it first") + '">'
762 + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</strong><br/>';
765 if ( row.biblio.subscriptions_count > 0 ) {
766 result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
767 + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
771 if ( row.biblio.holds_count > 0 ) {
772 result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
773 + _("%s hold(s) left").format(row.biblio.holds_count) + '</strong>';
784 // column filter events handling
785 $(".column-filter").each(function () {
786 $(this).on( 'keyup change', function () {
787 // recalculate the query
788 var query_params = query_from_filters( base_query );
789 // refresh the datatable as appropriate
790 if ( query_params.length > 0 ) {
791 pending_orders_table.api().ajax.url( pending_orders_url + '&' + query_params.join("&") );
794 pending_orders_table.api().ajax.url( pending_orders_url + '&q=' + encodeURI(JSON.stringify(base_query)) );
796 pending_orders_table.api().ajax.reload( null, false );
800 $("#filterform").on("submit", function(e) {
803 // Save the filters in the cookie
804 $.cookie("filter_parcel_summary", $("#summaryfilter").val());
805 $.cookie("filter_parcel_basketname", $("#basketfilter").val());
806 $.cookie("filter_parcel_orderno", $("#orderfilter").val());
807 $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
808 $.cookie("filter_parcel_ean", $("#eanfilter").val());
810 var query_params = query_from_filters( base_query );
812 if ( query_params.length > 0 ) {
813 pending_orders_table.api().ajax.url( pending_orders_url + '&' + query_params.join("&") );
816 pending_orders_table.api().ajax.url( pending_orders_url + '&q=' + encodeURI(JSON.stringify(base_query)) );
818 pending_orders_table.api().ajax.reload( null, false );
821 $('#clear_form_filters').on("click", function(){
822 $(this).closest('form').find("input[type=text], textarea").val("");
823 pending_orders_table.api().ajax.url(pending_orders_url + '&q=' + encodeURI(JSON.stringify(base_query))).draw();
826 $(".previewData").on("click", function(e){
828 var ltitle = $(this).text();
829 var page = $(this).attr("href");
830 $("#dataPreviewLabel").text(ltitle);
831 $("#dataPreview .modal-body").load(page + " div");
832 $('#dataPreview').modal({show:true});
835 $("#dataPreview").on("hidden.bs.modal", function(){
836 $("#dataPreviewLabel").html("");
837 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
841 // Case-insensitive version of jquery's contains function
842 jQuery.extend(jQuery.expr[':'], {
843 icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
846 // Contains exactly function
847 jQuery.extend(jQuery.expr[':'], {
848 containsExactly: "$(a).text() == m[3]"
851 function transfer_order_popup(ordernumber) {
852 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
853 + "ordernumber=" + ordernumber
854 window.open(url, 'TransferOrder');
859 [% INCLUDE 'intranet-bottom.inc' %]