Merge pull request #6378 from johanv/CRM-15991-permission_delete_relationship
[civicrm-core.git] / api / v3 / Product.php
index 178d3a676468bb45ed7b036ea2d9475c55836284..cf32e8827ded2c7e1191e838ad8f75f8b864a020 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  */
 
 /**
- * File for the CiviCRM APIv3 product functions
+ * This api exposes CiviCRM premium products.
  *
- * @package CiviCRM_APIv3
- * @subpackage API_product
+ * Premiums are used as incentive gifts on contribution pages.
+ * Use chaining to create a premium and related products in one api call.
  *
+ * @package CiviCRM_APIv3
  */
 
 /**
- * Save a product
- *
- * Allowed @params array keys are:
- * {@getfields product_create}
- * @example productCreate.php
+ * Save a product.
  *
  * @param array $params
  *
  * @throws API_Exception
  * @return array
- *   Array of newly created product property values.
  */
 function civicrm_api3_product_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
 }
 
 /**
- * Get a product
+ * Adjust Metadata for Create action.
  *
- * Allowed @params array keys are:
- * {@getfields product_get}
- * @example productCreate.php
+ * The metadata is used for setting defaults, documentation & validation.
+ *
+ * @param array $params
+ *   Array of parameters determined by getfields.
+ */
+function _civicrm_api3_product_create_spec(&$params) {
+  $params['is_active']['api.default'] = 1;
+}
+
+/**
+ * Get a product.
  *
  * @param array $params
  *
@@ -67,11 +71,7 @@ function civicrm_api3_product_get($params) {
 }
 
 /**
- * Delete a product
- *
- * Allowed @params array keys are:
- * {@getfields product_delete}
- * @example productCreate.php
+ * Delete a product.
  *
  * @param array $params
  *