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>
(cherry picked from commit f94664313d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Owen Leonard 2025-06-10 18:42:54 +00:00 committed by Fridolin Somers
parent f65ff6a385
commit ac122de235
No known key found for this signature in database
GPG Key ID: 9A8E73E2A8B96537
1 changed files with 2 additions and 9 deletions

View File

@ -117,17 +117,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%]
[% PROCESS options_for_libraries libraries => Branches.all( selected => desk.branchcode ) %]
[% 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 %]
[% PROCESS options_for_libraries libraries => Branches.all() %]
[% END %]
</select>
</li>