4 [% USE AuthorisedValues %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Article requests › Circulation › Koha</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 <style>p { margin-top: 0; } [id^="article-menu-"] { display: none; } [id^="article-menu-"]:before { content: "|"; } .starthidden { display:none; }</style>
15 <div id="[% menuid | html %]" class="btn-group dropup">
16 <a class="btn btn-default btn-xs dropdown-toggle ar-actions" role="button" data-toggle="dropdown" href="#">
17 Actions <b class="caret"></b>
20 <ul class="dropdown-menu [% pull_right | html %]" role="menu" aria-labelledby="[% aria_menu | html %]">
22 <a class="ar-set-pending-request" href="#" onclick="HandleMulti( SetPending, [% id_arg | html %], $(this) ); return false;">
23 <i class="fa fa-bars"></i>
24 Set request as pending
27 <a class="ar-process-request" href="#" onclick="HandleMulti( Process, [% id_arg | html %], $(this) ); return false;">
28 <i class="fa fa-cog"></i>
32 [% IF id_arg && format=='SCAN' %]
33 <a class="ar-edit-urls" href="#" onclick="HandleMulti( EditURLs, [% id_arg | html %], $(this) ); return false;">
34 <i class="fa fa-edit"></i>
39 <a class="ar-complete-request" href="#" onclick="HandleMulti( Complete, [% id_arg | html %], $(this) ); return false;">
40 <i class="fa fa-check-circle"></i>
44 <a class="ar-cancel-request" href="#" onclick="HandleMulti( Cancel, [% id_arg | html %], $(this) ); return false;">
45 <i class="fa fa-minus-circle"></i>
49 [% IF id_arg %][%# TODO: Does not work with multi-select %]
50 <a class="ar-print-request" href="#" onclick="HandleMulti( PrintSlip, [% id_arg | html %], $(this) ); return false;">
51 <i class="fa fa-print"></i>
59 [% BLOCK item_status %]
60 [% IF myitem.onloan %]<span>Checked out</span>
61 [% ELSIF myitem.holds({ found => ['W', 'T'] }).count > 0 %]<span>On hold</span>
62 [% ELSIF myitem.notforloan > 0 OR myitem.itemtype.notforloan %]<span>Not for loan</span>
63 [% ELSIF myitem.notforloan < 0 %]<span>On order</span>
66 [% BLOCK urls_modal %]
67 <div id="myModal" class="modal fade modal-lg" role="dialog">
68 <div class="modal-dialog">
69 <div class="modal-content">
70 <div class="modal-header">
71 <h4 class="modal-title">Edit URL(s)</h4>
73 <div class="modal-body">
74 <textarea id="urls" style="width:100%;"></textarea>
76 <div class="modal-footer">
77 <button type="button" class="btn btn-default" data-dismiss="modal">Save</button>
84 <body id="circ_article-requests" class="circ">
85 [% INCLUDE 'header.inc' %]
86 [% INCLUDE 'cat-search.inc' %]
89 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
92 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
95 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
98 <a href="#" aria-current="page">Article requests</a>
103 <div class="main container-fluid starthidden">
105 <div class="col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1">
107 <h1>Article requests</h1>
108 [% PROCESS urls_modal %]
110 <form id="ar-branchcode-form" method="post">
111 <select name="branchcode" id="branchcode">
112 <option value="">All libraries</option>
113 [% FOREACH b IN Branches.all( only_from_group => 1 ) %]
114 [% IF b.branchcode == branchcode %]
115 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
117 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
121 <button type="submit" class="btn btn-default btn-xs">
122 <i class="fa fa-refresh"></i> Update
126 <div id="article-request-tabs" class="toptabs">
129 <a href="#article-requests-requested">
130 New (<span id="ar_requested_count">[% article_requests_requested.count | html %]</span>)
135 <a href="#article-requests-pending">
136 Pending (<span id="ar_pending_count">[% article_requests_pending.count | html %]</span>)
141 <a href="#article-requests-processing">
142 Processing (<span id="ar_processing_count">[% article_requests_processing.count | html %]</span>)
147 <div id="article-requests-requested">
148 <div class="article-requests-requested_table_controls">
149 <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
150 [% PROCESS actions menuid='article-menu-requested' id_arg=0 pull_right='' aria_menu='table_controls' %]
153 <table id="article-requests-requested-table">
157 <th class="ar-title">Title</th>
158 <th class="ar-request">Requested article</th>
159 <th class="ar-collection">Collection</th>
160 <th class="ar-itemtype">Item type</th>
161 <th class="ar-callnumber">Call number</th>
162 <th class="ar-status">Status</th>
163 <th class="ar-copynumber">Copy number</th>
164 <th class="ar-enumchron">Enumeration</th>
165 <th class="ar-barcode">Barcode</th>
166 <th class="ar-format">Format</th>
167 <th class="ar-urls">URLs</th>
168 <th class="ar-patron">Patron</th>
169 <th class="ar-date">Date</th>
170 <th class="ar-actions noExport">Actions</th>
175 [% FOREACH ar IN article_requests_requested %]
176 <tr class="ar-row ar-requested">
177 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
178 <td class="ar-title">
180 <a class="title" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber | uri %]">
181 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
186 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
187 <div class="ar-author">[% ar.biblio.author | html %]</div>
188 <div class="ar-pubdata">
189 [% ar.biblio.biblioitem.publishercode | html %]
191 [% IF ar.biblio.biblioitem.publicationyear %]
192 [% ar.biblio.biblioitem.publicationyear | html %]
193 [% ELSIF ar.biblio.copyrightdate %]
194 [% ar.biblio.copyrightdate | html %]
197 [% IF ar.biblio.biblioitem.pages %]
198 : [% ar.biblio.biblioitem.pages | html %]
201 [% r.biblio.biblioitem.size | html %]
203 [% IF ar.biblio.biblioitem.isbn %]
204 ISBN: [% ar.biblio.biblioitem.isbn | html %]
209 <td class="ar-request">
210 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
211 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
212 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
213 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
214 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
215 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
216 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
217 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
219 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
220 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
221 <td class="ar-callnumber">
222 [% IF ar.item.location %]
223 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
226 [% ar.item.itemcallnumber | html %]
228 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
229 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
230 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
231 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
232 <td class="ar-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
233 <td class="ar-urls">[% IF ar.format == 'SCAN' %]<span id="url_yesno_[% ar.id | html %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id | html %]" style="display:none;">[% ar.urls | url %]</span>[% END %]</td>
234 <td class="ar-patron">
236 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
237 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
241 <p>[% ar.borrower.phone | html %]</p>
243 <td class="ar-date"><span title="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</span></td>
244 <td class="ar-actions">
245 [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
253 <div id="article-requests-pending">
254 <div class="article-requests-pending_table_controls">
255 <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
256 [% PROCESS actions menuid='article-menu-pending' id_arg=0 pull_right='' aria_menu='table_controls' %]
259 <table id="article-requests-pending-table">
263 <th class="ar-title">Title</th>
264 <th class="ar-request">Requested article</th>
265 <th class="ar-collection">Collection</th>
266 <th class="ar-itemtype">Item type</th>
267 <th class="ar-callnumber">Call number</th>
268 <th class="ar-status">Status</th>
269 <th class="ar-copynumber">Copy number</th>
270 <th class="ar-enumchron">Enumeration</th>
271 <th class="ar-barcode">Barcode</th>
272 <th class="ar-format">Format</th>
273 <th class="ar-urls">URLs</th>
274 <th class="ar-patron">Patron</th>
275 <th class="ar-date">Date</th>
276 <th class="ar-actions noExport">Actions</th>
281 [% FOREACH ar IN article_requests_pending %]
282 <tr class="ar-row ar-pending">
283 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
284 <td class="ar-title">
286 <a class="title" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber | uri %]">
287 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
292 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
293 <div class="ar-author">[% ar.biblio.author | html %]</div>
294 <div class="ar-pubdata">
295 [% ar.biblio.biblioitem.publishercode | html %]
297 [% IF ar.biblio.biblioitem.publicationyear %]
298 [% ar.biblio.biblioitem.publicationyear | html %]
299 [% ELSIF ar.biblio.copyrightdate %]
300 [% ar.biblio.copyrightdate | html %]
303 [% IF ar.biblio.biblioitem.pages %]
304 : [% ar.biblio.biblioitem.pages | html %]
307 [% r.biblio.biblioitem.size | html %]
309 [% IF ar.biblio.biblioitem.isbn %]
310 ISBN: [% ar.biblio.biblioitem.isbn | html %]
315 <td class="ar-request">
316 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
317 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
318 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
319 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
320 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
321 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
322 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
323 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
325 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
326 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
327 <td class="ar-callnumber">
328 [% IF ar.item.location %]
329 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
332 [% ar.item.itemcallnumber | html %]
334 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
335 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
336 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
337 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
338 <td class="ar-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
339 <td class="ar-urls">[% IF ar.format == 'SCAN' %]<span id="url_yesno_[% ar.id | html %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id | html %]" style="display:none;">[% ar.urls | url %]</span>[% END %]</td>
340 <td class="ar-patron">
342 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
343 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
347 <p>[% ar.borrower.phone | html %]</p>
349 <td class="ar-date" data-order="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</td>
350 <td class="ar-actions">
351 [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id format=ar.format pull_right='pull-right' aria_menu='ar-actions' %]
359 <div id="article-requests-processing">
360 <div class="article-requests-processing_table_controls">
361 <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
362 [% PROCESS actions menuid='article-menu-processing' id_arg=0 pull_right='' aria_menu='table_controls' %]
364 <table id="article-requests-processing-table">
368 <th class="ar-title">Title</th>
369 <th class="ar-request">Requested article</th>
370 <th class="ar-collection">Collection</th>
371 <th class="ar-itemtype">Item type</th>
372 <th class="ar-callnumber">Call number</th>
373 <th class="ar-status">Status</th>
374 <th class="ar-copynumber">Copy number</th>
375 <th class="ar-enumchron">Enumeration</th>
376 <th class="ar-barcode">Barcode</th>
377 <th class="ar-format">Format</th>
378 <th class="ar-urls">URLs</th>
379 <th class="ar-patron">Patron</th>
380 <th class="ar-date">Date</th>
381 <th class="ar-actions noExport">Actions</th>
386 [% FOREACH ar IN article_requests_processing %]
387 <tr class="ar-row ar-processing">
388 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
389 <td class="ar-title">
391 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio link = 1%]
395 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
396 <div class="ar-author">[% ar.biblio.author | html %]</div>
397 <div class="ar-pubdata">
398 [% ar.biblio.biblioitem.publishercode | html %]
400 [% IF ar.biblio.biblioitem.publicationyear %]
401 [% ar.biblio.biblioitem.publicationyear | html %]
402 [% ELSIF ar.biblio.copyrightdate %]
403 [% ar.biblio.copyrightdate | html %]
406 [% IF ar.biblio.biblioitem.pages %]
407 : [% ar.biblio.biblioitem.pages | html %]
410 [% r.biblio.biblioitem.size | html %]
412 [% IF ar.biblio.biblioitem.isbn %]
413 ISBN: [% ar.biblio.biblioitem.isbn | html %]
418 <td class="ar-request">
419 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
420 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
421 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
422 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
423 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
424 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
425 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
426 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
428 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
429 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
430 <td class="ar-callnumber">
431 [% IF ar.item.location %]
432 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
435 [% ar.item.itemcallnumber | html %]
437 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
438 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
439 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
440 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
441 <td class="ar-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
442 <td class="ar-urls">[% IF ar.format == 'SCAN' %]<span id="url_yesno_[% ar.id | html %]">[% IF ar.urls %]Yes[% ELSE %]No[% END%]</span><span id="url_[% ar.id | html %]" style="display:none;">[% ar.urls | url %]</span>[% END %]</td>
443 <td class="ar-patron">
445 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
446 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
450 <p>[% ar.borrower.phone | html %]</p>
452 <td class="ar-date" data-order="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</td>
453 <td class="ar-actions">
454 [% PROCESS actions menuid="table_" _ ar.id id_arg=ar.id format=ar.format pull_right='pull-right' aria_menu='ar-actions' %]
467 [% MACRO jsinclude BLOCK %]
468 [% INCLUDE 'datatables.inc' %]
470 var active_tab = "#article-requests-requested";
471 var last_cancel_reason, requested_datatable, pending_datatable, processing_datatable, active_datatable;
472 $(document).ready(function() {
473 $('#article-request-tabs').tabs({
474 activate: function( activate_event, activate_ui ) {
475 active_tab = activate_ui.newPanel.selector;
476 if( active_tab == '#article-requests-requested' )
477 active_datatable = requested_datatable;
478 else if( active_tab == '#article-requests-pending' )
479 active_datatable = pending_datatable;
480 else active_datatable = processing_datatable;
481 activateBatchActions( active_tab );
486 $( "input:checkbox, #article-request-tabs" ).on("change", function(){
487 activateBatchActions( active_tab );
490 $(".SelectAll").on("click", function(e) {
492 $( active_tab + " input[type='checkbox']").prop('checked', true);
493 activateBatchActions( active_tab );
495 $(".ClearAll").on("click", function(e) {
497 $( active_tab + " input[type='checkbox']").prop('checked', false);
498 activateBatchActions( active_tab );
500 $("a.ar-actions").on('click', function(e) {
501 // Hide menu option ?
502 if( $('#article-requests-requested-table:visible,#article-requests-pending-table:visible').length )
503 $('a.ar-process-request').show();
504 else $('a.ar-process-request').hide();
506 if( $('#article-requests-requested-table').is(":visible") )
507 $('a.ar-set-pending-request').show();
508 else $('a.ar-set-pending-request').hide();
511 $('#myModal').on("shown.bs.modal", function () {
512 $('#myModal textarea').focus();
514 $('#myModal').on("hidden.bs.modal", function () {
515 // Set focus back to dropdown
516 var id = $('#myModal textarea').attr('ar_id');
517 var link = $('span#url_'+ id).parent().parent().find('td.ar-actions').find('div.dropdown a');
518 if( link.length > 0 ) link[0].focus();
520 $( '#myModal button' ).on("click", function () {
521 SaveURLs( $('#myModal textarea').val() );
524 requested_datatable = $("#article-requests-requested-table").DataTable($.extend(true, {}, dataTablesDefaults, {
526 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
530 pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, {
532 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
535 processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, {
537 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
540 active_datatable = requested_datatable;
541 activateBatchActions( active_tab );
542 $(".starthidden").show();
545 function activateBatchActions( active_tab ){
546 // Check to see whether batch menu should be shown based on state of checkboxes
547 if ( $( "input:checkbox", active_tab ).length > 0 ) {
548 // There are rows with checkboxes
549 $( "[class$='_table_controls']", active_tab ).show();
550 if ( $( "input:checkbox:checked", active_tab ).length > 0 ) {
551 $( "[id^='article-menu-']", active_tab ).css("display","inline-block");
553 $( "[id^='article-menu-']", active_tab ).hide();
556 // All rows have been removed
557 $("[class$='_table_controls']", active_tab ).hide();
561 function HandleMulti( fnHandler, id, a ) {
562 last_cancel_reason = undefined;
563 if( id !== 0 ) { fnHandler( id, a ); return; }
564 $( active_tab + " input[type='checkbox']:checked").each(function() {
565 fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') );
569 function PrintSlip(id, a) {
570 var link = 'article-request-slip.pl?id='+id;
571 window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
574 function Cancel( id, a ) {
575 // last_cancel_reason: undefined means 'prompt for new reason'
576 // a null value indicates that prompt was cancelled
577 if( last_cancel_reason === undefined ) last_cancel_reason = prompt(_("Please specify the reason for cancelling selected item(s):"));
578 if ( last_cancel_reason === null ) {
582 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
585 url: '/cgi-bin/koha/svc/article_request',
589 notes: last_cancel_reason
591 success: function( data ) {
592 active_datatable.row( a.closest('tr') ).remove().draw();
594 activateBatchActions( active_tab );
600 function SetPending( id, a ) {
601 var table_row = a.closest('tr');
602 table_row.find('.ar-set-pending-request').remove();
603 table_row.find('input[type="checkbox"]').prop('checked', false);
604 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide();
607 url: '/cgi-bin/koha/svc/article_request',
612 success: function( data ) {
613 $("img.spinner").remove();
614 requested_datatable.row( table_row ).remove().draw();
615 pending_datatable.row.add( table_row ).draw();
617 activateBatchActions( active_tab );
623 function Process( id, a ) {
624 var table_row = a.closest('tr');
625 var table = a.closest('table');
626 var orig_datatable = table.attr('id')==='article-requests-pending-table'?pending_datatable:requested_datatable;
627 table_row.find('.ar-process-request').remove();
628 table_row.find('input[type="checkbox"]').prop('checked', false);
630 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide();
633 url: '/cgi-bin/koha/svc/article_request',
638 success: function( data ) {
639 $("img.spinner").remove();
640 orig_datatable.row( table_row ).remove().draw();
641 processing_datatable.row.add( table_row ).draw();
643 activateBatchActions( active_tab );
649 function Complete( id, a ) {
650 // if it is a scan, check if urls field is filled
651 var urlspan = $('span#url_'+id);
652 if( urlspan.length>0 && urlspan.text() === '' ) {
653 alert( _("Please fill URL before completing request.") );
656 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
659 url: '/cgi-bin/koha/svc/article_request',
664 success: function( data ) {
665 active_datatable.row( a.closest('tr') ).remove().draw();
667 activateBatchActions( active_tab );
673 function UpdateTabCounts() {
674 $("#ar_requested_count").html( requested_datatable.rows().count() );
675 $("#ar_pending_count").html( pending_datatable.rows().count() );
676 $("#ar_processing_count").html( processing_datatable.rows().count() );
679 function EditURLs(id) {
680 var urls = $('span#url_'+ id).text();
681 $('#myModal textarea').val(urls);
682 $('#myModal textarea').attr('ar_id', id);
683 $('#myModal').modal('show');
686 function SaveURLs(newurl) {
687 var id = $('#myModal textarea').attr('ar_id');
688 $('span#url_'+ id).text(newurl);
690 $('span#url_yesno_'+id).text(_("Yes"));
692 $('span#url_yesno_'+id).text(_("No"));
696 url: '/cgi-bin/koha/svc/article_request',
697 data: { action: 'update_urls', id: id, urls: newurl },
699 error: function() { alert('Error: Saving URL failed!'); },
700 success: function(data) { if(!data.success) alert('Saving URL failed!'); },
706 [% INCLUDE 'intranet-bottom.inc' %]