Bugzilla – Attachment 48307 Details for
Bug 15840
Import borrowers tool explodes if userid already exists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 15840: Catch errors if userid already exists when importing patrons
SIGNED-OFF-Bug-15840-Catch-errors-if-userid-alread.patch (text/plain), 2.51 KB, created by
Mark Tompsett
on 2016-02-23 00:31:55 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 15840: Catch errors if userid already exists when importing patrons
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2016-02-23 00:31:55 UTC
Size:
2.51 KB
patch
obsolete
>From 36c37cb875618b12bffebd8728ff0702f255592a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 17 Feb 2016 16:21:50 +0000 >Subject: [PATCH] [SIGNED-OFF] Bug 15840: Catch errors if userid already exists > when importing patrons > >Import borrowers tool explodes if userid already exists. This error >should be caught to avoid the script to explodes. > >TEST PLAN >--------- >1) back up DB >2) drop DB, create empty DB >3) Apply patch 15842 >4) web install all the sample data >5) login as system user and import patron data > -- sample provided to trigger error. > -- you will get a DBIx::class exception > "Duplicate entry ' for key 'userid'" >6) Apply this patch >7) Repeat steps 2-5 > -- patrons won't be inserted but an error > will be nicely displayed in the error list. >8) run koha qa test tools > >Note that it would be easy to insert the patrons anyway and generate a >userid based on the surname and firstname. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt | 5 +++++ > tools/import_borrowers.pl | 7 +++++++ > 2 files changed, 12 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >index fa955da..f31d7da 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >@@ -90,6 +90,11 @@ > [% IF ERROR.borrowernumber %] (for patron with borrowernumber [% ERROR.borrowernumber %])[% END %] > </li> > [% END %] >+ [% IF ERROR.duplicate_userid %] >+ <li class="line_error"> >+ Userid [% ERROR.userid %] is already used by another patron or is empty. >+ </li> >+ [% END %] > [% END %] > </ul> > </div> >diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl >index 42e7a8e..3e67439 100755 >--- a/tools/import_borrowers.pl >+++ b/tools/import_borrowers.pl >@@ -253,6 +253,13 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { > next; > } > >+ # generate a proper login if none provided >+ if ( $borrower{userid} eq '' || !Check_Userid( $borrower{userid} ) ) { >+ push @errors, { duplicate_userid => 1, userid => $borrower{userid} }; >+ $invalid++; >+ next LINE; >+ } >+ > > if ($borrowernumber) { > # borrower exists >-- >2.1.4
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 15840
:
48164
|
48205
|
48303
|
48306
|
48307
|
49330