Bug 33849: Do not reset new patrons home library when error occurs

While adding new patron, if patron is flagged as duplicate
or another error occurs and their home library differs from
library user is logged in, patrons home library resets as
logged in users library. This happens with all patrons
expect those with category type C. This patch removes checking
if patrons category type is C from code so that all category
types use previously chosen home library even if error occurs.

To test:
1. Add new patron and set their library to a different
library than the one you're logged in.
2. Cause an error (wrong age, duplicate etc) while saving.
3. Attempt to save.
=> Note that patrons home library is set as one you're
logged in.
4. Apply this patch.
5. Repeat steps 1 to 3.
=> Note that patrons home library hasn't changed.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d2f41df188)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 3c52b89167)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Emmi Takkinen 2024-04-04 09:04:47 +03:00 committed by Lucas Gass
parent bbf60c8891
commit 207e10b81a

View file

@ -671,7 +671,7 @@ if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
$userbranch = C4::Context->userenv->{'branch'};
}
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category->category_type eq 'C' ) )) {
if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || $op eq 'add' )) {
$userbranch = $data{'branchcode'};
}
$template->param( userbranch => $userbranch );