* @static
*/
static function create(&$params) {
+ if(empty($params['id']) && empty($params['name'])) {
+ $params['name'] = CRM_Utils_String::munge($params['title'], '_', 242);
+ }
$priceSetBAO = new CRM_Price_BAO_PriceSet();
$priceSetBAO->copyValues($params);
if (self::eventPriceSetDomainID()) {
*
* @param string $entity
*
- * @return id $priceSetID
+ * @return array $defaultPriceSet default price set
*
* @access public
* @static
*
*/
public static function getDefaultPriceSet($entity = 'contribution') {
- if ($entity == 'contribution') {
- $entityName = 'default_contribution_amount';
- }
- else if ($entity == 'membership') {
+
+ $entityName = 'default_contribution_amount';
+ if ($entity == 'membership') {
$entityName = 'default_membership_type_amount';
}
* Return a list of all forms which use this price set.
*
* @param int $id id of price set
- * @param bool|\str $simpleReturn - get raw data. Possible values: 'entity', 'table'
+ * @param bool|string $simpleReturn - get raw data. Possible values: 'entity', 'table'
*
* @return array
*/
}
/**
- * Find a price_set_id associatied with the given option value or field ID
+ * Find a price_set_id associated with the given option value or field ID
*
* @param array $params (reference) an assoc array of name/value pairs
* array may contain either option id or
* price field id
*
- * @return price set id on success, null otherwise
+ * @return integer|NULL price set id on success, null otherwise
* @static
* @access public
*/
public static function getSetDetail($setID, $required = TRUE, $validOnly = FALSE) {
// create a new tree
$setTree = array();
- $select = $from = $where = $orderBy = '';
$priceFields = array(
'id',
}
/**
- * @param $form
+ * @param CRM_Core_Form $form
* @param $id
* @param string $entityTable
* @param bool $validOnly
/**
* Function to build the price set form.
*
- * @param $form
+ * @param CRM_Core_Form $form
*
* @return void
* @access public
/**
* Get field ids of a price set
*
- * @param int id Price Set id
+ * @param int $id Price Set id
*
* @return array of the field ids
*
return false;
}
- /*
+ /**
* Copy priceSet when event/contibution page is copied
*
* @params string $baoName BAO name
* @params int $id old event/contribution page id
* @params int $newId newly created event/contribution page id
*
- */
- /**
- * @param $baoName
- * @param $id
- * @param $newId
+ * @param string $baoName
+ * @param integer $id
+ * @param integer $newId
*/
static function copyPriceSet($baoName, $id, $newId) {
$priceSetId = CRM_Price_BAO_PriceSet::getFor($baoName, $id);
function tearDown() {
}
+ /**
+ *
+ */
public function testCreatePriceSet() {
$result = $this->callAPIAndDocument($this->_entity, 'create', $this->_params, __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count']);
$this->getAndCheck($this->_params, $result['id'], $this->_entity);
}
+ /**
+ * Check that no name doesn't cause failure
+ */
+ public function testCreatePriceSetNoName() {
+ $params = $this->_params;
+ unset($params['name']);
+ $result = $this->callAPISuccess($this->_entity, 'create', $params);
+ }
+
+ /**
+ *
+ */
public function testGetBasicPriceSet() {
$getParams = array(
'name' => 'default_contribution_amount',