Skip to content
Snippets Groups Projects
Commit 8ebe9afb authored by lobo's avatar lobo
Browse files

Merge pull request #1973 from kurund/CRM-13587

CRM-13587, fixes trigger issue while updating custom group - contact subtypes
parents f27916ac 66ed0bee
Branches
Tags
No related merge requests found
......@@ -602,8 +602,6 @@ WHERE name = %1";
$contactType->id = CRM_Utils_Array::value('id', $params);
$contactType->is_active = CRM_Utils_Array::value('is_active', $params, 0);
$contactType->save();
if ($contactType->find(TRUE)) {
$contactName = $contactType->name;
......@@ -812,14 +810,16 @@ WHERE extends = %1 AND " . implode(" OR ", $subTypeClause);
* @return void
* @access public
*/
function deleteCustomRowsOfSubtype($gID, $subtypes = array(
)) {
public static function deleteCustomRowsOfSubtype($gID, $subtypes = array()) {
if (!$gID or empty($subtypes)) {
return FALSE;
}
$tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $gID, 'table_name');
// drop triggers CRM-13587
CRM_Core_DAO::dropTriggers($tableName);
$subtypeClause = array();
foreach ($subtypes as $subtype) {
$subtype = CRM_Utils_Type::escape($subtype, 'String');
......@@ -831,7 +831,11 @@ WHERE extends = %1 AND " . implode(" OR ", $subTypeClause);
FROM {$tableName} custom
INNER JOIN civicrm_contact ON civicrm_contact.id = custom.entity_id
WHERE ($subtypeClause)";
return CRM_Core_DAO::singleValueQuery($query);
CRM_Core_DAO::singleValueQuery($query);
// rebuild triggers CRM-13587
CRM_Core_DAO::triggerRebuild($tableName);
}
/**
......
......@@ -243,7 +243,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
$sel2['ParticipantRole'] = $participantRole;
$sel2['ParticipantEventName'] = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$sel2['ParticipantEventType'] = $eventType;
$sel2['Contribution'] = CRM_Contribute_PseudoConstant::financialType( );
$sel2['Contribution'] = CRM_Contribute_PseudoConstant::financialType();
$sel2['Relationship'] = $allRelationshipType;
$sel2['Individual'] = CRM_Contact_BAO_ContactType::subTypePairs('Individual', FALSE, NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment