Bug 38429: Add dropdown to Add guarantee button if multiple categories are allowed

To test:
1. Have multiple patron categories that are set to 'Can be guarantee'.
2. Go to a patron record and click '+ Add guarantee'
3. Look at how the patron category is set.
4. It defaults to the first one alphabetically, by code.
5. APPLY PATCH
6. Try steps 1 -2 again, this time you should get a dropdown to pick which category of guarantee you want.
7. Add some patron categories that can be gaurantees with library limitations. Make sure they only show for the correct libraries.
8. Set only patron category to be a gaurantee. The dropdown should now be a button.

Signed-off-by: Laura ONeil <laura@bywatersolutions.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 264887a87f)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Lucas Gass 2024-11-12 21:59:38 +00:00 committed by Paul Derscheid
parent 19a379a2e3
commit 48a3db2dad
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 14 additions and 3 deletions

View File

@ -9,13 +9,24 @@
[% IF CAN_user_borrowers_edit_borrowers %]
<a id="editpatron" class="btn btn-default" href="/cgi-bin/koha/members/memberentry.pl?op=edit_form&amp;destination=circ&amp;borrowernumber=[% patron.borrowernumber | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
[% END %]
[% SET guarantee_categories = Categories.limited( can_be_guarantee => 1 ).unblessed %]
[% IF CAN_user_borrowers_edit_borrowers %]
[% IF patron.is_adult AND Koha.Preference("borrowerRelationship") %]
<a id="addchild" class="btn btn-default" href="/cgi-bin/koha/members/memberentry.pl?op=add_form&amp;guarantor_id=[% patron.borrowernumber | html %]"><i class="fa fa-plus"></i> Add guarantee</a>
[% END %]
[% IF guarantee_categories.size > 1 %]
<div id="addchild" class="btn-group">
<button class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-plus"></i> Add guarantee</button>
<ul class="dropdown-menu">
[% FOREACH cat IN guarantee_categories %]
<li><a class="dropdown-item" href="/cgi-bin/koha/members/memberentry.pl?op=add_form&amp;guarantor_id=[% patron.borrowernumber | html %]&categorycode=[% cat.categorycode | html %]">[% cat.description | html%]</a></li>
[% END %]
</ul>
</div>
[% ELSE %]
<a id="addchild" class="btn btn-default" href="/cgi-bin/koha/members/memberentry.pl?op=add_form&amp;guarantor_id=[% patron.borrowernumber | html %]"><i class="fa fa-plus"></i> Add guarantee</a>
[% END %]
<a id="changepassword" class="btn btn-default" href="/cgi-bin/koha/members/member-password.pl?member=[% patron.borrowernumber | html %]"><i class="fa fa-lock"></i> Change password</a>
<a id="duplicate" class="btn btn-default" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% patron.borrowernumber | html %]"><i class="fa fa-copy"></i> Duplicate</a>
[% END %]
[% END %]
[% IF CAN_user_circulate_circulate_remaining_permissions %]