7 [% USE AuthorisedValues %]
9 [% SET article_requests_view = 1 %]
10 [% SET biblionumber = biblio.biblionumber %]
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>Request article › Circulation › Koha</title>
13 [% INCLUDE 'doc-head-close.inc' %]
16 [% BLOCK cancel_modal %]
17 <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
18 <div class="modal-dialog" role="document">
19 <div class="modal-content">
20 <div class="modal-header">
21 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
22 <h3>Confirm deletion</h3>
25 <div class="modal-body">
26 <p>Are you sure you want to cancel this article request?</p>
28 <fieldset class="action">
29 [% SET ar_cancellation = AuthorisedValues.GetAuthValueDropbox('AR_CANCELLATION') %]
30 [% IF ar_cancellation %]
31 <label for="cancellation-reason" class="col-sm-4">Cancellation reason: </label>
32 <select class="cancellation-reason col-sm-8" name="cancellation-reason" id="modal-cancellation-reason">
33 <option value="" selected>Other reasons</option>
34 [% FOREACH reason IN ar_cancellation %]
35 <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
40 <fieldset class="action">
41 <div class="hint col-sm-offset-4">Enter reason</div>
42 <input type="text" class="notes col-sm-offset-4 col-sm-8" name="notes" id="modal-notes"/>
46 <div class="modal-footer">
47 <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger" data-dismiss="modal">Confirm cancellation</button>
48 <a href="#" data-dismiss="modal">Cancel</a>
55 <body id="circ_request-article" class="circ">
56 [% INCLUDE 'header.inc' %]
57 [% INCLUDE 'circ-search.inc' %]
59 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
62 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
65 [% IF blocking_error %]
67 <a href="#" aria-current="page">
73 [% INCLUDE 'biblio-title.inc' link = 1 %]
75 <a href="#" aria-current="page">
83 [% INCLUDE 'blocking_errors.inc' %]
84 <div class="main container-fluid">
86 <div class="col-sm-10 col-sm-push-2">
89 <h1>Request article from [% INCLUDE 'biblio-title.inc' link = 1 %]</h1>
90 [% IF error_message %]
91 <div class="dialog alert">
92 [% SWITCH error_message %]
93 [% CASE 'article_request_limit_reached' %]<p>Patron reached daily limit.</p>
94 [% CASE 'article_request_unhandled_exception' %]<p>An error has occurred. Check the logs.</p>
98 [% IF no_patrons_found %]
99 <div class="dialog alert">
100 <h3>Patron not found</h3>
101 <p>No patron with this name, please, try another</p>
104 <form id="article_request_patron_results" method="post">
106 <table id="table_borrowers">
118 [% FOREACH patron IN patrons %]
120 <td><input type="radio" name="patron_id" value="[% patron.borrowernumber | html %]"/></td>
121 <td>[% patron.surname | html %], [% patron.firstname | html %]</td>
122 <td>[% patron.cardnumber | html %]</td>
123 <td>[% patron.categorycode | html %]</td>
124 <td>[% patron.branchcode | html %]</td>
125 <td>[% patron.address | html %]</td>
130 <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
131 <fieldset class="action"><input type="submit" value="Select" /></fieldset>
135 <form id="article_requests_patronsearch" action="request-article.pl" method="post">
136 <fieldset class="brief">
137 <label for="patron">Patron: </label>
138 <div class="hint">Enter patron card number or partial name:</div>
139 <input type="text" size="40" id="patron" class="focus" name="patron_cardnumber" />
140 <input type="submit" value="Search" />
141 <input type="hidden" name="biblionumber" value="[% biblio.id | html %]" />
145 [% IF biblio.can_article_request( patron ) %]
147 <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
148 <input type="hidden" name="action" value="create" />
149 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
150 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.id | html %]" />
152 <fieldset class="rows">
153 <legend>Place article request from [% biblio.title | html %] for [% patron.firstname | html %] [% patron.surname | html %] ( [% patron.cardnumber | html %] )</legend>
156 <label for="title">Title:</label>
157 <input type="text" name="title" id="title" size="50"/>
161 <label for="author">Author:</label>
162 <input type="text" name="author" id="author" size="50"/>
166 <label for="volume">Volume:</label>
167 <input type="text" name="volume" id="volume" size="50"/>
171 <label for="issue">Issue:</label>
172 <input type="text" name="issue" id="issue" size="50"/>
176 <label for="date">Date:</label>
177 <input type="text" name="date" id="date" size="50"/>
181 <label for="toc_request">Table of contents:</label>
182 <input type="checkbox" name="toc_request" value="1"/>
186 <label for="pages">Pages:</label>
187 <input type="text" name="pages" id="pages" size="50"/>
191 <label for="chapters">Chapters:</label>
192 <input type="text" name="chapters" id="chapters" size="50"/>
196 <label for="patron_notes">Patron notes:</label>
197 <input type="text" name="patron_notes" id="patron_notes" size="50"/>
201 <label for="format">Format:</label>
202 <select name="format" id="format">
203 <option value="PHOTOCOPY">Photocopy</option>
204 <option value="SCAN">Digital scan</option>
209 <label for="branchcode">Pickup library:</label>
210 <select name="branchcode" id="branchcode">
211 [% FOREACH b IN Branches.all %]
212 [% IF b.branchcode == Branches.GetLoggedInBranchcode %]
213 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
215 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
223 [% SET article_request_type = biblio.article_request_type( patron ) %]
224 [% IF article_request_type != 'bib_only' %]
225 <table id="current-requests-table" class="ar-table table table-bordered table-striped">
226 <caption>Select item:</caption>
232 <th>Home library</th>
239 [% FOREACH item IN biblio.items %]
240 [% IF item.can_article_request( patron ) %]
243 [% IF article_request_type == 'item_only' && !checked %]
244 [% SET checked = 1 %]
245 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
247 <input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
251 [% ItemTypes.GetDescription( item.itype ) | html %]
254 [% item.barcode | html %]
257 [% Branches.GetName( item.homebranch ) | html %]
260 [% item.itemcallnumber | html %]
263 [% item.enumchron | html %]
269 [% IF article_request_type != 'item_only' %]
272 <input type="radio" name="itemnumber" value="" checked="checked"/>
284 <input type="submit" class="btn btn-default" value="Place request" />
288 No article requests can be made for this record.
293 [% SET biblio_current_article_requests = Context.Scalar( Context.Scalar( biblio, 'article_requests' ), 'filter_by_current' ) %]
294 [% IF biblio_current_article_requests.count > 0 && !patron %]
295 <fieldset class="rows left" id="current-article-requests-fieldset">
296 <legend>Current article requests</legend>
298 <table id="current-article-requests-table">
310 <th>Patron notes</th>
314 <th>Pickup library</th>
318 [% FOREACH ar IN biblio_current_article_requests %]
320 <td>[% ar.created_on | $KohaDates %]</td>
321 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% ar.borrowernumber | uri %]">[% ar.borrower.firstname | html %] [% ar.borrower.surname | html %]</a></td>
322 <td>[% ar.title | html %]</td>
323 <td>[% ar.author | html %]</td>
324 <td>[% ar.volume | html %]</td>
325 <td>[% ar.issue | html %]</td>
326 <td>[% ar.date | html %]</td>
327 <td>[% IF ar.toc_request %]Yes[% END %]</td>
328 <td>[% ar.pages | html %]</td>
329 <td>[% ar.chapters | html %]</td>
330 <td>[% ar.patron_notes | html %]</td>
331 <td>[% IF ar.format == 'PHOTOCOPY' %]Copy[% ELSIF ar.format == 'SCAN' %]Scan[% END %]</td>
334 <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% ar.itemnumber | uri %]&biblionumber=[% ar.biblionumber | uri %]">[% ar.item.barcode | html %]</a>
338 [% IF ar.status == 'PENDING' %]
340 [% ELSIF ar.status == 'PROCESSING' %]
342 [% ELSIF ar.status == 'REQUESTED' %]
344 [% ELSIF ar.status == 'COMPLETED' %]
346 [% ELSIF ar.status == 'CANCELED' %]
351 <i id="update-processing-[% ar.id | html %]" class="fa fa-cog fa-spin hidden"></i>
352 <select name="branchcode" id="branchcode-[% ar.id | html %]" class="ar-update-branchcode">
353 [% FOREACH b IN Branches.all %]
354 [% IF b.branchcode == ar.branchcode %]
355 <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
357 <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
363 <a title="Cancel article request" href="#" id="cancel-[% ar.id | html %]" class="ar-cancel-request">
364 <i id="cancel-processing-spinner-[% ar.id | html %]" class="fa fa-cog fa-spin hide"></i>
365 <i id="cancel-processing-[% ar.id | html %]" class="fa fa-times fa-lg" style="color:red"></i>
372 [% PROCESS cancel_modal %]
376 </div> <!-- /.col-sm-10.col-sm-push-2 -->
378 <div class="col-sm-2 col-sm-pull-10">
380 [% INCLUDE 'biblio-view-menu.inc' %]
382 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
383 </div> <!-- /.row -->
385 [% MACRO jsinclude BLOCK %]
386 [% INCLUDE 'datatables.inc' %]
389 $('#current-article-requests').ready(function() {
393 $(document).ready(function() {
394 if ( $( "#patron" ).size() ){
395 $( "#patron" ).autocomplete({
396 source: "/cgi-bin/koha/circ/ysearch.pl",
398 select: function( event, ui ) {
399 $( "#patron" ).val( ui.item.cardnumber );
400 $( "#holds_patronsearch" ).submit();
404 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
405 return $( "<li></li>" )
406 .data( "ui-autocomplete-item", item )
409 + ( item.surname ? item.surname.escapeHtml() : "" )
411 + ( item.firstname ? item.firstname.escapeHtml() : "" )
412 + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
415 + ( item.address ? item.address.escapeHtml() : "" )
417 + ( item.city ? item.city.escapeHtml() : "" )
419 + ( item.zipcode ? item.zipcode.escapeHtml() : "" )
421 + ( item.country ? item.country.escapeHtml() : "" )
428 $( ".ar-update-branchcode" ).on('focus', function(){
429 previous_branchcode = this.value;
430 }).on('change', function(){
431 var branchcode = this.value;
432 var c = confirm(_("Are you sure you want to change the pickup library from %s to %s for this request?").format( previous_branchcode, branchcode ));
435 var id = this.id.split("branchcode-")[1];
436 $("#update-processing-" + id ).css({opacity: 0, visibility: "visible"}).animate({opacity: 1.0}, 200);
440 url: '/cgi-bin/koha/svc/article_request',
442 action: 'update_branchcode',
444 branchcode: branchcode,
446 success: function( data ) {
447 $("#update-processing-" + id ).css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);
453 this.value = previous_branchcode;
457 $('#modal-cancellation-reason').on('change', function(e) {
458 let reason = $(this).val();
459 $('#modal-notes').attr('disabled', !!reason);
463 $("#cancelModalConfirmBtn").on("click",function(e) {
464 var id = cancel_a.attr('id').split("cancel-")[1];
465 $("#cancel-processing-" + id ).hide('slow');
466 $("#cancel-processing-spinner-" + id ).show('slow');
468 let reason = $("#modal-cancellation-reason").val();
469 let notes = $("#modal-notes").val();
470 let query = '?'+(reason?'cancellation_reason='+reason:'notes='+notes)
474 url: '/api/v1/article_requests/'+id+query,
475 success: function( data ) {
476 cancel_a.parents('tr').hide('slow');
482 $(".ar-cancel-request").on("click", function(){
484 $('#cancelModal').modal();
487 // Initialize format(s)
488 var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]";
489 if( !supported_formats.match(/PHOTOCOPY/) )
490 $('#format option[value="PHOTOCOPY"]').remove();
491 if( !supported_formats.match(/SCAN/) )
492 $('#format option[value="SCAN"]').remove();
494 if( $('#format option').length > 1 ) {
495 // Select first listed format
496 var first_format = supported_formats.split('|')[0].replace(/^\s*|\s*$/g, '');
497 $('#format option[value="'+first_format+'"]').attr('selected', true);
503 [% INCLUDE 'intranet-bottom.inc' %]