From: monishdeb Date: Fri, 11 Jul 2014 20:52:13 +0000 (+0530) Subject: CRM-14969 fix - Array to string conversion in CRM_Utils_Hook::post() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=abe95f292f09f0bd9f5664fecae646707072f64f;p=civicrm-core.git CRM-14969 fix - Array to string conversion in CRM_Utils_Hook::post() https://issues.civicrm.org/jira/browse/CRM-14969 --- diff --git a/api/v3/Generic/Setvalue.php b/api/v3/Generic/Setvalue.php index be0553354b..7fd4e40355 100644 --- a/api/v3/Generic/Setvalue.php +++ b/api/v3/Generic/Setvalue.php @@ -63,13 +63,15 @@ function civicrm_api3_generic_setValue($apiRequest) { return civicrm_api3_create_error("Param '$field' is of a type not managed yet (".$def['type']."). Join the API team and help us implement it", array('error_code' => 'NOT_IMPLEMENTED')); } - if (CRM_Core_DAO::setFieldValue(_civicrm_api3_get_DAO($entity), $id, $field, $value)) { - $entity = array('id' => $id, $field => $value); - CRM_Utils_Hook::post('edit', $entity, $id, $entity); + $dao_name = _civicrm_api3_get_DAO($entity); + if (CRM_Core_DAO::setFieldValue($dao_name, $id, $field, $value)) { + $params = array('id' => $id, $field => $value); + $entityDAO = new $dao_name(); + $entityDAO->copyValues($params); + CRM_Utils_Hook::post('edit', $entity, $id, $entityDAO); return civicrm_api3_create_success($entity); } else { return civicrm_api3_create_error("error assigning $field=$value for $entity (id=$id)"); } } -