Merge pull request #2287 from pradpnayak/CRM-13848
[civicrm-core.git] / api / v3 / CustomValue.php
index 92bd6ee857b4547ce5e0da7903468395db534245..93bec607c0cc8e2202d32f56b7876218b0e17a37 100644 (file)
@@ -2,7 +2,7 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -176,7 +176,7 @@ function civicrm_api3_custom_value_get($params) {
       return civicrm_api3_create_success($values, $params);
     }
     else {
-      return civicrm_api3_create_error($result['error_message']);
+      throw new API_Exception($result['error_message']);
     }
   }
   else {
@@ -194,7 +194,8 @@ function civicrm_api3_custom_value_get($params) {
         continue;
       }
       $fieldNumber = $idArray[1];
-      $info = array_pop(CRM_Core_BAO_CustomField::getNameFromID($fieldNumber));
+      $customFieldInfo = CRM_Core_BAO_CustomField::getNameFromID($fieldNumber);
+      $info = array_pop($customFieldInfo);
       // id is the index for returned results
 
       if (empty($idArray[2])) {
@@ -232,4 +233,4 @@ function civicrm_api3_custom_value_get($params) {
  */
 function _civicrm_api3_custom_value_get_spec(&$params) {
   $params['entity_id']['api.required'] = 1;
-}
\ No newline at end of file
+}