Skip to content

Commit

Permalink
Merge pull request #12464 from jaapjansma/issue_141
Browse files Browse the repository at this point in the history
Fixed #141: only check if name exists.
  • Loading branch information
eileenmcnaughton authored Jul 14, 2018
2 parents b968b9b + 9d5dc96 commit e3556f3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions CRM/Custom/Form/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,10 @@ public static function formRule($fields, $files, $self) {
//validate group title as well as name.
$title = $fields['title'];
$name = CRM_Utils_String::munge($title, '_', 64);
$query = 'select count(*) from civicrm_custom_group where ( name like %1 OR title like %2 ) and id != %3';
$query = 'select count(*) from civicrm_custom_group where ( name like %1) and id != %2';
$grpCnt = CRM_Core_DAO::singleValueQuery($query, array(
1 => array($name, 'String'),
2 => array($title, 'String'),
3 => array((int) $self->_id, 'Integer'),
2 => array((int) $self->_id, 'Integer'),
));
if ($grpCnt) {
$errors['title'] = ts('Custom group \'%1\' already exists in Database.', array(1 => $title));
Expand Down

0 comments on commit e3556f3

Please sign in to comment.