Bugzilla – Attachment 157180 Details for
Bug 35061
Add support to preserve patron category code when importing patrons with commandline script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35061: Preserve categorycode when importing patrons
Bug-35061-Preserve-categorycode-when-importing-pat.patch (text/plain), 3.38 KB, created by
Aleisha Amohia
on 2023-10-16 01:00:47 UTC
(
hide
)
Description:
Bug 35061: Preserve categorycode when importing patrons
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2023-10-16 01:00:47 UTC
Size:
3.38 KB
patch
obsolete
>From 12c901f525b111ae5bcd505ca45cbb605ac66b54 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 29 Sep 2021 13:08:02 +1300 >Subject: [PATCH] Bug 35061: Preserve categorycode when importing patrons > >This patch should preserve category codes when importing patrons using misc/import_patrons.pl > >Use case: > >/usr/share/koha/bin/import_patrons.pl --file patrons.csv --matchpoint userid --default branchcode=C --overwrite --preserve-categorycode --verbose --confirm > >To test, use a file with a column categorycode. Confirm that new patrons added from the spreadsheet by the file are added to the database with the correct category code. Confirm existing patrons that are overwritten receive the categorycode from the spreadsheet. > >Sponsored-by: Auckland University of Technology >--- > Koha/Patrons/Import.pm | 5 +++++ > misc/import_patrons.pl | 7 +++++++ > 2 files changed, 12 insertions(+) > >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index b1c751007e2..2a6438667db 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -75,6 +75,7 @@ sub import_patrons { > my $ext_preserve = $params->{preserve_extended_attributes}; > my $overwrite_cardnumber = $params->{overwrite_cardnumber}; > my $overwrite_passwords = $params->{overwrite_passwords}; >+ my $preserve_categorycode = $params->{preserve_categorycode}; > my $dry_run = $params->{dry_run}; > my $send_welcome = $params->{send_welcome}; > my $extended = C4::Context->preference('ExtendedPatronAttributes'); >@@ -285,6 +286,10 @@ sub import_patrons { > > $borrower{$col} = $member->{$col} if $col eq 'dateexpiry' && !$columns[ $csvkeycol{$col} ]; > >+ if ( $col eq 'categorycode' && $preserve_categorycode && $member->{$col} ) { >+ $borrower{$col} = $member->{$col}; >+ } >+ > unless ( exists( $csvkeycol{$col} ) || $defaults->{$col} ) { > $borrower{$col} = $member->{$col} if ( $member->{$col} ); > } >diff --git a/misc/import_patrons.pl b/misc/import_patrons.pl >index cba3addc690..62361479ab0 100755 >--- a/misc/import_patrons.pl >+++ b/misc/import_patrons.pl >@@ -33,6 +33,7 @@ my $overwrite_passwords; > my $welcome_new = 0; > my %defaults; > my $ext_preserve = 0; >+my $preserve_categorycode = 0; > my $confirm; > my $verbose = 0; > my $help; >@@ -54,6 +55,7 @@ GetOptions( > 'pf|preserve-field=s' => \@preserve_fields, > 'v|verbose+' => \$verbose, > 'h|help|?' => \$help, >+ 'pc|preserve-categorycode' => \$preserve_categorycode, > ) or pod2usage(2); > > pod2usage(1) if $help; >@@ -77,6 +79,7 @@ my $return = $Import->import_patrons( > update_dateexpiry => $update_dateexpiry, > update_dateexpiry_from_today => $update_dateexpiry_from_today, > send_welcome => $welcome_new, >+ preserve_categorycode => $preserve_categorycode, > dry_run => !$confirm, > } > ); >@@ -166,6 +169,10 @@ If a matching patron is found, extend the expiration date of their account using > > If a matching patron is found, extend the expiration date of their account using today's date as the base > >+=item B<-pc|--preserve-categorycode> >+ >+Retain patron categorycode for existing patrons being overwritten >+ > =item B<-v|--verbose> > > Be verbose >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35061
:
157180
|
171437