Bug 1861 - Unique patrons logins not (totally) enforced
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 8 Jul 2014 13:50:08 +0000 (09:50 -0400)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 29 Dec 2014 19:19:45 +0000 (08:19 +1300)
commit5e707555f88edb5beb2c63e0dbcef698907e44d6
treed34f42545bfdec5b55710ca692486da8bc00ece1
parent54a37c8fc1c1ac8db0d4127b0daa7dc588c9a59f
Bug 1861 - Unique patrons logins not (totally) enforced

The Koha 3.0 patron admin page will prevent you from creating a user who
has an identical OPAC login as someone else (though I would change the
error message from "Login/password already exists." to "Login
already exists.", since it's not the password that's the
problem).

However, there's nothing enforced in the MySQL database to prevent
patrons from being imported or manually inserted with duplicate logins.
Would it be better to change the MySQL spec from this:
KEY `userid` (`userid`)
to this:
UNIQUE KEY `userid` (`userid`)

Test plan:
1) Enter mysql console
2) Attempt to create two borrowers with identical user id's
3) Note you are able to do so
4) Delete these bororwers
5) Apply this patch
6) Run updatedatabase.pl
7) Repeat step 2
8) Note you are now unable to do so

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no koha-qa errors

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Leaves deletedborrowers as it is, deleting patrons still works ok.
Works according to test plan.
Database update will only be successful, when no duplicate entries
exist in the database.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit df4297621d285dbdbe13eaff04dae2a9419ed824)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl