Bug 13502: Code introcduced in 1861 wrongly assumes a null userid is unique

To test

1/ Create a borrower with '' as their userid, you may have to edit a
   row in the db to do this
2/ Run  perl t/db_dependent/Circulation/CheckIfIssuedToPatron.t
3/ Notice some tests fail and you see
   DBD::mysql::st execute failed: Duplicate entry '' for key 'userid'
   at /home/chrisc/git/catalyst-koha/C4/SQLHelper.pm line 184.
4/ Apply the patch
5/ Run the tests again, notice they now pass

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Chris Cormack 2014-12-31 10:20:59 +13:00 committed by Tomas Cohen Arazi
parent fb706f58b2
commit 426a48dd19

View file

@ -920,7 +920,7 @@ sub AddMember {
sub Check_Userid {
my ( $uid, $borrowernumber ) = @_;
return 1 unless ($uid);
return 0 unless ($uid); # userid is a unique column, we should assume NULL is not unique
return 0 if ( $uid eq C4::Context->config('user') );