Bug 30303: (follow-up) Copy values from merge results instead of CGI

This patch makes it so the values copied come from the merge results
which fixes the case of copying empty values or - accurately.

To test:
1. Have a patron with some empty fields and some fields with '-'
2. Follow the original test plan and try to copy those fields
3. confirm empty fields and '-' now copy as expected

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Brendan Lawlor 2026-04-11 15:37:32 +00:00 committed by Lucas Gass
parent 143b01dfa4
commit 6a5b68552c
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 11 additions and 10 deletions

View File

@ -71,16 +71,6 @@ my @fields = qw(
userid
);
my %data;
for my $field (@fields) {
my $val = $cgi->param($field);
if ( defined $val ) {
$data{$field} = $val;
}
}
if ( $op eq 'show' ) {
my $patrons = Koha::Patrons->search( { borrowernumber => { -in => \@ids } } );
$template->param( patrons => $patrons );
@ -98,6 +88,17 @@ if ( $op eq 'show' ) {
results => $results
);
if ( $copy && $results ) {
my ($id) = keys %{ $results->{merged} };
my $merged = $results->{merged}{$id};
my $source = $merged->{patron};
my %data;
for my $field (@fields) {
if ( defined $cgi->param($field) ) {
my $val = $source->{$field};
$data{$field} = $val;
}
}
$keeper->set( \%data )->store();
}
} catch {