4 [% USE AuthorisedValues %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha › Circulation › Article requests</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-process-request" href="#" onclick="HandleMulti( Process, [% id_arg | html %], $(this) ); return false;">
23 <i class="fa fa-cog"></i>
27 <a class="ar-complete-request" href="#" onclick="HandleMulti( Complete, [% id_arg | html %], $(this) ); return false;">
28 <i class="fa fa-check-circle"></i>
32 <a class="ar-cancel-request" href="#" onclick="HandleMulti( Cancel, [% id_arg | html %], $(this) ); return false;">
33 <i class="fa fa-minus-circle"></i>
37 [% IF id_arg %][%# TODO: Does not work with multi-select %]
38 <a class="ar-print-request" href="#" onclick="HandleMulti( PrintSlip, [% id_arg | html %], $(this) ); return false;">
39 <i class="fa fa-print"></i>
47 [% BLOCK item_status %]
48 [% IF myitem.onloan %]<span>Checked out</span>
49 [% ELSIF myitem.holds({ found => ['W', 'T'] }).count > 0 %]<span>On hold</span>
50 [% ELSIF myitem.notforloan > 0 OR myitem.itemtype.notforloan %]<span>Not for loan</span>
51 [% ELSIF myitem.notforloan < 0 %]<span>On order</span>
55 <body id="circ_article-requests" class="circ">
56 [% INCLUDE 'header.inc' %]
57 [% INCLUDE 'cat-search.inc' %]
59 <div id="breadcrumbs">
60 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
62 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
64 <a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a>
67 <div class="main container-fluid starthidden">
69 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
71 <h1>Article requests</h1>
73 <form id="ar-branchcode-form" method="post">
74 <select name="branchcode" id="branchcode">
75 <option value="">All libraries</option>
76 [% FOREACH b IN Branches.all( only_from_group => 1 ) %]
77 [% IF b.branchcode == branchcode %]
78 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
80 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
84 <button type="submit" class="btn btn-default btn-xs">
85 <i class="fa fa-refresh"></i> Update
89 <div id="article-request-tabs" class="toptabs">
92 <a href="#article-requests-pending">
93 Pending (<span id="ar_pending_count">[% article_requests_pending.count | html %]</span>)
98 <a href="#article-requests-processing">
99 Processing (<span id="ar_processing_count">[% article_requests_processing.count | html %]</span>)
104 <div id="article-requests-pending">
105 <div class="article-requests-pending_table_controls">
106 <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>
107 [% PROCESS actions menuid='article-menu-pending' id_arg=0 pull_right='' aria_menu='table_controls' %]
110 <table id="article-requests-pending-table">
114 <th class="ar-title">Title</th>
115 <th class="ar-request">Requested article</th>
116 <th class="ar-collection">Collection</th>
117 <th class="ar-itemtype">Item type</th>
118 <th class="ar-callnumber">Call number</th>
119 <th class="ar-status">Status</th>
120 <th class="ar-copynumber">Copy number</th>
121 <th class="ar-enumchron">Enumeration</th>
122 <th class="ar-barcode">Barcode</th>
123 <th class="ar-patron">Patron</th>
124 <th class="ar-date">Date</th>
125 <th class="ar-actions noExport">Actions</th>
130 [% FOREACH ar IN article_requests_pending %]
131 <tr class="ar-row ar-pending">
132 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
133 <td class="ar-title">
135 <a class="title" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber | uri %]">
136 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
141 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
142 <div class="ar-author">[% ar.biblio.author | html %]</div>
143 <div class="ar-pubdata">
144 [% ar.biblio.biblioitem.publishercode | html %]
146 [% IF ar.biblio.biblioitem.publicationyear %]
147 [% ar.biblio.biblioitem.publicationyear | html %]
148 [% ELSIF ar.biblio.copyrightdate %]
149 [% ar.biblio.copyrightdate | html %]
152 [% IF ar.biblio.biblioitem.pages %]
153 : [% ar.biblio.biblioitem.pages | html %]
156 [% r.biblio.biblioitem.size | html %]
158 [% IF ar.biblio.biblioitem.isbn %]
159 ISBN: [% ar.biblio.biblioitem.isbn | html %]
164 <td class="ar-request">
165 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
166 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
167 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
168 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
169 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
170 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
171 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
172 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
174 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
175 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
176 <td class="ar-callnumber">
177 [% IF ar.item.location %]
178 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
181 [% ar.item.itemcallnumber | html %]
183 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
184 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
185 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
186 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
187 <td class="ar-patron">
189 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
190 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
194 <p>[% ar.borrower.phone | html %]</p>
196 <td class="ar-date"><span title="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</span></td>
197 <td class="ar-actions">
198 [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
206 <div id="article-requests-processing">
207 <div class="article-requests-processing_table_controls">
208 <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>
209 [% PROCESS actions menuid='article-menu-processing' id_arg=0 pull_right='' aria_menu='table_controls' %]
211 <table id="article-requests-processing-table">
215 <th class="ar-title">Title</th>
216 <th class="ar-request">Requested article</th>
217 <th class="ar-collection">Collection</th>
218 <th class="ar-itemtype">Item type</th>
219 <th class="ar-callnumber">Call number</th>
220 <th class="ar-status">Status</th>
221 <th class="ar-copynumber">Copy number</th>
222 <th class="ar-enumchron">Enumeration</th>
223 <th class="ar-barcode">Barcode</th>
224 <th class="ar-patron">Patron</th>
225 <th class="ar-date">Date</th>
226 <th class="ar-actions noExport">Actions</th>
231 [% FOREACH ar IN article_requests_processing %]
232 <tr class="ar-row ar-processing">
233 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
234 <td class="ar-title">
236 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio link = 1%]
240 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
241 <div class="ar-author">[% ar.biblio.author | html %]</div>
242 <div class="ar-pubdata">
243 [% ar.biblio.biblioitem.publishercode | html %]
245 [% IF ar.biblio.biblioitem.publicationyear %]
246 [% ar.biblio.biblioitem.publicationyear | html %]
247 [% ELSIF ar.biblio.copyrightdate %]
248 [% ar.biblio.copyrightdate | html %]
251 [% IF ar.biblio.biblioitem.pages %]
252 : [% ar.biblio.biblioitem.pages | html %]
255 [% r.biblio.biblioitem.size | html %]
257 [% IF ar.biblio.biblioitem.isbn %]
258 ISBN: [% ar.biblio.biblioitem.isbn | html %]
263 <td class="ar-request">
264 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
265 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
266 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
267 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
268 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
269 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
270 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
271 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
273 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
274 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
275 <td class="ar-callnumber">
276 [% IF ar.item.location %]
277 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
280 [% ar.item.itemcallnumber | html %]
282 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
283 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
284 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
285 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
286 <td class="ar-patron">
288 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
289 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
293 <p>[% ar.borrower.phone | html %]</p>
295 <td class="ar-date"><span title="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</span></td>
296 <td class="ar-actions">
297 [% PROCESS actions menuid="table_" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
310 [% MACRO jsinclude BLOCK %]
311 [% INCLUDE 'datatables.inc' %]
313 var active_tab = "#article-requests-pending";
314 var last_cancel_reason, pending_datatable, processing_datatable, active_datatable;
315 $(document).ready(function() {
316 $('#article-request-tabs').tabs({
317 activate: function( activate_event, activate_ui ) {
318 active_tab = activate_ui.newPanel.selector;
319 if( active_tab == '#article-requests-pending' )
320 active_datatable = pending_datatable;
321 else active_datatable = processing_datatable;
322 activateBatchActions( active_tab );
327 $( "input:checkbox, #article-request-tabs" ).on("change", function(){
328 activateBatchActions( active_tab );
331 $(".SelectAll").on("click", function(e) {
333 $( active_tab + " input[type='checkbox']").prop('checked', true);
334 activateBatchActions( active_tab );
336 $(".ClearAll").on("click", function(e) {
338 $( active_tab + " input[type='checkbox']").prop('checked', false);
339 activateBatchActions( active_tab );
341 $("a.ar-actions").on('click', function(e) {
342 // Hide menu option ?
343 if( $('#article-requests-processing-table').is(":visible") )
344 $('a.ar-process-request').hide();
345 else $('a.ar-process-request').show();
348 pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, {
350 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
353 active_datatable = pending_datatable;
354 processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, {
356 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
359 activateBatchActions( active_tab );
360 $(".starthidden").show();
363 function activateBatchActions( active_tab ){
364 // Check to see whether batch menu should be shown based on state of checkboxes
365 if ( $( "input:checkbox", active_tab ).length > 0 ) {
366 // There are rows with checkboxes
367 $( "[class$='_table_controls']", active_tab ).show();
368 if ( $( "input:checkbox:checked", active_tab ).length > 0 ) {
369 $( "[id^='article-menu-']", active_tab ).css("display","inline-block");
371 $( "[id^='article-menu-']", active_tab ).hide();
374 // All rows have been removed
375 $("[class$='_table_controls']", active_tab ).hide();
379 function HandleMulti( fnHandler, id, a ) {
380 last_cancel_reason = undefined;
381 if( id !== 0 ) { fnHandler( id, a ); return; }
382 $( active_tab + " input[type='checkbox']:checked").each(function() {
383 fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') );
387 function PrintSlip(id, a) {
388 var link = 'article-request-slip.pl?id='+id;
389 window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
392 function Cancel( id, a ) {
393 // last_cancel_reason: undefined means 'prompt for new reason'
394 // a null value indicates that prompt was cancelled
395 if( last_cancel_reason === undefined ) last_cancel_reason = prompt(_("Please specify the reason for cancelling selected item(s):"));
396 if ( last_cancel_reason === null ) {
400 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
403 url: '/cgi-bin/koha/svc/article_request',
407 notes: last_cancel_reason
409 success: function( data ) {
410 active_datatable.row( a.closest('tr') ).remove().draw();
412 activateBatchActions( active_tab );
418 function Process( id, a ) {
419 var table_row = a.closest('tr');
420 table_row.find('.ar-process-request').remove();
421 table_row.find('input[type="checkbox"]').prop('checked', false);
423 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide();
426 url: '/cgi-bin/koha/svc/article_request',
431 success: function( data ) {
432 $("img.spinner").remove();
433 pending_datatable.row( table_row ).remove().draw();
434 processing_datatable.row.add( table_row ).draw();
436 activateBatchActions( active_tab );
442 function Complete( id, a ) {
443 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
446 url: '/cgi-bin/koha/svc/article_request',
451 success: function( data ) {
452 active_datatable.row( a.closest('tr') ).remove().draw();
454 activateBatchActions( active_tab );
460 function UpdateTabCounts() {
461 $("#ar_pending_count").html( pending_datatable.rows().count() );
462 $("#ar_processing_count").html( processing_datatable.rows().count() );
467 [% INCLUDE 'intranet-bottom.inc' %]