Bug 15840: Catch errors if userid already exists when importing patrons
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 17 Feb 2016 16:21:50 +0000 (16:21 +0000)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Mon, 21 Mar 2016 21:24:00 +0000 (21:24 +0000)
commitf1e156453a1bc636914bc5c969e1665d7108cb95
tree242fd9d347635855367630e143d7c53e0ff1eb48
parent6c1b39b4cbceb1a414a91865e15612385c2eb5b7
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>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt
tools/import_borrowers.pl