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' %]
60 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
63 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
66 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
69 <a href="#" aria-current="page">Article requests</a>
74 <div class="main container-fluid starthidden">
76 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
78 <h1>Article requests</h1>
80 <form id="ar-branchcode-form" method="post">
81 <select name="branchcode" id="branchcode">
82 <option value="">All libraries</option>
83 [% FOREACH b IN Branches.all( only_from_group => 1 ) %]
84 [% IF b.branchcode == branchcode %]
85 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
87 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
91 <button type="submit" class="btn btn-default btn-xs">
92 <i class="fa fa-refresh"></i> Update
96 <div id="article-request-tabs" class="toptabs">
99 <a href="#article-requests-pending">
100 Pending (<span id="ar_pending_count">[% article_requests_pending.count | html %]</span>)
105 <a href="#article-requests-processing">
106 Processing (<span id="ar_processing_count">[% article_requests_processing.count | html %]</span>)
111 <div id="article-requests-pending">
112 <div class="article-requests-pending_table_controls">
113 <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>
114 [% PROCESS actions menuid='article-menu-pending' id_arg=0 pull_right='' aria_menu='table_controls' %]
117 <table id="article-requests-pending-table">
121 <th class="ar-title">Title</th>
122 <th class="ar-request">Requested article</th>
123 <th class="ar-collection">Collection</th>
124 <th class="ar-itemtype">Item type</th>
125 <th class="ar-callnumber">Call number</th>
126 <th class="ar-status">Status</th>
127 <th class="ar-copynumber">Copy number</th>
128 <th class="ar-enumchron">Enumeration</th>
129 <th class="ar-barcode">Barcode</th>
130 <th class="ar-patron">Patron</th>
131 <th class="ar-date">Date</th>
132 <th class="ar-actions noExport">Actions</th>
137 [% FOREACH ar IN article_requests_pending %]
138 <tr class="ar-row ar-pending">
139 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
140 <td class="ar-title">
142 <a class="title" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber | uri %]">
143 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
148 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
149 <div class="ar-author">[% ar.biblio.author | html %]</div>
150 <div class="ar-pubdata">
151 [% ar.biblio.biblioitem.publishercode | html %]
153 [% IF ar.biblio.biblioitem.publicationyear %]
154 [% ar.biblio.biblioitem.publicationyear | html %]
155 [% ELSIF ar.biblio.copyrightdate %]
156 [% ar.biblio.copyrightdate | html %]
159 [% IF ar.biblio.biblioitem.pages %]
160 : [% ar.biblio.biblioitem.pages | html %]
163 [% r.biblio.biblioitem.size | html %]
165 [% IF ar.biblio.biblioitem.isbn %]
166 ISBN: [% ar.biblio.biblioitem.isbn | html %]
171 <td class="ar-request">
172 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
173 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
174 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
175 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
176 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
177 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
178 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
179 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
181 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
182 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
183 <td class="ar-callnumber">
184 [% IF ar.item.location %]
185 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
188 [% ar.item.itemcallnumber | html %]
190 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
191 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
192 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
193 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
194 <td class="ar-patron">
196 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
197 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
201 <p>[% ar.borrower.phone | html %]</p>
203 <td class="ar-date"><span title="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</span></td>
204 <td class="ar-actions">
205 [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
213 <div id="article-requests-processing">
214 <div class="article-requests-processing_table_controls">
215 <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>
216 [% PROCESS actions menuid='article-menu-processing' id_arg=0 pull_right='' aria_menu='table_controls' %]
218 <table id="article-requests-processing-table">
222 <th class="ar-title">Title</th>
223 <th class="ar-request">Requested article</th>
224 <th class="ar-collection">Collection</th>
225 <th class="ar-itemtype">Item type</th>
226 <th class="ar-callnumber">Call number</th>
227 <th class="ar-status">Status</th>
228 <th class="ar-copynumber">Copy number</th>
229 <th class="ar-enumchron">Enumeration</th>
230 <th class="ar-barcode">Barcode</th>
231 <th class="ar-patron">Patron</th>
232 <th class="ar-date">Date</th>
233 <th class="ar-actions noExport">Actions</th>
238 [% FOREACH ar IN article_requests_processing %]
239 <tr class="ar-row ar-processing">
240 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
241 <td class="ar-title">
243 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio link = 1%]
247 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
248 <div class="ar-author">[% ar.biblio.author | html %]</div>
249 <div class="ar-pubdata">
250 [% ar.biblio.biblioitem.publishercode | html %]
252 [% IF ar.biblio.biblioitem.publicationyear %]
253 [% ar.biblio.biblioitem.publicationyear | html %]
254 [% ELSIF ar.biblio.copyrightdate %]
255 [% ar.biblio.copyrightdate | html %]
258 [% IF ar.biblio.biblioitem.pages %]
259 : [% ar.biblio.biblioitem.pages | html %]
262 [% r.biblio.biblioitem.size | html %]
264 [% IF ar.biblio.biblioitem.isbn %]
265 ISBN: [% ar.biblio.biblioitem.isbn | html %]
270 <td class="ar-request">
271 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
272 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
273 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
274 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
275 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
276 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
277 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
278 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
280 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
281 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
282 <td class="ar-callnumber">
283 [% IF ar.item.location %]
284 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
287 [% ar.item.itemcallnumber | html %]
289 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
290 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
291 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
292 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
293 <td class="ar-patron">
295 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
296 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
300 <p>[% ar.borrower.phone | html %]</p>
302 <td class="ar-date"><span title="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</span></td>
303 <td class="ar-actions">
304 [% PROCESS actions menuid="table_" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
317 [% MACRO jsinclude BLOCK %]
318 [% INCLUDE 'datatables.inc' %]
320 var active_tab = "#article-requests-pending";
321 var last_cancel_reason, pending_datatable, processing_datatable, active_datatable;
322 $(document).ready(function() {
323 $('#article-request-tabs').tabs({
324 activate: function( activate_event, activate_ui ) {
325 active_tab = activate_ui.newPanel.selector;
326 if( active_tab == '#article-requests-pending' )
327 active_datatable = pending_datatable;
328 else active_datatable = processing_datatable;
329 activateBatchActions( active_tab );
334 $( "input:checkbox, #article-request-tabs" ).on("change", function(){
335 activateBatchActions( active_tab );
338 $(".SelectAll").on("click", function(e) {
340 $( active_tab + " input[type='checkbox']").prop('checked', true);
341 activateBatchActions( active_tab );
343 $(".ClearAll").on("click", function(e) {
345 $( active_tab + " input[type='checkbox']").prop('checked', false);
346 activateBatchActions( active_tab );
348 $("a.ar-actions").on('click', function(e) {
349 // Hide menu option ?
350 if( $('#article-requests-processing-table').is(":visible") )
351 $('a.ar-process-request').hide();
352 else $('a.ar-process-request').show();
355 pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, {
357 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
360 active_datatable = pending_datatable;
361 processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, {
363 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
366 activateBatchActions( active_tab );
367 $(".starthidden").show();
370 function activateBatchActions( active_tab ){
371 // Check to see whether batch menu should be shown based on state of checkboxes
372 if ( $( "input:checkbox", active_tab ).length > 0 ) {
373 // There are rows with checkboxes
374 $( "[class$='_table_controls']", active_tab ).show();
375 if ( $( "input:checkbox:checked", active_tab ).length > 0 ) {
376 $( "[id^='article-menu-']", active_tab ).css("display","inline-block");
378 $( "[id^='article-menu-']", active_tab ).hide();
381 // All rows have been removed
382 $("[class$='_table_controls']", active_tab ).hide();
386 function HandleMulti( fnHandler, id, a ) {
387 last_cancel_reason = undefined;
388 if( id !== 0 ) { fnHandler( id, a ); return; }
389 $( active_tab + " input[type='checkbox']:checked").each(function() {
390 fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') );
394 function PrintSlip(id, a) {
395 var link = 'article-request-slip.pl?id='+id;
396 window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
399 function Cancel( id, a ) {
400 // last_cancel_reason: undefined means 'prompt for new reason'
401 // a null value indicates that prompt was cancelled
402 if( last_cancel_reason === undefined ) last_cancel_reason = prompt(_("Please specify the reason for cancelling selected item(s):"));
403 if ( last_cancel_reason === null ) {
407 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
410 url: '/cgi-bin/koha/svc/article_request',
414 notes: last_cancel_reason
416 success: function( data ) {
417 active_datatable.row( a.closest('tr') ).remove().draw();
419 activateBatchActions( active_tab );
425 function Process( id, a ) {
426 var table_row = a.closest('tr');
427 table_row.find('.ar-process-request').remove();
428 table_row.find('input[type="checkbox"]').prop('checked', false);
430 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide();
433 url: '/cgi-bin/koha/svc/article_request',
438 success: function( data ) {
439 $("img.spinner").remove();
440 pending_datatable.row( table_row ).remove().draw();
441 processing_datatable.row.add( table_row ).draw();
443 activateBatchActions( active_tab );
449 function Complete( id, a ) {
450 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
453 url: '/cgi-bin/koha/svc/article_request',
458 success: function( data ) {
459 active_datatable.row( a.closest('tr') ).remove().draw();
461 activateBatchActions( active_tab );
467 function UpdateTabCounts() {
468 $("#ar_pending_count").html( pending_datatable.rows().count() );
469 $("#ar_processing_count").html( processing_datatable.rows().count() );
474 [% INCLUDE 'intranet-bottom.inc' %]