Lines 1-217
Link Here
|
1 |
[% USE Koha %] |
1 |
[% USE Koha %] |
|
|
2 |
[% USE raw %] |
2 |
[% SET koha_version = Koha.Version %] |
3 |
[% SET koha_version = Koha.Version %] |
3 |
[% cwd = whole.cwd %] |
4 |
[% PROCESS "ill/backends/Standard/shared/form_input_helpers.inc" %] |
4 |
[% PROCESS "${cwd}/shared-includes/form_input_helpers.inc" %] |
|
|
5 |
[% IF whole.error %] |
5 |
[% IF whole.error %] |
6 |
[% IF whole.status == 'missing_identifier' %] |
6 |
[% IF whole.status == 'missing_identifier' %] |
7 |
<p><em>Please note:</em> Mandatory field Identifier is missing.</p> |
7 |
<p><em>Please note:</em> Mandatory field Identifier is missing.</p> |
8 |
[% ELSIF whole.status == 'missing_branch' %] |
8 |
[% ELSIF whole.status == 'missing_branch' %] |
9 |
<p><em>Please note:</em> Library is a mandatory field.</p> |
9 |
<p><em>Please note:</em> Library is a mandatory field.</p> |
10 |
[% ELSIF whole.status == 'invalid_borrower' %] |
10 |
[% ELSIF whole.status == 'invalid_borrower' %] |
11 |
<p><em>Please note:</em> The patron details you entered are invalid.</p> |
11 |
<p><em>Please note:</em> The patron details you entered are invalid.</p> |
12 |
[% ELSIF whole.status == 'invalid_branch' %] |
12 |
[% ELSIF whole.status == 'invalid_branch' %] |
13 |
<p><em>Please note:</em> The library you chose is invalid.</p> |
13 |
<p><em>Please note:</em> The library you chose is invalid.</p> |
14 |
[% ELSE %] |
14 |
[% ELSE %] |
15 |
<p>Unhandled error</p> |
15 |
<p>Unhandled error</p> |
16 |
[% END %] |
16 |
[% END %] |
17 |
[% END %] |
17 |
[% END %] |
18 |
|
18 |
|
19 |
[% IF whole.stage == "form" %] |
19 |
[% IF whole.stage == "form" %] |
20 |
<h2>Create an ILL request</h2> |
20 |
<h2>Create an ILL request</h2> |
21 |
<form id="create_form" method="POST" action=""> |
21 |
<form id="create_form" method="POST" action=""> |
22 |
[% INCLUDE 'csrf-token.inc' %] |
22 |
[% INCLUDE 'csrf-token.inc' %] |
23 |
<fieldset class="rows"> |
23 |
<fieldset class="rows"> |
24 |
<legend>General details</legend> |
24 |
<legend>General details</legend> |
25 |
<ol id="general-standard-fields"> |
25 |
<ol id="general-standard-fields"> |
26 |
<li> |
26 |
<li> |
27 |
<label class="required" for="type">Type:</label> |
27 |
<label class="required" for="type">Type:</label> |
28 |
<select name="type" id="type"> |
28 |
<select name="type" id="type"> |
29 |
<option value=""/> |
29 |
<option value="" /> |
30 |
[% IF whole.value.other.type.lower == "book" %] |
30 |
[% IF whole.value.other.type.lower == "book" %] |
31 |
<option value="book" selected="selected">Book</option> |
31 |
<option value="book" selected="selected">Book</option> |
32 |
[% ELSE %] |
32 |
[% ELSE %] |
33 |
<option value="book">Book</option> |
33 |
<option value="book">Book</option> |
34 |
[% END %] |
34 |
[% END %] |
35 |
[% IF whole.value.other.type.lower == "chapter" %] |
35 |
[% IF whole.value.other.type.lower == "chapter" %] |
36 |
<option value="chapter" selected="selected">Chapter</option> |
36 |
<option value="chapter" selected="selected">Chapter</option> |
37 |
[% ELSE %] |
37 |
[% ELSE %] |
38 |
<option value="chapter">Chapter</option> |
38 |
<option value="chapter">Chapter</option> |
39 |
[% END %] |
39 |
[% END %] |
40 |
[% IF whole.value.other.type.lower == "journal" %] |
40 |
[% IF whole.value.other.type.lower == "journal" %] |
41 |
<option value="journal" selected="selected">Journal</option> |
41 |
<option value="journal" selected="selected">Journal</option> |
42 |
[% ELSE %] |
42 |
[% ELSE %] |
43 |
<option value="journal">Journal</option> |
43 |
<option value="journal">Journal</option> |
44 |
[% END %] |
44 |
[% END %] |
45 |
[% IF whole.value.other.type.lower == "article" %] |
45 |
[% IF whole.value.other.type.lower == "article" %] |
46 |
<option value="article" selected="selected">Journal article</option> |
46 |
<option value="article" selected="selected">Journal article</option> |
47 |
[% ELSE %] |
47 |
[% ELSE %] |
48 |
<option value="article">Journal article</option> |
48 |
<option value="article">Journal article</option> |
49 |
[% END %] |
49 |
[% END %] |
50 |
[% IF whole.value.other.type.lower == "thesis" %] |
50 |
[% IF whole.value.other.type.lower == "thesis" %] |
51 |
<option value="thesis" selected="selected">Thesis</option> |
51 |
<option value="thesis" selected="selected">Thesis</option> |
52 |
[% ELSE %] |
52 |
[% ELSE %] |
53 |
<option value="thesis">Thesis</option> |
53 |
<option value="thesis">Thesis</option> |
54 |
[% END %] |
54 |
[% END %] |
55 |
[% IF whole.value.other.type.lower == "conference" %] |
55 |
[% IF whole.value.other.type.lower == "conference" %] |
56 |
<option value="conference" selected="selected">Conference</option> |
56 |
<option value="conference" selected="selected">Conference</option> |
57 |
[% ELSE %] |
57 |
[% ELSE %] |
58 |
<option value="conference">Conference</option> |
58 |
<option value="conference">Conference</option> |
59 |
[% END %] |
59 |
[% END %] |
60 |
[% IF whole.value.other.type.lower == "dvd" %] |
60 |
[% IF whole.value.other.type.lower == "dvd" %] |
61 |
<option value="dvd" selected="selected">DVD</option> |
61 |
<option value="dvd" selected="selected">DVD</option> |
62 |
[% ELSE %] |
62 |
[% ELSE %] |
63 |
<option value="dvd">DVD</option> |
63 |
<option value="dvd">DVD</option> |
64 |
[% END %] |
64 |
[% END %] |
65 |
[% IF whole.value.other.type.lower == "other" %] |
65 |
[% IF whole.value.other.type.lower == "other" %] |
66 |
<option value="other" selected="selected">Other</option> |
66 |
<option value="other" selected="selected">Other</option> |
67 |
[% ELSE %] |
67 |
[% ELSE %] |
68 |
<option value="other">Other</option> |
68 |
<option value="other">Other</option> |
69 |
[% END %] |
69 |
[% END %] |
70 |
[% IF whole.value.other.type.lower == "resource" %] |
70 |
[% IF whole.value.other.type.lower == "resource" %] |
71 |
<option value="resource" selected="selected">Generic resource</option> |
71 |
<option value="resource" selected="selected">Generic resource</option> |
72 |
[% ELSE %] |
72 |
[% ELSE %] |
73 |
<option value="resource">Generic resource</option> |
73 |
<option value="resource">Generic resource</option> |
74 |
[% END %] |
74 |
[% END %] |
75 |
</select> |
75 |
</select> |
76 |
</li> |
76 |
</li> |
77 |
</ol> |
77 |
</ol> |
78 |
</fieldset> |
78 |
</fieldset> |
79 |
[% type = whole.value.other.type %] |
79 |
[% type = whole.value.other.type %] |
80 |
[% IF type %] |
80 |
[% IF type %] |
81 |
[% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] |
81 |
[% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %] |
82 |
[% END %] |
82 |
[% END %] |
83 |
[% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] |
83 |
[% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %] |
84 |
<fieldset class="rows"> |
84 |
<fieldset class="rows"> |
85 |
<legend>Patron options</legend> |
85 |
<legend>Patron options</legend> |
86 |
<ol> |
86 |
<ol> |
87 |
<li> |
87 |
<li> |
88 |
<label class="required" for="cardnumber"> |
88 |
<label class="required" for="cardnumber"> Card number, username or surname: </label> |
89 |
Card number, username or surname: |
89 |
<input type="text" name="cardnumber" id="cardnumber" autocomplete="off" type="text" value="[% whole.value.other.cardnumber | html %]" /> |
90 |
</label> |
90 |
<span class="required">Required</span> |
91 |
<input type="text" name="cardnumber" id="cardnumber" autocomplete="off" type="text" value="[% whole.value.other.cardnumber | html %]" /> |
91 |
</li> |
92 |
<span class="required">Required</span> |
92 |
<li> |
93 |
</li> |
93 |
<label class="required" for="branchcode">Destination library:</label> |
94 |
<li> |
94 |
<select id="branchcode" name="branchcode"> |
95 |
<label class="required" for="branchcode">Destination library:</label> |
95 |
<option value="" /> |
96 |
<select id="branchcode" name="branchcode"> |
96 |
[% FOREACH branch IN branches %] |
97 |
<option value="" /> |
97 |
[% IF branch.branchcode == whole.value.other.branchcode %] |
98 |
[% FOREACH branch IN branches %] |
98 |
<option value="[% branch.branchcode | html %]" selected="selected">[% branch.branchname | html %]</option> |
99 |
[% IF branch.branchcode == whole.value.other.branchcode %] |
99 |
[% ELSE %] |
100 |
<option value="[% branch.branchcode | html %]" selected="selected"> |
100 |
<option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option> |
101 |
[% ELSE %] |
101 |
[% END %] |
102 |
<option value="[% branch.branchcode | html %]"> |
102 |
[% END %] |
103 |
[% END %] |
103 |
</select> |
104 |
[% branch.branchname | html %] |
104 |
<span class="required">Required</span> |
105 |
</option> |
105 |
</li> |
106 |
[% END %] |
106 |
</ol> |
107 |
</select> |
107 |
</fieldset> |
108 |
<span class="required">Required</span> |
108 |
<fieldset class="action"> |
109 |
</li> |
109 |
<input id="ill-submit" class="btn btn-primary" type="submit" value="Create" disabled /> |
110 |
</ol> |
110 |
<a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a> |
111 |
</fieldset> |
111 |
</fieldset> |
112 |
<fieldset class="action"> |
112 |
<input type="hidden" name="method" value="create" /> |
113 |
<input id="ill-submit" class="btn btn-primary" type="submit" value="Create" disabled /> |
113 |
<input type="hidden" name="stage" value="form" /> |
114 |
<a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a> |
114 |
<input type="hidden" name="backend" value="Standard" /> |
115 |
</fieldset> |
115 |
</form> |
116 |
<input type="hidden" name="method" value="create" /> |
116 |
[% BLOCK backend_jsinclude %] |
117 |
<input type="hidden" name="stage" value="form" /> |
117 |
<script> |
118 |
<input type="hidden" name="backend" value="Standard" /> |
118 |
// <![CDATA[] |
119 |
</form> |
119 |
var core = [ [% whole.core | $raw %] ]; |
120 |
[% BLOCK backend_jsinclude %] |
120 |
[% INCLUDE "ill/backends/Standard/shared/shared.js" %] |
121 |
<script> |
121 |
// Require a username and branch selection |
122 |
// <![CDATA[] |
122 |
document.addEventListener('DOMContentLoaded', function(){ |
123 |
[% INCLUDE "${cwd}/shared-includes/shared.js" %] |
123 |
let cardnumber_input = '#create_form #cardnumber'; |
124 |
// Require a username and branch selection |
124 |
let branchcode_input = '#create_form #branchcode'; |
125 |
document.addEventListener('DOMContentLoaded', function(){ |
125 |
updateCreateButtonStatus(); |
126 |
let cardnumber_input = '#create_form #cardnumber'; |
126 |
$(cardnumber_input + ',' + branchcode_input).change(function() { |
127 |
let branchcode_input = '#create_form #branchcode'; |
127 |
updateCreateButtonStatus(); |
128 |
updateCreateButtonStatus(); |
128 |
}); |
129 |
$(cardnumber_input + ',' + branchcode_input).change(function() { |
129 |
function updateCreateButtonStatus(){ |
130 |
updateCreateButtonStatus(); |
130 |
var comp = [cardnumber_input,branchcode_input].filter(function(id) { |
131 |
}); |
131 |
return $(id).val().length > 0; |
132 |
function updateCreateButtonStatus(){ |
132 |
}); |
133 |
var comp = [cardnumber_input,branchcode_input].filter(function(id) { |
133 |
$('#ill-submit').attr('disabled', comp.length < 2); |
134 |
return $(id).val().length > 0; |
134 |
} |
135 |
}); |
135 |
/* Maintain patron autocomplete compatibility across versions */ |
136 |
$('#ill-submit').attr('disabled', comp.length < 2); |
136 |
[% IF koha_version.major <= 22 && koha_version.minor < 11 %] |
137 |
} |
137 |
$('#create_form #cardnumber').autocomplete({ |
138 |
/* Maintain patron autocomplete compatibility across versions */ |
138 |
source: "/cgi-bin/koha/circ/ysearch.pl", |
139 |
[% IF koha_version.major <= 22 && koha_version.minor < 11 %] |
139 |
minLength: 3, |
140 |
$('#create_form #cardnumber').autocomplete({ |
140 |
select: function( event, ui ) { |
141 |
source: "/cgi-bin/koha/circ/ysearch.pl", |
141 |
var field = ui.item.cardnumber; |
142 |
minLength: 3, |
142 |
$('#create_form #cardnumber').val(field) |
143 |
select: function( event, ui ) { |
143 |
return false; |
144 |
var field = ui.item.cardnumber; |
144 |
} |
145 |
$('#create_form #cardnumber').val(field) |
145 |
}) |
146 |
return false; |
146 |
.data( "ui-autocomplete" )._renderItem = function( ul, item ) { |
147 |
} |
147 |
return $( "<li></li>" ) |
148 |
}) |
148 |
.data( "ui-autocomplete-item", item ) |
149 |
.data( "ui-autocomplete" )._renderItem = function( ul, item ) { |
149 |
.append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) |
150 |
return $( "<li></li>" ) |
150 |
.appendTo( ul ); |
151 |
.data( "ui-autocomplete-item", item ) |
151 |
}; |
152 |
.append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) |
152 |
[% ELSE %] |
153 |
.appendTo( ul ); |
153 |
patron_autocomplete( |
154 |
}; |
154 |
$('#create_form #cardnumber'), |
155 |
[% ELSE %] |
155 |
{ |
156 |
patron_autocomplete( |
156 |
'on-select-callback': function( event, ui ) { |
157 |
$('#create_form #cardnumber'), |
157 |
$("#create_form #cardnumber").val( ui.item.cardnumber ); |
158 |
{ |
158 |
return false; |
159 |
'on-select-callback': function( event, ui ) { |
159 |
} |
160 |
$("#create_form #cardnumber").val( ui.item.cardnumber ); |
160 |
} |
161 |
return false; |
161 |
); |
162 |
} |
162 |
[% END %] |
163 |
} |
163 |
}); |
164 |
); |
164 |
// ]]> |
165 |
[% END %] |
165 |
</script> |
166 |
}); |
|
|
167 |
// ]]> |
168 |
</script> |
169 |
[% END %] |
170 |
|
171 |
[% ELSIF whole.stage == "borrowers" %] |
172 |
<!-- We need to clarify the borrower that has been requested. --> |
173 |
<h2>Borrower selection</h2> |
174 |
<form method="POST" action=""> |
175 |
[% FOREACH prop IN whole.value.other.keys %] |
176 |
[% IF prop != 'custom_key' && prop != 'custom_value' && prop != 'cardnumber' %] |
177 |
<input type="hidden" name="[% prop | html %]" value="[% whole.value.other.$prop | html %]"> |
178 |
[% END %] |
179 |
[% END %] |
180 |
[% keys = whole.value.other.custom_key.split('\0') %] |
181 |
[% values = whole.value.other.custom_value.split('\0') %] |
182 |
[% i = 0 %] |
183 |
[% FOREACH key IN keys %] |
184 |
<input type="hidden" name="custom_key" value="[% key | html %]"> |
185 |
<input type="hidden" name="custom_value" value="[% values.$i | html %]"> |
186 |
[% i = i + 1 %] |
187 |
[% END %] |
188 |
<fieldset class="rows"> |
189 |
<legend>Available borrowers for surname [% surname | html %]</legend> |
190 |
[% FOREACH opt IN whole.value %] |
191 |
[% IF opt.key == "brw" %] |
192 |
<ol> |
193 |
<li> |
194 |
<label class="required" for="brw">Borrower</label> |
195 |
<select name="cardnumber" id="cardnumber"> |
196 |
<option value=""></option> |
197 |
[% FOREACH brw IN opt.value %] |
198 |
<option value="[% brw.cardnumber | html %]"> |
199 |
[% brw.firstname | html %] [% brw.surname | html %] ([% brw.cardnumber | html %]) |
200 |
</option> |
201 |
[% END %] |
202 |
</select> |
203 |
</li> |
204 |
</ol> |
205 |
[% END %] |
166 |
[% END %] |
206 |
[% END %] |
167 |
[% ELSIF whole.stage == "borrowers" %] |
207 |
</fieldset> |
168 |
<!-- We need to clarify the borrower that has been requested. --> |
208 |
<fieldset class="action"> |
169 |
<h2>Borrower selection</h2> |
209 |
<input type="submit" value="Select"/> |
170 |
<form method="POST" action=""> |
210 |
<a class="cancel" href=[% parent | url %]>Cancel</a> |
171 |
[% FOREACH prop IN whole.value.other.keys %] |
211 |
</fieldset> |
172 |
[% IF prop != 'custom_key' && prop != 'custom_value' && prop != 'cardnumber' %] |
212 |
</form> |
173 |
<input type="hidden" name="[% prop | html %]" value="[% whole.value.other.$prop | html %]" /> |
213 |
|
174 |
[% END %] |
|
|
175 |
[% END %] |
176 |
[% keys = whole.value.other.custom_key.split('\0') %] |
177 |
[% values = whole.value.other.custom_value.split('\0') %] |
178 |
[% i = 0 %] |
179 |
[% FOREACH key IN keys %] |
180 |
<input type="hidden" name="custom_key" value="[% key | html %]" /> |
181 |
<input type="hidden" name="custom_value" value="[% values.$i | html %]" /> |
182 |
[% i = i + 1 %] |
183 |
[% END %] |
184 |
<fieldset class="rows"> |
185 |
<legend>Available borrowers for surname [% surname | html %]</legend> |
186 |
[% FOREACH opt IN whole.value %] |
187 |
[% IF opt.key == "brw" %] |
188 |
<ol> |
189 |
<li> |
190 |
<label class="required" for="brw">Borrower</label> |
191 |
<select name="cardnumber" id="cardnumber"> |
192 |
<option value=""></option> |
193 |
[% FOREACH brw IN opt.value %] |
194 |
<option value="[% brw.cardnumber | html %]"> [% brw.firstname | html %] [% brw.surname | html %] ([% brw.cardnumber | html %]) </option> |
195 |
[% END %] |
196 |
</select> |
197 |
</li> |
198 |
</ol> |
199 |
[% END %] |
200 |
[% END %] |
201 |
</fieldset> |
202 |
<fieldset class="action"> |
203 |
<input type="submit" value="Select" /> |
204 |
<a class="cancel" href="[% parent | url %]">Cancel</a> |
205 |
</fieldset> |
206 |
</form> |
214 |
[% ELSE %] |
207 |
[% ELSE %] |
215 |
<p>Unknown stage. This should not have happened. |
208 |
<p>Unknown stage. This should not have happened. </p> |
216 |
|
209 |
[% END %] |
217 |
[% END %] |
|
|