]> git.koha-community.org Git - koha.git/commit
Bug 19936: Reuse existing userid if none provided
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 23 Feb 2018 16:45:09 +0000 (13:45 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 12 Apr 2018 12:36:41 +0000 (09:36 -0300)
commit8012cc5ebdd2439791d87c11bce22134d1e76533
treeef6047c557fef89428d7313a13be49c653accbe1
parentc252ab6a878cc97da97739b0fb5434692e12bb4b
Bug 19936: Reuse existing userid if none provided

Found this regression when working on other patches:
If you edit a patron and blank the userid field, it will be regenerated
with an incremented value (firstname.surname will be firstname.surname1)

This is because we use a non-existing patron and ->in_storage in
has_valid_userid is always false.
The trick here is to backup the value, generate the userid, then reset
userid to the previous value.

As the POD says, it will be fix later, when AddMember and ModMember will
be replaced with Koha::Patron->store

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Patron.pm
t/db_dependent/Koha/Patrons.t