From 443fcbc5f807e6066b9a878a6bbb87e4140ca41e 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 --- .../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 75088bba463..4bbdcb4fea5 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 @@ -328,7 +328,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, whether it's from the guarantor's form or the guarantee's form, 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 56468946bc3..f684abe2d2c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -508,9 +508,9 @@ legend:hover { - [% IF possible_relationships %] + [% UNLESS norelationship %]
  • - [% UNLESS empty_relationship_allowed %] + [% IF mandatoryrelationship %] - [% UNLESS empty_relationship_allowed %] + [% UNLESS mandatoryrelationship %] Required [% END %]
  • @@ -552,9 +552,9 @@ legend:hover { - [% IF possible_relationships %] + [% UNLESS norelationship %]
  • - [% UNLESS empty_relationship_allowed %] + [% IF mandatoryrelationship %] - [% UNLESS empty_relationship_allowed %] + [% IF mandatoryrelationship %] Required [% END %]
  • @@ -665,21 +665,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 %] @@ -1943,9 +1949,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 702f2c68980..e28e8c14498 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -100,11 +100,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.44.0