From fa35a4dbf5dae11cd90feed029d24e1bc98849a1 Mon Sep 17 00:00:00 2001 From: Thibaud Guillot Date: Thu, 16 Mar 2023 10:25:35 +0100 Subject: [PATCH] Bug 33276: Get auth values for location on serials Serial location is linked to a library, if we want to modify serial with users does not belongs to, location is not in select and we could erase it. Test plan: 1) Be sure to have a LOC authorized value limited to one library at least 2) See when editing serial subscription you didn't get the current location 3) Apply this patch 4) Refresh and now you've got the value Signed-off-by: Clemens Tubach --- serials/subscription-add.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index c08142b897..700c815a05 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -124,6 +124,19 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { my $locations_loop = GetAuthorisedValues("LOC"); my $ccodes_loop = GetAuthorisedValues("CCODE"); +my @loc_av; + +for my $loc (@$locations_loop) { + push @loc_av, $loc->{authorised_value}; +} + +if ( !grep { $_ eq $subs->{location} } @loc_av ) { + my $location_av = Koha::AuthorisedValues->search( + { authorised_value => $subs->{location} } )->next; + if ($location_av) { + push @$locations_loop, $location_av; + } +} $template->param( branchcode => $subs->{branchcode}, -- 2.30.2