Bugzilla – Attachment 171437 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.46 KB, created by
Aleisha Amohia
on 2024-09-13 03:11:39 UTC
(
hide
)
Description:
Bug 35061: Preserve categorycode when importing patrons
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2024-09-13 03:11:39 UTC
Size:
3.46 KB
patch
obsolete
>From d55f183b9ff4cf1355fd13b967c023a8c6040e1b 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 5c8dc6b8763..8d65c7b3631 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -80,6 +80,7 @@ sub import_patrons { > my $update_dateexpiry = $params->{update_dateexpiry}; > my $update_dateexpiry_from_today = $params->{update_dateexpiry_from_today}; > my $update_dateexpiry_from_existing = $params->{update_dateexpiry_from_existing}; >+ my $preserve_categorycode = $params->{preserve_categorycode}; > > my $extended = C4::Context->preference('ExtendedPatronAttributes'); > my $set_messaging_prefs = C4::Context->preference('EnhancedMessagingPreferences'); >@@ -294,6 +295,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 5d702d8f6fe..15534796fe0 100755 >--- a/misc/import_patrons.pl >+++ b/misc/import_patrons.pl >@@ -34,6 +34,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; >@@ -59,6 +60,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; >@@ -89,6 +91,7 @@ my $return = $Import->import_patrons( > update_dateexpiry_from_existing => $update_dateexpiry_from_existing, > send_welcome => $welcome_new, > dry_run => !$confirm, >+ preserve_categorycode => $preserve_categorycode, > } > ); > >@@ -200,6 +203,10 @@ Cannot by used in conjunction with --expiration-from-existing > If a matching patron is found, extend the expiration date of their account using the patron's current expiration date as the base > Cannot by used in conjunction with --expiration-from-today > >+=item B<-pc|--preserve-categorycode> >+ >+Retain patron categorycode for existing patrons being overwritten >+ > =item B<-v|--verbose> > > Be verbose >-- >2.39.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