From e4f08140c6c7bce5f9984c95b76a6083de8a3612 Mon Sep 17 00:00:00 2001
From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Date: Tue, 20 Jan 2015 16:48:13 +0200
Subject: [PATCH] Bug 13602 - Username/password already exists when editing
 borrower attributes and messaging preferences

When editing a Patron's messaging preferences or borrower attributes, one cannot
save changes because 'userid' is not given as a parameter.

It shouldn't, but the
Check_Userid($newdata{'userid'},$borrowernumber) -check must have it.

AFTER THIS PATCH:
Check_Userid() is not called when modifying or saving partial borrower properties.
---
 members/memberentry.pl |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/members/memberentry.pl b/members/memberentry.pl
index 5db8273..76f8bd4 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -328,8 +328,8 @@ if ($op eq 'save' || $op eq 'insert'){
       }
     }
   }
-  # Check if the userid is unique
-  unless (Check_Userid($newdata{'userid'},$borrowernumber)) {
+  # Check if the userid is unique. userid is not passed if we are modifying the messaging preferences or borrower attributes.
+  if (($op ne 'modify' && $op ne 'save') && not(Check_Userid($newdata{'userid'},$borrowernumber))) {
     push @errors, "ERROR_login_exist";
   }
   
-- 
1.7.9.5