8 [% USE AuthorisedValues %]
10 [% SET footerjs = 1 %]
11 [% SET article_requests_view = 1 %]
12 [% SET biblionumber = biblio.biblionumber %]
13 [% INCLUDE 'doc-head-open.inc' %]
14 [% SET libraries = Branches.all %]
15 [% SET categories = Categories.all.unblessed %]
16 [% SET columns = ['name', 'address', 'cardnumber', 'dateofbirth', 'category', 'branch', 'phone'] %]
17 [% PROCESS "patron-search.inc" %]
18 <title>Request article › Circulation › Koha</title>
19 [% INCLUDE 'doc-head-close.inc' %]
22 [% BLOCK cancel_modal %]
23 <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
24 <div class="modal-dialog" role="document">
25 <div class="modal-content">
26 <div class="modal-header">
27 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
28 <h3>Confirm deletion</h3>
31 <div class="modal-body">
32 <p>Are you sure you want to cancel this article request?</p>
34 <fieldset class="action">
35 [% SET ar_cancellation = AuthorisedValues.GetAuthValueDropbox('AR_CANCELLATION') %]
36 [% IF ar_cancellation.count %]
37 <label for="cancellation-reason" class="col-sm-4">Cancellation reason: </label>
38 <select class="cancellation-reason col-sm-8" name="cancellation-reason" id="modal-cancellation-reason">
39 <option value="" selected>Other reasons</option>
40 [% FOREACH reason IN ar_cancellation %]
41 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
46 <fieldset class="action">
47 <div class="hint col-sm-offset-4">Enter reason</div>
48 <input type="text" class="notes col-sm-offset-4 col-sm-8" name="notes" id="modal-notes"/>
52 <div class="modal-footer">
53 <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger" data-dismiss="modal">Confirm cancellation</button>
54 <a href="#" data-dismiss="modal">Cancel</a>
61 <body id="circ_request-article" class="circ">
62 [% INCLUDE 'header.inc' %]
63 [% INCLUDE 'circ-search.inc' %]
65 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
68 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
71 [% IF blocking_error %]
73 <a href="#" aria-current="page">
79 [% INCLUDE 'biblio-title.inc' link = 1 %]
81 <a href="#" aria-current="page">
89 [% INCLUDE 'blocking_errors.inc' %]
90 <div class="main container-fluid">
92 <div class="col-sm-10 col-sm-push-2">
95 <h1>Request article from [% INCLUDE 'biblio-title.inc' link = 1 %]</h1>
96 [% IF error_message %]
97 <div class="dialog alert">
98 [% SWITCH error_message %]
99 [% CASE 'article_request_limit_reached' %]<p>Patron reached daily limit.</p>
100 [% CASE 'article_request_unhandled_exception' %]<p>An error has occurred. Check the logs.</p>
105 <fieldset class="brief">
106 <label>Search patrons</label>
107 [% PROCESS patron_search_filters_simple %]
108 [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
111 [% IF biblio.can_article_request( patron ) %]
112 [% IF article_request_fee > 0 %]
113 <div class="dialog alert">
114 Patron will be charged with <strong>[% article_request_fee | $Price %]</strong> for every request
117 <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
118 <input type="hidden" name="action" value="create" />
119 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
120 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id | html %]" />
122 <fieldset class="rows">
123 <legend>Place article request from [% biblio.title | html %] for [% patron.firstname | html %] [% patron.surname | html %] ( [% patron.cardnumber | html %] )</legend>
126 <label for="title">Title:</label>
127 <input type="text" name="title" id="title" size="50"/>
131 <label for="author">Author:</label>
132 <input type="text" name="author" id="author" size="50"/>
136 <label for="volume">Volume:</label>
137 <input type="text" name="volume" id="volume" size="50"/>
141 <label for="issue">Issue:</label>
142 <input type="text" name="issue" id="issue" size="50"/>
146 <label for="date">Date:</label>
147 <input type="text" name="date" id="date" size="50"/>
151 <label for="toc_request">Table of contents:</label>
152 <input type="checkbox" name="toc_request" value="1"/>
156 <label for="pages">Pages:</label>
157 <input type="text" name="pages" id="pages" size="50"/>
161 <label for="chapters">Chapters:</label>
162 <input type="text" name="chapters" id="chapters" size="50"/>
166 <label for="patron_notes">Patron notes:</label>
167 <input type="text" name="patron_notes" id="patron_notes" size="50"/>
171 <label for="format">Format:</label>
172 <select name="format" id="format">
173 <option value="PHOTOCOPY">Photocopy</option>
174 <option value="SCAN">Digital scan</option>
179 <label for="branchcode">Pickup library:</label>
180 <select name="branchcode" id="branchcode">
181 [% FOREACH b IN Branches.all %]
182 [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
183 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
185 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
193 [% SET article_request_type = biblio.article_request_type( patron ) %]
194 [% IF article_request_type != 'bib_only' %]
195 <table id="current-requests-table" class="ar-table table table-bordered table-striped">
196 <caption>Select item:</caption>
202 <th>Home library</th>
209 [% FOREACH item IN biblio.items %]
210 [% IF item.can_article_request( patron ) %]
213 [% IF article_request_type == 'item_only' && !checked %]
214 [% SET checked = 1 %]
215 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
217 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
221 [% ItemTypes.GetDescription( item.itype ) | html %]
224 [% item.barcode | html %]
227 [% Branches.GetName( item.homebranch ) | html %]
230 [% item.itemcallnumber | html %]
233 [% item.enumchron | html %]
239 [% IF article_request_type != 'item_only' %]
242 <input type="radio" name="itemnumber" value="" checked="checked"/>
254 <input type="submit" class="btn btn-default" value="Place request" />
258 No article requests can be made for this record.
263 [% SET biblio_current_article_requests = Context.Scalar( Context.Scalar( biblio, 'article_requests' ), 'filter_by_current' ) %]
264 [% IF biblio_current_article_requests.count > 0 && !patron %]
265 <fieldset class="rows left" id="current-article-requests-fieldset">
266 <legend>Current article requests</legend>
268 <table id="current-article-requests-table">
280 <th>Patron notes</th>
284 <th>Pickup library</th>
288 [% FOREACH ar IN biblio_current_article_requests %]
290 <td>[% ar.created_on | $KohaDates %]</td>
291 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ar.borrowernumber | uri %]">[% ar.borrower.firstname | html %] [% ar.borrower.surname | html %]</a></td>
292 <td>[% ar.title | html %]</td>
293 <td>[% ar.author | html %]</td>
294 <td>[% ar.volume | html %]</td>
295 <td>[% ar.issue | html %]</td>
296 <td>[% ar.date | html %]</td>
297 <td>[% IF ar.toc_request %]Yes[% END %]</td>
298 <td>[% ar.pages | html %]</td>
299 <td>[% ar.chapters | html %]</td>
300 <td>[% ar.patron_notes | html %]</td>
301 <td>[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
304 <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% ar.itemnumber | uri %]&biblionumber=[% ar.biblionumber | uri %]">[% ar.item.barcode | html %]</a>
308 [% IF ar.status == 'PENDING' %]
310 [% ELSIF ar.status == 'PROCESSING' %]
311 <span>Processing</span>
312 [% ELSIF ar.status == 'REQUESTED' %]
314 [% ELSIF ar.status == 'COMPLETED' %]
315 <span>Completed</span>
316 [% ELSIF ar.status == 'CANCELED' %]
317 <span>Canceled</span>
321 <i id="update-processing-[% ar.id | html %]" class="fa fa-cog fa-spin hidden"></i>
322 <select name="branchcode" id="branchcode-[% ar.id | html %]" class="ar-update-branchcode">
323 [% FOREACH b IN Branches.all %]
324 [% IF b.branchcode == ar.branchcode %]
325 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
327 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
333 <a title="Cancel article request" href="#" id="cancel-[% ar.id | html %]" class="ar-cancel-request">
334 <i id="cancel-processing-spinner-[% ar.id | html %]" class="fa fa-cog fa-spin hide"></i>
335 <i id="cancel-processing-[% ar.id | html %]" class="fa fa-times fa-lg" style="color:red"></i>
342 [% PROCESS cancel_modal %]
346 </div> <!-- /.col-sm-10.col-sm-push-2 -->
348 <div class="col-sm-2 col-sm-pull-10">
350 [% INCLUDE 'biblio-view-menu.inc' %]
352 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
353 </div> <!-- /.row -->
355 [% MACRO jsinclude BLOCK %]
356 [% INCLUDE 'datatables.inc' %]
359 $('#current-article-requests').ready(function() {
363 $(document).ready(function() {
365 $( ".ar-update-branchcode" ).on('focus', function(){
366 previous_branchcode = this.value;
367 }).on('change', function(){
368 var branchcode = this.value;
369 var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
372 var id = this.id.split("branchcode-")[1];
373 $("#update-processing-" + id ).css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 200);
377 url: '/cgi-bin/koha/svc/article_request',
379 action: 'update_branchcode',
381 branchcode: branchcode,
383 success: function( data ) {
384 $("#update-processing-" + id ).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);
390 this.value = previous_branchcode;
394 $('#modal-cancellation-reason').on('change', function(e) {
395 let reason = $(this).val();
396 $('#modal-notes').attr('disabled', !!reason);
400 $("#cancelModalConfirmBtn").on("click",function(e) {
401 var id = cancel_a.attr('id').split("cancel-")[1];
402 $("#cancel-processing-" + id ).hide('slow');
403 $("#cancel-processing-spinner-" + id ).show('slow');
405 let reason = $("#modal-cancellation-reason").val();
406 let notes = $("#modal-notes").val();
407 let query = '?'+(reason?'cancellation_reason='+reason:'notes='+notes)
411 url: '/api/v1/article_requests/'+id+query,
412 success: function( data ) {
413 cancel_a.parents('tr').hide('slow');
419 $(".ar-cancel-request").on("click", function(){
421 $('#cancelModal').modal();
424 // Initialize format(s)
425 var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]";
426 if( !supported_formats.match(/PHOTOCOPY/) )
427 $('#format option[value="PHOTOCOPY"]').remove();
428 if( !supported_formats.match(/SCAN/) )
429 $('#format option[value="SCAN"]').remove();
431 if( $('#format option').length > 1 ) {
432 // Select first listed format
433 var first_format = supported_formats.split('|')[0].replace(/^\s*|\s*$/g, '');
434 $('#format option[value="'+first_format+'"]').attr('selected', true);
439 [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/circ/request-article.pl?biblionumber=' _ biblio.biblionumber, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/circ/request-article.pl?biblionumber=' _ biblio.biblionumber %]
443 [% INCLUDE 'intranet-bottom.inc' %]