copyright and version fixes
[civicrm-core.git] / api / v3 / CustomValue.php
index 92bd6ee857b4547ce5e0da7903468395db534245..fb40aa92437c7517e69a5bd217e9723482e66efd 100644 (file)
@@ -2,9 +2,9 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -32,7 +32,7 @@
  * @package CiviCRM_APIv3
  * @subpackage API_CustomField
  *
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * @version $Id: CustomField.php 30879 2010-11-22 15:45:55Z shot $
  */
 
@@ -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])) {
@@ -205,14 +206,14 @@ function civicrm_api3_custom_value_get($params) {
         $n = $idArray[2];
         $id = $fieldNumber . "." . $idArray[2];
       }
-      if (CRM_Utils_Array::value('format.field_names', $params)) {
+      if (!empty($params['format.field_names'])) {
         $id = $info['field_name'];
       }
       else {
         $id = $fieldNumber;
       }
       $values[$id]['entity_id'] = $getParams['entityID'];
-      if (CRM_Utils_Array::value('entityType', $getParams)) {
+      if (!empty($getParams['entityType'])) {
         $values[$n]['entity_table'] = $getParams['entityType'];
       }
       //set 'latest' -useful for multi fields but set for single for consistency
@@ -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
+}