From b1cb6336602834ff0562429ddcf254c703804179 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 25 Mar 2014 22:44:18 -0700 Subject: [PATCH] civicrm_api3_create_error, api/v3/Generic/Update - Remove unnecessary indirection --- api/v3/Generic/Update.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/api/v3/Generic/Update.php b/api/v3/Generic/Update.php index 1c95bcae6a..3c37f70b54 100644 --- a/api/v3/Generic/Update.php +++ b/api/v3/Generic/Update.php @@ -43,12 +43,10 @@ * - 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 @@ -62,10 +60,10 @@ function civicrm_api3_generic_update($apiRequest) { 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']); -- 2.25.1