Bugzilla – Attachment 162461 Details for
Bug 30987
Adding relationship to PatronQuickAddFields causes it to be added 2x
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30987: Fix relationship fields for patron full and quick add forms
Bug-30987-Fix-relationship-fields-for-patron-full-.patch (text/plain), 11.13 KB, created by
Lucas Gass (lukeg)
on 2024-02-26 16:11:59 UTC
(
hide
)
Description:
Bug 30987: Fix relationship fields for patron full and quick add forms
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-02-26 16:11:59 UTC
Size:
11.13 KB
patch
obsolete
>From 45d2c358a5efeb1b9c3fd4ce2df7016d561c4810 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >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. >--- > .../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 09991d64b4..b645d6dc30 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 >@@ -324,7 +324,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 eda22f1f86..2679639888 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -507,9 +507,9 @@ legend:hover { > <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value="[% guarantor.borrowernumber | html %]"/> > </li> > >- [% IF possible_relationships %] >+ [% UNLESS norelationship %] > <li> >- [% UNLESS empty_relationship_allowed %] >+ [% IF mandatoryrelationship %] > <label for="guarantor_relationship" class="required">Relationship: </label> > <select class="new_guarantor_relationship" name="new_guarantor_relationship" required="required"> > [% ELSE %] >@@ -523,7 +523,7 @@ legend:hover { > [% END %] > [% END %] > </select> >- [% UNLESS empty_relationship_allowed %] >+ [% UNLESS mandatoryrelationship %] > <span class="required">Required</span> > [% END %] > </li> >@@ -551,9 +551,9 @@ legend:hover { > <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value=""/> > </li> > >- [% IF possible_relationships %] >+ [% UNLESS norelationship %] > <li> >- [% UNLESS empty_relationship_allowed %] >+ [% IF mandatoryrelationship %] > <label for="guarantor_relationship" class="required">Relationship: </label> > <select class="new_guarantor_relationship" name="new_guarantor_relationship" required="required"> > [% ELSE %] >@@ -567,7 +567,7 @@ legend:hover { > [% END %] > [% END %] > </select> >- [% UNLESS empty_relationship_allowed %] >+ [% IF mandatoryrelationship %] > <span class="required">Required</span> > [% END %] > </li> >@@ -664,21 +664,27 @@ legend:hover { > [% END # /UNLESS noaltcontactfirstname %] > > [% UNLESS norelationship %] >- [% IF possible_relationships %] >- <li> >+ <li> >+ [% IF mandatoryrelationship %] >+ <label for="relationship" class="required">Relationship: </label> >+ <select class="relationship" name="relationship" required="required"> >+ [% ELSE %] > <label for="relationship">Relationship: </label> > <select class="relationship" name="relationship"> >- <option value=""></option> >- [% FOREACH pr IN possible_relationships.split('\|') %] >- [% IF pr == borrower_data.relationship %] >- <option value="[% pr | html %]" selected="selected">[% pr | html %]</option> >- [% ELSE %] >- <option value="[% pr | html %]">[% pr | html %]</option> >- [% END %] >+ [% END %] >+ <option value=""></option> >+ [% FOREACH pr IN possible_relationships.split('\|') %] >+ [% IF pr == borrower_data.relationship %] >+ <option value="[% pr | html %]" selected="selected">[% pr | html %]</option> >+ [% ELSE %] >+ <option value="[% pr | html %]">[% pr | html %]</option> > [% END %] >- </select> >- </li> >- [% END #/IF possible_relationships %] >+ [% END %] >+ </select> >+ [% IF mandatoryrelationship %] >+ <span class="required">Required</span> >+ [% END %] >+ </li> > [% END # /UNLESS norelationship %] > </ol> > </fieldset> <!-- /#non_patron_guarantor --> >@@ -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 57e780cfec..b2618a7167 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.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30987
:
162461
|
162860
|
165005