Bug 3534 (QA Followup) Fix indentation, show guarantor form, ignore bad data in pref

Switch incorrect == to != when checking skipped fields

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2016-06-08 13:39:02 -04:00 committed by Kyle M Hall
parent 486758d136
commit a8ebff202d
2 changed files with 22 additions and 11 deletions

View file

@ -103,7 +103,7 @@ Patrons:
- pref: PatronQuickAddFields - pref: PatronQuickAddFields
class: multi class: multi
- (separate columns with |) - (separate columns with |)
- "add these fields to the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here" - "add these fields to the patron quick add form when entering a new patron. Displays only mandatory fields and fields specified here. If applicable the guarantor form will be shown as well, individual fields in that form will be ignored."
- -
- "Use the SMS::Send::" - "Use the SMS::Send::"
- pref: SMSSendDriver - pref: SMSSendDriver

View file

@ -51,10 +51,12 @@ $(document).ready(function() {
$(toggle_from).each(function() { $(toggle_from).each(function() {
var input_label = $(this).attr('for'); var input_label = $(this).attr('for');
if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) { if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) {
$(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') ); $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
return; return;
}
if( $(this).next().val() != '' ) {
$(toggle_to+"[for='"+input_label+"']").next().val( $(this).next().val() );
} }
if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val( $(this).next().val() );}
}); });
$(".toggler").toggle(); $(".toggler").toggle();
@ -1108,16 +1110,25 @@ $(document).ready(function() {
$(document).ready(function () { $(document).ready(function () {
$("#entryform").hide(); $("#entryform").hide();
[% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %] [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]"; var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field %]",[% END %]];
var skipped_fields = ["contactname","contactfirstname","relationship"]; //Guarantor form is pulled as a whole, ignore individual fields
$("#entryform label").each(function () { $("#entryform label").each(function () {
var input_label = $(this).attr('for'); var input_label = $(this).attr('for');
if ( input_label == 'sex-female' ) { input_label='sex'; } if ( input_label == 'sex-female' ) {
else if ( input_label == 'btitle' ) { input_label='title'; } input_label='sex';
if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){ }
$(this).parent().clone().appendTo("#quick_add_list"); else if ( input_label == 'btitle' ) {
if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); input_label='title';
}
if ( skipped_fields.indexOf( input_label ) != -1 ) { input_label=""; }
if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
$(this).parent().clone().appendTo("#quick_add_list");
if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
}
});
if( $("#memberentry_guarantor").length ) {
$("#memberentry_guarantor").clone().appendTo("#quick_add_list").css("margin",0);
} }
});
$("#quick_add_form").show(); $("#quick_add_form").show();
}); });
</script> </script>