Fixed a bug that wouldn't allow admins to save a user profile if email address is required
This commit is contained in:
parent
d05c0af5af
commit
18dd11345c
2 changed files with 8 additions and 3 deletions
|
|
@ -505,7 +505,7 @@ sub getPasswordRecoveryFields {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isDuplicate( fieldValue )
|
||||
=head2 isDuplicate( fieldValue, userId )
|
||||
|
||||
Checks the value of the field to see if it is duplicated in the system. Returns true of false.
|
||||
|
||||
|
|
@ -513,6 +513,10 @@ Checks the value of the field to see if it is duplicated in the system. Returns
|
|||
|
||||
value to check for duplicates against
|
||||
|
||||
=head3 userId
|
||||
|
||||
userId to check for duplicates againts
|
||||
|
||||
=cut
|
||||
|
||||
sub isDuplicate {
|
||||
|
|
@ -520,9 +524,10 @@ sub isDuplicate {
|
|||
my $session = $self->session;
|
||||
my $fieldId = $self->getId;
|
||||
my $value = shift;
|
||||
my $userId = shift || $session->user->userId;
|
||||
|
||||
my $sql = qq{select count(*) from userProfileData where $fieldId = ? and userId <> ?};
|
||||
my $duplicate = $session->db->quickScalar($sql,[$value, $session->user->userId]);
|
||||
my $duplicate = $session->db->quickScalar($sql,[$value, $userId]);
|
||||
return ($duplicate > 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue