Bug 30303: Copy values to keeper record when merging patrons

Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Brendan Lawlor 2025-09-12 12:20:59 +00:00 committed by Lucas Gass
parent a906f38203
commit 143b01dfa4
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 44 additions and 0 deletions

View File

@ -40,6 +40,47 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
my $op = $cgi->param('op') || 'show';
my @ids = $cgi->multi_param('id');
my $copy = $cgi->param('copy');
my @fields = qw(
surname
firstname
preferred_name
initials
othernames
branchcode
cardnumber
categorycode
address
address2
city
state
zipcode
country
dateenrolled
date_renewed
dateexpiry
dateofbirth
debarred
email
emailpro
phone
phonepro
mobile
sex
updated_on
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 );
@ -56,6 +97,9 @@ if ( $op eq 'show' ) {
keeper => $keeper,
results => $results
);
if ( $copy && $results ) {
$keeper->set( \%data )->store();
}
} catch {
$template->param( error => $_ );
}