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:
parent
143b01dfa4
commit
6a5b68552c
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue