From 87efbaa43e57c00597ae52a569df4a96e4410a93 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 26 Feb 2024 15:59:29 +0000 Subject: [PATCH] Bug 30987: Fix relationship fields for patron full and quick add forms To test: 1. APPLY PATACH and restart services. 2. Find the borrowerRelationship system preference. The description should no longer include the words "Leave empty to deactivate." 3. Populate the system preference with at least 1 choice. 4. Find a patron category with can_be_guarantee set to 'Yes'. 5. Quick add a patron of that type, making sure the relationship field shows in the Patron guarantor section. ( You have to +Add gaurantor before this field will show ) 6. The values in the dropdown should refelct the borrowerRelationship values. 7. With BorrowerMandatoryField make relationship mandatory. 8. Try step 5 again, this time the Relationship field should be mandatory. 9. Remove the field from BorrowerMandatoryField and add it to BorrowerUnwantedField. 10. Do step 5 again, the relationship field should not show on the quick add form. Signed-off-by: Myka Kennedy Stephens Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit fccbd327d9f93925917e7a4f478ab72c1d1f2363) Signed-off-by: Fridolin Somers (cherry picked from commit 7083a9dfbeff7a69a681e275a83c97239654b764) Signed-off-by: Lucas Gass --- .../en/modules/admin/preferences/patrons.pref | 2 +- .../prog/en/modules/members/memberentrygen.tt | 50 +++++++++++-------- members/memberentry.pl | 5 -- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 0185f7be81..196316bd06 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -312,7 +312,7 @@ Patrons: - "Guarantors can be the following of those they guarantee:" - pref: borrowerRelationship class: multi - - (input multiple choices separated by |). Leave empty to deactivate. + - (input multiple choices separated by |). - - "When adding a guarantee to a guarantor patron fill the following fields in the guarantee's member entry form from the guarantors record:" - pref: PrefillGuaranteeField diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index a274f4a265..792f9202e9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -496,9 +496,9 @@ legend:hover { - [% IF possible_relationships %] + [% UNLESS norelationship %]
  • - [% UNLESS empty_relationship_allowed %] + [% IF mandatoryrelationship %] - [% UNLESS empty_relationship_allowed %] + [% UNLESS mandatoryrelationship %] Required [% END %]
  • @@ -540,9 +540,9 @@ legend:hover { - [% IF possible_relationships %] + [% UNLESS norelationship %]
  • - [% UNLESS empty_relationship_allowed %] + [% IF mandatoryrelationship %] - [% UNLESS empty_relationship_allowed %] + [% IF mandatoryrelationship %] Required [% END %]
  • @@ -653,21 +653,27 @@ legend:hover { [% END # /UNLESS noaltcontactfirstname %] [% UNLESS norelationship %] - [% IF possible_relationships %] -
  • +
  • + [% IF mandatoryrelationship %] + + - - [% FOREACH pr IN possible_relationships.split('\|') %] - [% IF pr == borrower_data.relationship %] - - [% ELSE %] - - [% END %] + [% END %] + + [% FOREACH pr IN possible_relationships.split('\|') %] + [% IF pr == borrower_data.relationship %] + + [% ELSE %] + [% END %] - -
  • - [% END #/IF possible_relationships %] + [% END %] + + [% IF mandatoryrelationship %] + Required + [% END %] + [% END # /UNLESS norelationship %] @@ -1909,9 +1915,11 @@ legend:hover { new_field.appendTo("#quick_add_list"); } else { let orig_input_id = orig_li.children("input,textarea,select").attr("id"); - let new_field = orig_li.clone(); - new_field.children("#"+orig_input_id).attr("id",orig_input_id + "_quick_add"); - new_field.appendTo("#quick_add_list"); + if ( orig_input_id ) { + let new_field = orig_li.clone(); + new_field.children("#"+orig_input_id).attr("id",orig_input_id + "_quick_add"); + new_field.appendTo("#quick_add_list"); + } [% UNLESS mandatorypassword %] if( input_label == 'password' ){ let orig_p2 = $("#entryform label[for='password2']").parent(); diff --git a/members/memberentry.pl b/members/memberentry.pl index 57a28eeb3a..7e96130b7d 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -101,11 +101,6 @@ my @messages; ## Deal with guarantor stuff $template->param( relationships => $patron->guarantor_relationships ) if $patron; -my @relations = split /\|/, C4::Context->preference('borrowerRelationship'), -1; -@relations = ('') unless @relations; -my $empty_relationship_allowed = grep {$_ eq ""} @relations; -$template->param( empty_relationship_allowed => $empty_relationship_allowed ); - my $guarantor_id = $input->param('guarantor_id'); my $guarantor = undef; $guarantor = Koha::Patrons->find( $guarantor_id ) if $guarantor_id; -- 2.39.5