6 [% USE AuthorisedValues %]
8 [% SET article_requests_view = 1 %]
9 [% SET biblionumber = biblio.biblionumber %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Request article › Circulation › Koha</title>
12 [% INCLUDE 'doc-head-close.inc' %]
15 [% BLOCK cancel_modal %]
16 <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
17 <div class="modal-dialog" role="document">
18 <div class="modal-content">
19 <div class="modal-header">
20 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
21 <h3>Confirm deletion</h3>
24 <div class="modal-body">
25 <p>Are you sure you want to cancel this article request?</p>
27 <fieldset class="action">
28 [% SET ar_cancellation = AuthorisedValues.GetAuthValueDropbox('AR_CANCELLATION') %]
29 [% IF ar_cancellation %]
30 <label for="cancellation-reason" class="col-sm-4">Cancellation reason: </label>
31 <select class="cancellation-reason col-sm-8" name="cancellation-reason" id="modal-cancellation-reason">
32 <option value="" selected>Other reasons</option>
33 [% FOREACH reason IN ar_cancellation %]
34 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
39 <fieldset class="action">
40 <div class="hint col-sm-offset-4">Enter reason</div>
41 <input type="text" class="notes col-sm-offset-4 col-sm-8" name="notes" id="modal-notes"/>
45 <div class="modal-footer">
46 <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger" data-dismiss="modal">Confirm cancellation</button>
47 <a href="#" data-dismiss="modal">Cancel</a>
54 <body id="circ_request-article" class="circ">
55 [% INCLUDE 'header.inc' %]
56 [% INCLUDE 'circ-search.inc' %]
58 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
61 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
64 [% IF blocking_error %]
66 <a href="#" aria-current="page">
72 [% INCLUDE 'biblio-title.inc' link = 1 %]
74 <a href="#" aria-current="page">
82 [% INCLUDE 'blocking_errors.inc' %]
83 <div class="main container-fluid">
85 <div class="col-sm-10 col-sm-push-2">
88 <h1>Request article from [% INCLUDE 'biblio-title.inc' link = 1 %]</h1>
89 [% IF error_message %]
90 <div class="dialog alert">
91 [% SWITCH error_message %]
92 [% CASE 'article_request_limit_reached' %]<p>Patron reached daily limit.</p>
93 [% CASE 'article_request_unhandled_exception' %]<p>An error has occurred. Check the logs.</p>
97 [% IF no_patrons_found %]
98 <div class="dialog alert">
99 <h3>Patron not found</h3>
100 <p>No patron with this name, please, try another</p>
103 <form id="article_request_patron_results" method="post">
105 <table id="table_borrowers">
117 [% FOREACH patron IN patrons %]
119 <td><input type="radio" name="patron_id" value="[% patron.borrowernumber | html %]"/></td>
120 <td>[% patron.surname | html %], [% patron.firstname | html %]</td>
121 <td>[% patron.cardnumber | html %]</td>
122 <td>[% patron.categorycode | html %]</td>
123 <td>[% patron.branchcode | html %]</td>
124 <td>[% patron.address | html %]</td>
129 <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
130 <fieldset class="action"><input type="submit" value="Select" /></fieldset>
134 <form id="article_requests_patronsearch" action="request-article.pl" method="post">
135 <fieldset class="brief">
136 <label for="patron">Patron: </label>
137 <div class="hint">Enter patron card number or partial name:</div>
138 <input type="text" size="40" id="patron" class="focus" name="patron_cardnumber" />
139 <input type="submit" value="Search" />
140 <input type="hidden" name="biblionumber" value="[% biblio.id | html %]" />
144 [% IF biblio.can_article_request( patron ) %]
146 <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
147 <input type="hidden" name="action" value="create" />
148 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
149 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id | html %]" />
151 <fieldset class="rows">
152 <legend>Place article request from [% biblio.title | html %] for [% patron.firstname | html %] [% patron.surname | html %] ( [% patron.cardnumber | html %] )</legend>
155 <label for="title">Title:</label>
156 <input type="text" name="title" id="title" size="50"/>
160 <label for="author">Author:</label>
161 <input type="text" name="author" id="author" size="50"/>
165 <label for="volume">Volume:</label>
166 <input type="text" name="volume" id="volume" size="50"/>
170 <label for="issue">Issue:</label>
171 <input type="text" name="issue" id="issue" size="50"/>
175 <label for="date">Date:</label>
176 <input type="text" name="date" id="date" size="50"/>
180 <label for="pages">Pages:</label>
181 <input type="text" name="pages" id="pages" size="50"/>
185 <label for="chapters">Chapters:</label>
186 <input type="text" name="chapters" id="chapters" size="50"/>
190 <label for="patron_notes">Patron notes:</label>
191 <input type="text" name="patron_notes" id="patron_notes" size="50"/>
195 <label for="format">Format:</label>
196 <select name="format" id="format">
197 <option value="PHOTOCOPY">Photocopy</option>
198 <option value="SCAN">Digital scan</option>
203 <label for="branchcode">Pickup library:</label>
204 <select name="branchcode" id="branchcode">
205 [% FOREACH b IN Branches.all %]
206 [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
207 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
209 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
217 [% SET article_request_type = biblio.article_request_type( patron ) %]
218 [% IF article_request_type != 'bib_only' %]
219 <table id="current-requests-table" class="ar-table table table-bordered table-striped">
220 <caption>Select item:</caption>
226 <th>Home library</th>
233 [% FOREACH item IN biblio.items %]
234 [% IF item.can_article_request( patron ) %]
237 [% IF article_request_type == 'item_only' && !checked %]
238 [% SET checked = 1 %]
239 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
241 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
245 [% ItemTypes.GetDescription( item.itype ) | html %]
248 [% item.barcode | html %]
251 [% Branches.GetName( item.homebranch ) | html %]
254 [% item.itemcallnumber | html %]
257 [% item.enumchron | html %]
263 [% IF article_request_type != 'item_only' %]
266 <input type="radio" name="itemnumber" value="" checked="checked"/>
278 <input type="submit" class="btn btn-default" value="Place request" />
282 No article requests can be made for this record.
287 [% IF biblio.article_requests_current && !patron %]
288 <fieldset class="rows left" id="current-article-requests-fieldset">
289 <legend>Current article requests</legend>
291 <table id="current-article-requests-table">
302 <th>Patron notes</th>
306 <th>Pickup library</th>
310 [% FOREACH ar IN biblio.article_requests_current %]
312 <td>[% ar.created_on | $KohaDates %]</td>
313 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ar.borrowernumber | uri %]">[% ar.borrower.firstname | html %] [% ar.borrower.surname | html %]</a></td>
314 <td>[% ar.title | html %]</td>
315 <td>[% ar.author | html %]</td>
316 <td>[% ar.volume | html %]</td>
317 <td>[% ar.issue | html %]</td>
318 <td>[% ar.date | html %]</td>
319 <td>[% ar.pages | html %]</td>
320 <td>[% ar.chapters | html %]</td>
321 <td>[% ar.patron_notes | html %]</td>
322 <td>[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
325 <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% ar.itemnumber | uri %]&biblionumber=[% ar.biblionumber | uri %]">[% ar.item.barcode | html %]</a>
329 [% IF ar.status == 'PENDING' %]
331 [% ELSIF ar.status == 'PROCESSING' %]
333 [% ELSIF ar.status == 'REQUESTED' %]
335 [% ELSIF ar.status == 'COMPLETED' %]
337 [% ELSIF ar.status == 'CANCELED' %]
342 <i id="update-processing-[% ar.id | html %]" class="fa fa-cog fa-spin hidden"></i>
343 <select name="branchcode" id="branchcode-[% ar.id | html %]" class="ar-update-branchcode">
344 [% FOREACH b IN Branches.all %]
345 [% IF b.branchcode == ar.branchcode %]
346 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
348 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
354 <a title="Cancel article request" href="#" id="cancel-[% ar.id | html %]" class="ar-cancel-request">
355 <i id="cancel-processing-spinner-[% ar.id | html %]" class="fa fa-cog fa-spin hide"></i>
356 <i id="cancel-processing-[% ar.id | html %]" class="fa fa-times fa-lg" style="color:red"></i>
363 [% PROCESS cancel_modal %]
367 </div> <!-- /.col-sm-10.col-sm-push-2 -->
369 <div class="col-sm-2 col-sm-pull-10">
371 [% INCLUDE 'biblio-view-menu.inc' %]
373 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
374 </div> <!-- /.row -->
376 [% MACRO jsinclude BLOCK %]
377 [% INCLUDE 'datatables.inc' %]
380 $('#current-article-requests').ready(function() {
384 $(document).ready(function() {
385 if ( $( "#patron" ).size() ){
386 $( "#patron" ).autocomplete({
387 source: "/cgi-bin/koha/circ/ysearch.pl",
389 select: function( event, ui ) {
390 $( "#patron" ).val( ui.item.cardnumber );
391 $( "#holds_patronsearch" ).submit();
395 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
396 return $( "<li></li>" )
397 .data( "ui-autocomplete-item", item )
400 + ( item.surname ? item.surname.escapeHtml() : "" )
402 + ( item.firstname ? item.firstname.escapeHtml() : "" )
403 + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
406 + ( item.address ? item.address.escapeHtml() : "" )
408 + ( item.city ? item.city.escapeHtml() : "" )
410 + ( item.zipcode ? item.zipcode.escapeHtml() : "" )
412 + ( item.country ? item.country.escapeHtml() : "" )
419 $( ".ar-update-branchcode" ).on('focus', function(){
420 previous_branchcode = this.value;
421 }).on('change', function(){
422 var branchcode = this.value;
423 var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
426 var id = this.id.split("branchcode-")[1];
427 $("#update-processing-" + id ).css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 200);
431 url: '/cgi-bin/koha/svc/article_request',
433 action: 'update_branchcode',
435 branchcode: branchcode,
437 success: function( data ) {
438 $("#update-processing-" + id ).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);
444 this.value = previous_branchcode;
448 $('#modal-cancellation-reason').on('change', function(e) {
449 let reason = $(this).val();
450 $('#modal-notes').attr('disabled', !!reason);
454 $("#cancelModalConfirmBtn").on("click",function(e) {
455 var id = cancel_a.attr('id').split("cancel-")[1];
456 $("#cancel-processing-" + id ).hide('slow');
457 $("#cancel-processing-spinner-" + id ).show('slow');
459 let reason = $("#modal-cancellation-reason").val();
460 let notes = $("#modal-notes").val();
461 let query = '?'+(reason?'cancellation_reason='+reason:'notes='+notes)
465 url: '/api/v1/article_requests/'+id+query,
466 success: function( data ) {
467 cancel_a.parents('tr').hide('slow');
473 $(".ar-cancel-request").on("click", function(){
475 $('#cancelModal').modal();
478 // Initialize format(s)
479 var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]";
480 if( !supported_formats.match(/PHOTOCOPY/) )
481 $('#format option[value="PHOTOCOPY"]').remove();
482 if( !supported_formats.match(/SCAN/) )
483 $('#format option[value="SCAN"]').remove();
485 if( $('#format option').length > 1 ) {
486 // Select first listed format
487 var first_format = supported_formats.split('|')[0].replace(/^\s*|\s*$/g, '');
488 $('#format option[value="'+first_format+'"]').attr('selected', true);
494 [% INCLUDE 'intranet-bottom.inc' %]