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 [% WRAPPER 'header.inc' %]
63 [% INCLUDE 'circ-search.inc' %]
66 [% WRAPPER 'sub-header.inc' %]
67 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
70 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
73 [% IF blocking_error %]
75 <a href="#" aria-current="page">
81 [% INCLUDE 'biblio-title.inc' link = 1 %]
83 <a href="#" aria-current="page">
92 [% INCLUDE 'blocking_errors.inc' %]
93 <div class="main container-fluid">
95 <div class="col-sm-10 col-sm-push-2">
98 <h1>Request article from [% INCLUDE 'biblio-title.inc' link = 1 %]</h1>
99 [% IF error_message %]
100 <div class="dialog alert">
101 [% SWITCH error_message %]
102 [% CASE 'article_request_limit_reached' %]<p>Patron reached daily limit.</p>
103 [% CASE 'article_request_unhandled_exception' %]<p>An error has occurred. Check the logs.</p>
108 <fieldset class="brief">
109 <label>Search patrons</label>
110 [% PROCESS patron_search_filters_simple %]
111 [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
114 [% IF biblio.can_article_request( patron ) %]
115 [% IF article_request_fee > 0 %]
116 <div class="dialog alert">
117 Patron will be charged with <strong>[% article_request_fee | $Price %]</strong> for every request
120 <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
121 <input type="hidden" name="action" value="create" />
122 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
123 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id | html %]" />
125 <fieldset class="rows">
126 <legend>Place article request from [% biblio.title | html %] for [% patron.firstname | html %] [% patron.surname | html %] ( [% patron.cardnumber | html %] )</legend>
129 <label for="title">Title:</label>
130 <input type="text" name="title" id="title" size="50"/>
134 <label for="author">Author:</label>
135 <input type="text" name="author" id="author" size="50"/>
139 <label for="volume">Volume:</label>
140 <input type="text" name="volume" id="volume" size="50"/>
144 <label for="issue">Issue:</label>
145 <input type="text" name="issue" id="issue" size="50"/>
149 <label for="date">Date:</label>
150 <input type="text" name="date" id="date" size="50"/>
154 <label for="toc_request">Table of contents:</label>
155 <input type="checkbox" name="toc_request" value="1"/>
159 <label for="pages">Pages:</label>
160 <input type="text" name="pages" id="pages" size="50"/>
164 <label for="chapters">Chapters:</label>
165 <input type="text" name="chapters" id="chapters" size="50"/>
169 <label for="patron_notes">Patron notes:</label>
170 <input type="text" name="patron_notes" id="patron_notes" size="50"/>
174 <label for="format">Format:</label>
175 <select name="format" id="format">
176 <option value="PHOTOCOPY">Photocopy</option>
177 <option value="SCAN">Digital scan</option>
182 <label for="branchcode">Pickup library:</label>
183 <select name="branchcode" id="branchcode">
184 [% FOREACH b IN Branches.all %]
185 [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
186 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
188 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
196 [% SET article_request_type = biblio.article_request_type( patron ) %]
197 [% IF article_request_type != 'bib_only' %]
198 <table id="current-requests-table" class="ar-table table table-bordered table-striped">
199 <caption>Select item:</caption>
205 <th>Home library</th>
212 [% FOREACH item IN biblio.items %]
213 [% IF item.can_article_request( patron ) %]
216 [% IF article_request_type == 'item_only' && !checked %]
217 [% SET checked = 1 %]
218 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
220 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
224 [% ItemTypes.GetDescription( item.itype ) | html %]
227 [% item.barcode | html %]
230 [% Branches.GetName( item.homebranch ) | html %]
233 [% item.itemcallnumber | html %]
236 [% item.enumchron | html %]
242 [% IF article_request_type != 'item_only' %]
245 <input type="radio" name="itemnumber" value="" checked="checked"/>
257 <input type="submit" class="btn btn-default" value="Place request" />
261 No article requests can be made for this record.
266 [% SET biblio_current_article_requests = Context.Scalar( Context.Scalar( biblio, 'article_requests' ), 'filter_by_current' ) %]
267 [% IF biblio_current_article_requests.count > 0 && !patron %]
268 <fieldset class="rows left" id="current-article-requests-fieldset">
269 <legend>Current article requests</legend>
271 <table id="current-article-requests-table">
283 <th>Patron notes</th>
287 <th>Pickup library</th>
291 [% FOREACH ar IN biblio_current_article_requests %]
293 <td>[% ar.created_on | $KohaDates %]</td>
294 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ar.borrowernumber | uri %]">[% ar.borrower.firstname | html %] [% ar.borrower.surname | html %]</a></td>
295 <td>[% ar.title | html %]</td>
296 <td>[% ar.author | html %]</td>
297 <td>[% ar.volume | html %]</td>
298 <td>[% ar.issue | html %]</td>
299 <td>[% ar.date | html %]</td>
300 <td>[% IF ar.toc_request %]Yes[% END %]</td>
301 <td>[% ar.pages | html %]</td>
302 <td>[% ar.chapters | html %]</td>
303 <td>[% ar.patron_notes | html %]</td>
304 <td>[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
307 <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% ar.itemnumber | uri %]&biblionumber=[% ar.biblionumber | uri %]">[% ar.item.barcode | html %]</a>
311 [% IF ar.status == 'PENDING' %]
313 [% ELSIF ar.status == 'PROCESSING' %]
314 <span>Processing</span>
315 [% ELSIF ar.status == 'REQUESTED' %]
317 [% ELSIF ar.status == 'COMPLETED' %]
318 <span>Completed</span>
319 [% ELSIF ar.status == 'CANCELED' %]
320 <span>Canceled</span>
324 <i id="update-processing-[% ar.id | html %]" class="fa fa-cog fa-spin hidden"></i>
325 <select name="branchcode" id="branchcode-[% ar.id | html %]" class="ar-update-branchcode">
326 [% FOREACH b IN Branches.all %]
327 [% IF b.branchcode == ar.branchcode %]
328 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
330 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
336 <a title="Cancel article request" href="#" id="cancel-[% ar.id | html %]" class="ar-cancel-request">
337 <i id="cancel-processing-spinner-[% ar.id | html %]" class="fa fa-cog fa-spin hide"></i>
338 <i id="cancel-processing-[% ar.id | html %]" class="fa fa-times fa-lg" style="color:red"></i>
345 [% PROCESS cancel_modal %]
349 </div> <!-- /.col-sm-10.col-sm-push-2 -->
351 <div class="col-sm-2 col-sm-pull-10">
353 [% INCLUDE 'biblio-view-menu.inc' %]
355 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
356 </div> <!-- /.row -->
358 [% MACRO jsinclude BLOCK %]
359 [% INCLUDE 'datatables.inc' %]
362 $('#current-article-requests').ready(function() {
366 $(document).ready(function() {
368 $( ".ar-update-branchcode" ).on('focus', function(){
369 previous_branchcode = this.value;
370 }).on('change', function(){
371 var branchcode = this.value;
372 var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
375 var id = this.id.split("branchcode-")[1];
376 $("#update-processing-" + id ).css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 200);
380 url: '/cgi-bin/koha/svc/article_request',
382 action: 'update_branchcode',
384 branchcode: branchcode,
386 success: function( data ) {
387 $("#update-processing-" + id ).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);
393 this.value = previous_branchcode;
397 $('#modal-cancellation-reason').on('change', function(e) {
398 let reason = $(this).val();
399 $('#modal-notes').attr('disabled', !!reason);
403 $("#cancelModalConfirmBtn").on("click",function(e) {
404 var id = cancel_a.attr('id').split("cancel-")[1];
405 $("#cancel-processing-" + id ).hide('slow');
406 $("#cancel-processing-spinner-" + id ).show('slow');
408 let reason = $("#modal-cancellation-reason").val();
409 let notes = $("#modal-notes").val();
410 let query = '?'+(reason?'cancellation_reason='+reason:'notes='+notes)
414 url: '/api/v1/article_requests/'+id+query,
415 success: function( data ) {
416 cancel_a.parents('tr').hide('slow');
422 $(".ar-cancel-request").on("click", function(){
424 $('#cancelModal').modal();
427 // Initialize format(s)
428 var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]";
429 if( !supported_formats.match(/PHOTOCOPY/) )
430 $('#format option[value="PHOTOCOPY"]').remove();
431 if( !supported_formats.match(/SCAN/) )
432 $('#format option[value="SCAN"]').remove();
434 if( $('#format option').length > 1 ) {
435 // Select first listed format
436 var first_format = supported_formats.split('|')[0].replace(/^\s*|\s*$/g, '');
437 $('#format option[value="'+first_format+'"]').attr('selected', true);
442 [% 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 %]
446 [% INCLUDE 'intranet-bottom.inc' %]