Bugzilla – Attachment 23082 Details for
Bug 11287
Import borrowers doesn't take into account the new restriction system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11287 - Import borrowers doesn't take into account the new debarment system
Bug-11287---Import-borrowers-doesnt-take-into-acco.patch (text/plain), 3.62 KB, created by
Kyle M Hall (khall)
on 2013-11-22 14:17:59 UTC
(
hide
)
Description:
Bug 11287 - Import borrowers doesn't take into account the new debarment system
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-11-22 14:17:59 UTC
Size:
3.62 KB
patch
obsolete
>From 636ab2b7a5aaea1ae88b1b7355bbd5c190be8c5a Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 22 Nov 2013 09:15:31 -0500 >Subject: [PATCH] Bug 11287 - Import borrowers doesn't take into account the new debarment system > >The import patrons tool will add restrictions in the previous style ( >directly to the borrowers table ). This will actually work, but >will result in the restriction being un-removable, and will be >overwritten by any new restrictions. > >Test Plan: >1) Apply this patch >2) Import new patrons with debarrments, note the debarment is created > correctly >3) Import existing patrons with overwrite enabled, note that any new > debarrment is added, and any existing debarrment is ignored >--- > tools/import_borrowers.pl | 34 ++++++++++++++++++++++++++++++++++ > 1 files changed, 34 insertions(+), 0 deletions(-) > >diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl >index 5f65c97..68ec720 100755 >--- a/tools/import_borrowers.pl >+++ b/tools/import_borrowers.pl >@@ -46,6 +46,7 @@ use C4::Members; > use C4::Members::Attributes qw(:all); > use C4::Members::AttributeTypes; > use C4::Members::Messaging; >+use Koha::Borrower::Debarments; > > use Text::CSV; > # Text::CSV::Unicode, even in binary mode, fails to parse lines with these diacriticals: >@@ -258,6 +259,26 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { > $template->param('lastinvalid'=>$borrower{'surname'}.' / '.$borrowernumber); > next LINE; > } >+ if ( $borrower{debarred} ) { >+ # Check to see if this debarment already exists >+ my $debarrments = GetDebarments( >+ $borrowernumber, >+ { >+ expiration => $borrower{debarred}, >+ comment => $borrower{debarredcomment} >+ } >+ ); >+ # If it doesn't, then add it! >+ unless (@$debarrments) { >+ AddDebarment( >+ { >+ borrowernumber => $borrowernumber, >+ expiration => $borrower{debarred}, >+ comment => $borrower{debarredcomment} >+ } >+ ); >+ } >+ } > if ($extended) { > if ($ext_preserve) { > my $old_attributes = GetBorrowerAttributes($borrowernumber); >@@ -274,13 +295,26 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { > $borrower{'cardnumber'} = fixup_cardnumber(undef); > } > if ($borrowernumber = AddMember(%borrower)) { >+ >+ if ( $borrower{debarred} ) { >+ AddDebarment( >+ { >+ borrowernumber => $borrowernumber, >+ expiration => $borrower{debarred}, >+ comment => $borrower{debarredcomment} >+ } >+ ); >+ } >+ > if ($extended) { > SetBorrowerAttributes($borrowernumber, $patron_attributes); > } >+ > if ($set_messaging_prefs) { > C4::Members::Messaging::SetMessagingPreferencesFromDefaults({ borrowernumber => $borrowernumber, > categorycode => $borrower{categorycode} }); > } >+ > $imported++; > $template->param('lastimported'=>$borrower{'surname'}.' / '.$borrowernumber); > } else { >-- >1.7.2.5
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 11287
:
23082
|
23083
|
23757
|
23788