INFRA-132 - Batch 14 (g)
[civicrm-core.git] / api / v3 / Profile.php
index fb7489d242c63bf081d538a0fedc58e9c17de979..c41b04b7ce8514dd1bba977cfd450c47a2d18160 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /*
   +--------------------------------------------------------------------+
   | CiviCRM version 4.6                                                |
  * @package CiviCRM_APIv3
  * @subpackage API_ActivityProfile
  * @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: ActivityProfile.php 30486 2011-05-20 16:12:09Z rajan $
+ * @version $Id: Profile.php 30486 2011-05-20 16:12:09Z rajan $
  *
  */
 
 /**
  * Retrieve Profile field values.
  *
- * @param array $params
- *   Associative array of property name/value.
- *                             pairs to get profile field values
- *
- * @throws API_Exception
- * @return Profile field values|CRM_Error
- *
  * NOTE this api is not standard & since it is tested we need to honour that
  * but the correct behaviour is for it to return an id indexed array as this supports
  * multiple instances - if a  single profile is passed in we will not return a normal api result array
  * in order to avoid breaking code. (This could still be confusing :-( but we have to keep the tested behaviour working
  *
  * Note that if contact_id is empty an array of defaults is returned
+ *
+ * @param array $params
+ *   Associative array of property name/value.
+ *   pairs to get profile field values
+ *
+ * @throws API_Exception
+ * @return array
  */
 function civicrm_api3_profile_get($params) {
   $nonStandardLegacyBehaviour = is_numeric($params['profile_id']) ? TRUE : FALSE;
@@ -156,7 +155,8 @@ function _civicrm_api3_profile_get_spec(&$params) {
  * @param array $params
  *
  * @throws API_Exception
- * @return array API result array
+ * @return array
+ *   API result array
  */
 function civicrm_api3_profile_submit($params) {
   $profileID = _civicrm_api3_profile_getProfileID($params['profile_id']);
@@ -295,7 +295,8 @@ function civicrm_api3_profile_submit($params) {
  * @param string $fieldName
  *   API field name.
  *
- * @return string BAO Field Name
+ * @return string
+ *   BAO Field Name
  */
 function _civicrm_api3_profile_translate_fieldnames_for_bao($fieldName) {
   $fieldName = str_replace('url', 'URL', $fieldName);
@@ -335,7 +336,8 @@ function _civicrm_api3_profile_submit_spec(&$params, $apirequest) {
  *   Associative array of property name/value.
  *                             pairs to update profile field values
  *
- * @return array Updated Contact/ Activity object|CRM_Error
+ * @return array
+ *   Updated Contact/ Activity object|CRM_Error
  *
  *
  */
@@ -352,7 +354,7 @@ function civicrm_api3_profile_set($params) {
  *                             pairs to profile field values
  *
  * @throws API_Exception
- * @return formatted profile field values|CRM_Error
+ * @return array
  *
  * @todo add example
  * @todo add test cases
@@ -402,7 +404,7 @@ function civicrm_api3_profile_apply($params) {
  */
 function _civicrm_api3_profile_getbillingpseudoprofile(&$params) {
 
-  $locations = civicrm_api3('address', 'getoptions', array('field' => 'location_type_id'));
+  $locations = civicrm_api3('address', 'getoptions', array('field' => 'location_type_id', 'context' => 'validate'));
   $locationTypeID = array_search('Billing', $locations['values']);
 
   if (empty($params['contact_id'])) {
@@ -694,7 +696,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) {
  *
  * @param int $profileID
  *
- * @return integer|string
+ * @return int|string
  * @throws CiviCRM_API3_Exception
  */
 function _civicrm_api3_profile_getProfileID($profileID) {
@@ -736,7 +738,8 @@ function _civicrm_api3_profile_appendaliases($values, $entity) {
 
 /**
  * @deprecated api notice
- * @return array of deprecated actions
+ * @return array
+ *   Array of deprecated actions
  */
 function _civicrm_api3_profile_deprecation() {
   return array(