* - params: array, varies
*/
function civicrm_api3_generic_update($apiRequest) {
- $errorFnName = 'civicrm_api3_create_error';
-
//$key_id = strtolower ($apiRequest['entity'])."_id";
$key_id = "id";
if (!array_key_exists($key_id, $apiRequest['params'])) {
- return $errorFnName("Mandatory parameter missing $key_id");
+ return civicrm_api3_create_error("Mandatory parameter missing $key_id");
}
// @fixme
// tests show that contribution works better with create
return $existing;
}
if ($existing['count'] > 1) {
- return $errorFnName("More than one " . $apiRequest['entity'] . " with id " . $apiRequest['params'][$key_id]);
+ return civicrm_api3_create_error("More than one " . $apiRequest['entity'] . " with id " . $apiRequest['params'][$key_id]);
}
if ($existing['count'] == 0) {
- return $errorFnName("No " . $apiRequest['entity'] . " with id " . $apiRequest['params'][$key_id]);
+ return civicrm_api3_create_error("No " . $apiRequest['entity'] . " with id " . $apiRequest['params'][$key_id]);
}
$existing = array_pop($existing['values']);