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-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-format">Format</th>
131 <th class="ar-patron">Patron</th>
132 <th class="ar-date">Date</th>
133 <th class="ar-actions noExport">Actions</th>
138 [% FOREACH ar IN article_requests_pending %]
139 <tr class="ar-row ar-pending">
140 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
141 <td class="ar-title">
143 <a class="title" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% ar.biblionumber | uri %]">
144 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
149 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
150 <div class="ar-author">[% ar.biblio.author | html %]</div>
151 <div class="ar-pubdata">
152 [% ar.biblio.biblioitem.publishercode | html %]
154 [% IF ar.biblio.biblioitem.publicationyear %]
155 [% ar.biblio.biblioitem.publicationyear | html %]
156 [% ELSIF ar.biblio.copyrightdate %]
157 [% ar.biblio.copyrightdate | html %]
160 [% IF ar.biblio.biblioitem.pages %]
161 : [% ar.biblio.biblioitem.pages | html %]
164 [% r.biblio.biblioitem.size | html %]
166 [% IF ar.biblio.biblioitem.isbn %]
167 ISBN: [% ar.biblio.biblioitem.isbn | html %]
172 <td class="ar-request">
173 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
174 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
175 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
176 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
177 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
178 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
179 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
180 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
182 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
183 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
184 <td class="ar-callnumber">
185 [% IF ar.item.location %]
186 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
189 [% ar.item.itemcallnumber | html %]
191 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
192 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
193 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
194 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
195 <td class="ar-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
196 <td class="ar-patron">
198 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
199 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
203 <p>[% ar.borrower.phone | html %]</p>
205 <td class="ar-date" data-order="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</td>
206 <td class="ar-actions">
207 [% PROCESS actions menuid = "row" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
215 <div id="article-requests-processing">
216 <div class="article-requests-processing_table_controls">
217 <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>
218 [% PROCESS actions menuid='article-menu-processing' id_arg=0 pull_right='' aria_menu='table_controls' %]
220 <table id="article-requests-processing-table">
224 <th class="ar-title">Title</th>
225 <th class="ar-request">Requested article</th>
226 <th class="ar-collection">Collection</th>
227 <th class="ar-itemtype">Item type</th>
228 <th class="ar-callnumber">Call number</th>
229 <th class="ar-status">Status</th>
230 <th class="ar-copynumber">Copy number</th>
231 <th class="ar-enumchron">Enumeration</th>
232 <th class="ar-barcode">Barcode</th>
233 <th class="ar-format">Format</th>
234 <th class="ar-patron">Patron</th>
235 <th class="ar-date">Date</th>
236 <th class="ar-actions noExport">Actions</th>
241 [% FOREACH ar IN article_requests_processing %]
242 <tr class="ar-row ar-processing">
243 <td><input type="checkbox" reqid="[% ar.id | html %]"/></td>
244 <td class="ar-title">
246 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio link = 1%]
250 <div class="ar-biblionumber content_hidden">[% ar.biblionumber | html %]</div>
251 <div class="ar-author">[% ar.biblio.author | html %]</div>
252 <div class="ar-pubdata">
253 [% ar.biblio.biblioitem.publishercode | html %]
255 [% IF ar.biblio.biblioitem.publicationyear %]
256 [% ar.biblio.biblioitem.publicationyear | html %]
257 [% ELSIF ar.biblio.copyrightdate %]
258 [% ar.biblio.copyrightdate | html %]
261 [% IF ar.biblio.biblioitem.pages %]
262 : [% ar.biblio.biblioitem.pages | html %]
265 [% r.biblio.biblioitem.size | html %]
267 [% IF ar.biblio.biblioitem.isbn %]
268 ISBN: [% ar.biblio.biblioitem.isbn | html %]
273 <td class="ar-request">
274 [% IF ar.title %] <p><strong>Title:</strong> [% ar.title | html %] </p> [% END %]
275 [% IF ar.author %] <p><strong>Author:</strong> [% ar.author | html %] </p> [% END %]
276 [% IF ar.volume %] <p><strong>Volume:</strong> [% ar.volume | html %] </p> [% END %]
277 [% IF ar.issue %] <p><strong>Issue:</strong> [% ar.issue | html %] </p> [% END %]
278 [% IF ar.date %] <p><strong>Date:</strong> [% ar.date | html %] </p> [% END %]
279 [% IF ar.pages %] <p><strong>Pages:</strong> [% ar.pages | html %] </p> [% END %]
280 [% IF ar.chapters %] <p><strong>Chapters:</strong> [% ar.chapters | html %] </p> [% END %]
281 [% IF ar.patron_notes %] <p><strong>Patron notes:</strong> [% ar.patron_notes | html %] </p> [% END %]
283 <td class="ar-collection">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ar.item.ccode ) | html %]</td>
284 <td class="ar-itemtype">[% ItemTypes.GetDescription( ar.item.effective_itemtype ) | html %]</td>
285 <td class="ar-callnumber">
286 [% IF ar.item.location %]
287 <em>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ar.item.location ) | html %]</em>
290 [% ar.item.itemcallnumber | html %]
292 <td class="ar-status">[% PROCESS 'item_status' myitem = ar.item IF ar.item %]</td>
293 <td class="ar-copynumber">[% ar.item.copynumber | html %]</td>
294 <td class="ar-enumchron">[% ar.item.enumchron | html %]</td>
295 <td class="ar-barcode">[% ar.item.barcode | html %]</td>
296 <td class="ar-format">[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
297 <td class="ar-patron">
299 <a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% ar.borrower.cardnumber | uri %]">
300 [% ar.borrower.surname | html %][% IF ar.borrower.firstname %], [% ar.borrower.firstname | html %][% END %] ([% ar.borrower.cardnumber | html %])
304 <p>[% ar.borrower.phone | html %]</p>
306 <td class="ar-date" data-order="[% ar.created_on | html %]">[% ar.created_on | $KohaDates %]</td>
307 <td class="ar-actions">
308 [% PROCESS actions menuid="table_" _ ar.id id_arg=ar.id pull_right='pull-right' aria_menu='ar-actions' %]
321 [% MACRO jsinclude BLOCK %]
322 [% INCLUDE 'datatables.inc' %]
324 var active_tab = "#article-requests-pending";
325 var last_cancel_reason, pending_datatable, processing_datatable, active_datatable;
326 $(document).ready(function() {
327 $('#article-request-tabs').tabs({
328 activate: function( activate_event, activate_ui ) {
329 active_tab = activate_ui.newPanel.selector;
330 if( active_tab == '#article-requests-pending' )
331 active_datatable = pending_datatable;
332 else active_datatable = processing_datatable;
333 activateBatchActions( active_tab );
338 $( "input:checkbox, #article-request-tabs" ).on("change", function(){
339 activateBatchActions( active_tab );
342 $(".SelectAll").on("click", function(e) {
344 $( active_tab + " input[type='checkbox']").prop('checked', true);
345 activateBatchActions( active_tab );
347 $(".ClearAll").on("click", function(e) {
349 $( active_tab + " input[type='checkbox']").prop('checked', false);
350 activateBatchActions( active_tab );
352 $("a.ar-actions").on('click', function(e) {
353 // Hide menu option ?
354 if( $('#article-requests-processing-table').is(":visible") )
355 $('a.ar-process-request').hide();
356 else $('a.ar-process-request').show();
359 pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, {
361 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
364 active_datatable = pending_datatable;
365 processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, {
367 { "aTargets": [0, -1], "bSortable": false, "bSearchable": false },
370 activateBatchActions( active_tab );
371 $(".starthidden").show();
374 function activateBatchActions( active_tab ){
375 // Check to see whether batch menu should be shown based on state of checkboxes
376 if ( $( "input:checkbox", active_tab ).length > 0 ) {
377 // There are rows with checkboxes
378 $( "[class$='_table_controls']", active_tab ).show();
379 if ( $( "input:checkbox:checked", active_tab ).length > 0 ) {
380 $( "[id^='article-menu-']", active_tab ).css("display","inline-block");
382 $( "[id^='article-menu-']", active_tab ).hide();
385 // All rows have been removed
386 $("[class$='_table_controls']", active_tab ).hide();
390 function HandleMulti( fnHandler, id, a ) {
391 last_cancel_reason = undefined;
392 if( id !== 0 ) { fnHandler( id, a ); return; }
393 $( active_tab + " input[type='checkbox']:checked").each(function() {
394 fnHandler( $(this).attr('reqid'), $(this).closest('tr').find('td.ar-actions div a') );
398 function PrintSlip(id, a) {
399 var link = 'article-request-slip.pl?id='+id;
400 window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
403 function Cancel( id, a ) {
404 // last_cancel_reason: undefined means 'prompt for new reason'
405 // a null value indicates that prompt was cancelled
406 if( last_cancel_reason === undefined ) last_cancel_reason = prompt(_("Please specify the reason for cancelling selected item(s):"));
407 if ( last_cancel_reason === null ) {
411 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
414 url: '/cgi-bin/koha/svc/article_request',
418 notes: last_cancel_reason
420 success: function( data ) {
421 active_datatable.row( a.closest('tr') ).remove().draw();
423 activateBatchActions( active_tab );
429 function Process( id, a ) {
430 var table_row = a.closest('tr');
431 table_row.find('.ar-process-request').remove();
432 table_row.find('input[type="checkbox"]').prop('checked', false);
434 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" class="spinner"/>').find('div.dropdown').hide();
437 url: '/cgi-bin/koha/svc/article_request',
442 success: function( data ) {
443 $("img.spinner").remove();
444 pending_datatable.row( table_row ).remove().draw();
445 processing_datatable.row.add( table_row ).draw();
447 activateBatchActions( active_tab );
453 function Complete( id, a ) {
454 a.closest('td').prepend('<img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif"/>').find('div.dropdown').hide();
457 url: '/cgi-bin/koha/svc/article_request',
462 success: function( data ) {
463 active_datatable.row( a.closest('tr') ).remove().draw();
465 activateBatchActions( active_tab );
471 function UpdateTabCounts() {
472 $("#ar_pending_count").html( pending_datatable.rows().count() );
473 $("#ar_processing_count").html( processing_datatable.rows().count() );
478 [% INCLUDE 'intranet-bottom.inc' %]