Bug 40114: Can't select new library when editing a desk

This patch fixes selection of a library when editing a desk in
Administration. The form should provide all libraries as options, not
just the currently selected one.

To test, apply the patch and go to Administration -> Desks.

- If necessary, create a new desk.
- Edit the desk. The form should load with the correct library prefilled
  in the <select>, but should offer all libraries as a choices.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 20085be7fb)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Owen Leonard 2025-06-10 18:42:54 +00:00 committed by Paul Derscheid
parent 694ff22961
commit f94664313d
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 4 additions and 11 deletions

View File

@ -114,17 +114,10 @@
<label for="branchcode" class="required">Library: </label>
<select id="branchcode" name="branchcode" required="required">
<option value=""></option>
[% FOREACH branch IN branches %]
[% IF desk %]
[% IF (desk.branchcode == branch.branchcode) %]
<option value="[% branch.branchcode|html %]" selected="selected">[% branch.branchname|html %]</option>
[% END %]
[% ELSE %]
[% IF (Branches.GetLoggedInBranchcode == branch.branchcode) %]
<option value="[% branch.branchcode|html %]" selected="selected">[% branch.branchname|html %]</option>
[% END %]
<option value="[% branch.branchcode|html %]">[% branch.branchname|html %]</option>
[% END %]
[% IF desk %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => desk.branchcode ) %]
[% ELSE %]
[% PROCESS options_for_libraries libraries => Branches.all() %]
[% END %]
</select>
</li>