Merge pull request #9960 from colemanw/CRM-20029
[civicrm-core.git] / api / v3 / Profile.php
index 3607b42849be94bd73b3ebd8dc10077180bfdd42..7a0e431751b166baa12c83585b48935db5902637 100644 (file)
@@ -3,7 +3,7 @@
   +--------------------------------------------------------------------+
   | CiviCRM version 4.7                                                |
   +--------------------------------------------------------------------+
-  | Copyright CiviCRM LLC (c) 2004-2016                                |
+  | Copyright CiviCRM LLC (c) 2004-2017                                |
   +--------------------------------------------------------------------+
   | This file is a part of CiviCRM.                                    |
   |                                                                    |
@@ -348,12 +348,24 @@ function civicrm_api3_profile_apply($params) {
   );
 
   if (empty($data)) {
-    throw new API_Exception('Enable to format profile parameters.');
+    throw new API_Exception('Unable to format profile parameters.');
   }
 
   return civicrm_api3_create_success($data);
 }
 
+/**
+ * Adjust Metadata for Apply action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
+ *
+ * @param array $params
+ *   Array of parameters determined by getfields.
+ */
+function _civicrm_api3_profile_apply_spec(&$params) {
+  $params['profile_id']['api.required'] = 1;
+  $params['profile_id']['title'] = 'Profile ID';
+}
 
 /**
  * Get pseudo profile 'billing'.
@@ -645,7 +657,7 @@ function _civicrm_api3_map_profile_fields_to_entity(&$field) {
     'total_amount' => 'contribution',
     'receive_date' => 'contribution',
     'payment_instrument' => 'contribution',
-    'check_number' => 'contribution',
+    'contribution_check_number' => 'contribution',
     'contribution_status_id' => 'contribution',
     'soft_credit' => 'contribution',
     'soft_credit_type' => 'contribution_soft',