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