|
Lines 257-300
Link Here
|
| 257 |
[% BLOCK jsinclude %] |
257 |
[% BLOCK jsinclude %] |
| 258 |
<script> |
258 |
<script> |
| 259 |
$(document).ready( function() { |
259 |
$(document).ready( function() { |
| 260 |
allow_submit = false; |
260 |
allow_submit = false; |
| 261 |
$('#place-article-request').on('submit', function( event ){ |
261 |
$('#place-article-request').on('submit', function( event ){ |
| 262 |
if ( ! allow_submit ) { |
262 |
if ( ! allow_submit ) { |
| 263 |
event.preventDefault(); |
263 |
event.preventDefault(); |
| 264 |
|
264 |
|
| 265 |
[% IF article_request_type == 'item_only' %] |
265 |
[% IF article_request_type == 'item_only' %] |
| 266 |
if ( ! $("input:radio[name='itemnumber']").is(":checked") ) { |
266 |
if ( ! $("input:radio[name='itemnumber']").is(":checked") ) { |
| 267 |
alert( _("Please select a specific item for this article request.") ); |
267 |
alert( _("Please select a specific item for this article request.") ); |
| 268 |
return 0; |
268 |
return 0; |
| 269 |
} |
269 |
} |
| 270 |
[% END %] |
270 |
[% END %] |
| 271 |
|
271 |
|
| 272 |
var mandatory_fields = "[% mandatory_fields | html %]"; |
272 |
var mandatory_fields = "[% mandatory_fields | html %]"; |
| 273 |
var m = new Array(); |
273 |
var m = new Array(); |
| 274 |
if ( mandatory_fields ) m = mandatory_fields.split(","); |
274 |
if ( mandatory_fields ) m = mandatory_fields.split(","); |
| 275 |
var f = new Array(); |
275 |
var f = new Array(); |
| 276 |
|
276 |
|
| 277 |
for (i = 0; i < m.length; i++) { |
277 |
for (i = 0; i < m.length; i++) { |
| 278 |
if ( ! $("#" + m[i]).val() ) { |
278 |
if ( ! $("#" + m[i]).val() ) { |
| 279 |
f.push( m[i] ); |
279 |
f.push( m[i] ); |
| 280 |
} |
|
|
| 281 |
} |
| 282 |
|
| 283 |
if ( f.length ) { |
| 284 |
alert( _("The following fields are required and not filled in: ") + f.join(", ") ); |
| 285 |
return 0; |
| 286 |
} |
| 287 |
|
| 288 |
// Check if all fields are blank |
| 289 |
if( m.length == 0 && $('#title').val()=='' && $('#author').val()=='' && $('#volume').val()=='' && $('#issue').val()=='' && $('#date').val()=='' && $('#pages').val()=='' && $('#chapters').val()=='' && $('#patron_notes').val()=='' && !$('input[name="toc_request"]').prop('checked') ) { |
| 290 |
alert( _("Please fill in at least one field.") ); |
| 291 |
return 0; |
| 292 |
} |
| 293 |
|
| 294 |
allow_submit = true; |
| 295 |
$('#place-article-request').submit(); |
| 296 |
} |
280 |
} |
| 297 |
}); |
281 |
} |
| 298 |
|
282 |
|
| 299 |
// Initialize format(s) |
283 |
// Initialize format(s) |
| 300 |
var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]"; |
284 |
var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]"; |
| 301 |
- |
|
|