Skip to content

Commit

Permalink
Merge pull request #1 from seamuslee001/CRM-19448
Browse files Browse the repository at this point in the history
Further test fixes
  • Loading branch information
colemanw authored Oct 10, 2016
2 parents 3cdb86a + fb1c6b2 commit 4335f07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static function add(&$params, $ids = array()) {
return CRM_Core_DAO::$_nullObject;
}

if ($params['entity_table'] == 'civicrm_contact' && !empty($params['check_permissions'])) {
if (!empty($params['entity_table']) && $params['entity_table'] == 'civicrm_contact' && !empty($params['check_permissions'])) {
if (!CRM_Contact_BAO_Contact_Permission::allow($params['entity_id'], CRM_Core_Permission::EDIT)) {
throw new CRM_Exception('Permission denied to modify contact record');
}
Expand Down
16 changes: 9 additions & 7 deletions CRM/Core/DAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -2436,13 +2436,15 @@ public function addSelectWhereClause() {
$relatedClauses = array();
$relatedEntities = $this->buildOptions('entity_table', 'get');
foreach ((array) $relatedEntities as $table => $ent) {
$ent = CRM_Core_DAO_AllCoreTables::getBriefName(CRM_Core_DAO_AllCoreTables::getClassForTable($table));
$subquery = CRM_Utils_SQL::mergeSubquery($ent);
if ($subquery) {
$relatedClauses[] = "(entity_table = '$table' AND entity_id " . implode(' AND entity_id ', $subquery) . ")";
}
else {
$relatedClauses[] = "(entity_table = '$table')";
if (!empty($ent)) {
$ent = CRM_Core_DAO_AllCoreTables::getBriefName(CRM_Core_DAO_AllCoreTables::getClassForTable($table));
$subquery = CRM_Utils_SQL::mergeSubquery($ent);
if ($subquery) {
$relatedClauses[] = "(entity_table = '$table' AND entity_id " . implode(' AND entity_id ', $subquery) . ")";
}
else {
$relatedClauses[] = "(entity_table = '$table')";
}
}
}
if ($relatedClauses) {
Expand Down

0 comments on commit 4335f07

Please sign in to comment.