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 [% WRAPPER breadcrumbs %]
68 [% IF blocking_error %]
69 [% WRAPPER breadcrumb_item bc_active= 1 %]
73 [% WRAPPER breadcrumb_item %]
74 <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
76 [% WRAPPER breadcrumb_item %]
77 [% INCLUDE 'biblio-title.inc' link = 1 %]
79 [% WRAPPER breadcrumb_item bc_active= 1 %]
80 <span>Request article</span>
83 [% END #/ WRAPPER breadcrumbs %]
84 [% END #/ WRAPPER sub-header.inc %]
86 [% INCLUDE 'blocking_errors.inc' %]
87 <div class="main container-fluid">
89 <div class="col-sm-10 col-sm-push-2">
92 <h1>Request article from [% INCLUDE 'biblio-title.inc' link = 1 %]</h1>
93 [% IF error_message %]
94 <div class="dialog alert">
95 [% SWITCH error_message %]
96 [% CASE 'article_request_limit_reached' %]<p>Patron reached daily limit.</p>
97 [% CASE 'article_request_unhandled_exception' %]<p>An error has occurred. Check the logs.</p>
102 <fieldset class="brief">
103 <label>Search patrons</label>
104 [% PROCESS patron_search_filters_simple %]
105 [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
108 [% IF biblio.can_article_request( patron ) %]
109 [% IF article_request_fee > 0 %]
110 <div class="dialog alert">
111 Patron will be charged with <strong>[% article_request_fee | $Price %]</strong> for every request
114 <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
115 <input type="hidden" name="action" value="create" />
116 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
117 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id | html %]" />
119 <fieldset class="rows">
120 <legend>Place article request from [% biblio.title | html %] for [% patron.firstname | html %] [% patron.surname | html %] ( [% patron.cardnumber | html %] )</legend>
123 <label for="title">Title:</label>
124 <input type="text" name="title" id="title" size="50"/>
128 <label for="author">Author:</label>
129 <input type="text" name="author" id="author" size="50"/>
133 <label for="volume">Volume:</label>
134 <input type="text" name="volume" id="volume" size="50"/>
138 <label for="issue">Issue:</label>
139 <input type="text" name="issue" id="issue" size="50"/>
143 <label for="date">Date:</label>
144 <input type="text" name="date" id="date" size="50"/>
148 <label for="toc_request">Table of contents:</label>
149 <input type="checkbox" name="toc_request" value="1"/>
153 <label for="pages">Pages:</label>
154 <input type="text" name="pages" id="pages" size="50"/>
158 <label for="chapters">Chapters:</label>
159 <input type="text" name="chapters" id="chapters" size="50"/>
163 <label for="patron_notes">Patron notes:</label>
164 <input type="text" name="patron_notes" id="patron_notes" size="50"/>
168 <label for="format">Format:</label>
169 <select name="format" id="format">
170 <option value="PHOTOCOPY">Photocopy</option>
171 <option value="SCAN">Digital scan</option>
176 <label for="branchcode">Pickup library:</label>
177 <select name="branchcode" id="branchcode">
178 [% FOREACH b IN Branches.all %]
179 [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
180 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
182 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
190 [% SET article_request_type = biblio.article_request_type( patron ) %]
191 [% IF article_request_type != 'bib_only' %]
192 <div class="page-section">
193 <table id="current-requests-table" class="ar-table table table-bordered table-striped">
194 <caption>Select item:</caption>
200 <th>Home library</th>
207 [% FOREACH item IN biblio.items %]
208 [% IF item.can_article_request( patron ) %]
211 [% IF article_request_type == 'item_only' && !checked %]
212 [% SET checked = 1 %]
213 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
215 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
219 [% ItemTypes.GetDescription( item.itype ) | html %]
222 [% item.barcode | html %]
225 [% Branches.GetName( item.homebranch ) | html %]
228 [% item.itemcallnumber | html %]
231 [% item.enumchron | html %]
237 [% IF article_request_type != 'item_only' %]
240 <input type="radio" name="itemnumber" value="" checked="checked"/>
249 </div><!-- /.page-section -->
253 <input type="submit" class="btn btn-default" value="Place request" />
257 No article requests can be made for this record.
262 [% SET biblio_current_article_requests = Context.Scalar( Context.Scalar( biblio, 'article_requests' ), 'filter_by_current' ) %]
263 [% IF biblio_current_article_requests.count > 0 && !patron %]
264 <fieldset class="rows left" id="current-article-requests-fieldset">
265 <legend>Current article requests</legend>
267 <table id="current-article-requests-table">
279 <th>Patron notes</th>
283 <th>Pickup library</th>
287 [% FOREACH ar IN biblio_current_article_requests %]
289 <td>[% ar.created_on | $KohaDates %]</td>
290 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ar.borrowernumber | uri %]">[% ar.borrower.firstname | html %] [% ar.borrower.surname | html %]</a></td>
291 <td>[% ar.title | html %]</td>
292 <td>[% ar.author | html %]</td>
293 <td>[% ar.volume | html %]</td>
294 <td>[% ar.issue | html %]</td>
295 <td>[% ar.date | html %]</td>
296 <td>[% IF ar.toc_request %]Yes[% END %]</td>
297 <td>[% ar.pages | html %]</td>
298 <td>[% ar.chapters | html %]</td>
299 <td>[% ar.patron_notes | html %]</td>
300 <td>[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
303 <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% ar.itemnumber | uri %]&biblionumber=[% ar.biblionumber | uri %]">[% ar.item.barcode | html %]</a>
307 [% IF ar.status == 'PENDING' %]
309 [% ELSIF ar.status == 'PROCESSING' %]
310 <span>Processing</span>
311 [% ELSIF ar.status == 'REQUESTED' %]
313 [% ELSIF ar.status == 'COMPLETED' %]
314 <span>Completed</span>
315 [% ELSIF ar.status == 'CANCELED' %]
316 <span>Canceled</span>
320 <i id="update-processing-[% ar.id | html %]" class="fa fa-cog fa-spin hidden"></i>
321 <select name="branchcode" id="branchcode-[% ar.id | html %]" class="ar-update-branchcode">
322 [% FOREACH b IN Branches.all %]
323 [% IF b.branchcode == ar.branchcode %]
324 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
326 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
332 <a title="Cancel article request" href="#" id="cancel-[% ar.id | html %]" class="ar-cancel-request">
333 <i id="cancel-processing-spinner-[% ar.id | html %]" class="fa fa-cog fa-spin hide"></i>
334 <i id="cancel-processing-[% ar.id | html %]" class="fa fa-times fa-lg" style="color:red"></i>
341 [% PROCESS cancel_modal %]
345 </div> <!-- /.col-sm-10.col-sm-push-2 -->
347 <div class="col-sm-2 col-sm-pull-10">
349 [% INCLUDE 'biblio-view-menu.inc' %]
351 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
352 </div> <!-- /.row -->
354 [% MACRO jsinclude BLOCK %]
355 [% INCLUDE 'datatables.inc' %]
358 $('#current-article-requests').ready(function() {
362 $(document).ready(function() {
364 $( ".ar-update-branchcode" ).on('focus', function(){
365 previous_branchcode = this.value;
366 }).on('change', function(){
367 var branchcode = this.value;
368 var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
371 var id = this.id.split("branchcode-")[1];
372 $("#update-processing-" + id ).css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 200);
376 url: '/cgi-bin/koha/svc/article_request',
378 action: 'update_branchcode',
380 branchcode: branchcode,
382 success: function( data ) {
383 $("#update-processing-" + id ).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);
389 this.value = previous_branchcode;
393 $('#modal-cancellation-reason').on('change', function(e) {
394 let reason = $(this).val();
395 $('#modal-notes').attr('disabled', !!reason);
399 $("#cancelModalConfirmBtn").on("click",function(e) {
400 var id = cancel_a.attr('id').split("cancel-")[1];
401 $("#cancel-processing-" + id ).hide('slow');
402 $("#cancel-processing-spinner-" + id ).show('slow');
404 let reason = $("#modal-cancellation-reason").val();
405 let notes = $("#modal-notes").val();
406 let query = '?'+(reason?'cancellation_reason='+reason:'notes='+notes)
410 url: '/api/v1/article_requests/'+id+query,
411 success: function( data ) {
412 cancel_a.parents('tr').hide('slow');
418 $(".ar-cancel-request").on("click", function(){
420 $('#cancelModal').modal();
423 // Initialize format(s)
424 var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]";
425 if( !supported_formats.match(/PHOTOCOPY/) )
426 $('#format option[value="PHOTOCOPY"]').remove();
427 if( !supported_formats.match(/SCAN/) )
428 $('#format option[value="SCAN"]').remove();
430 if( $('#format option').length > 1 ) {
431 // Select first listed format
432 var first_format = supported_formats.split('|')[0].replace(/^\s*|\s*$/g, '');
433 $('#format option[value="'+first_format+'"]').attr('selected', true);
438 [% 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 %]
442 [% INCLUDE 'intranet-bottom.inc' %]