X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FGeneric%2FSetvalue.php;h=ff3e6011873f3eb15d67bf990da33fd934294b30;hb=6238501eb59e8f3f540c6feef0315a4beacc95f4;hp=be0553354b44757f5411e414676e0118447e6625;hpb=9b10578bd1e1895cf21e39ff16d3363e5419b591;p=civicrm-core.git diff --git a/api/v3/Generic/Setvalue.php b/api/v3/Generic/Setvalue.php index be0553354b..ff3e601187 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); - return civicrm_api3_create_success($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, $entityDAO->id, $entityDAO); + return civicrm_api3_create_success($params); } else { return civicrm_api3_create_error("error assigning $field=$value for $entity (id=$id)"); } } -