*/
class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet {
-
/**
- * static field for default price set details
+ * Static field for default price set details
*
* @var array
* @static
static $_defaultPriceSet = NULL;
/**
- * class constructor
+ * Class constructor
*/
function __construct() {
parent::__construct();
}
/**
- * takes an associative array and creates a price set object
+ * Takes an associative array and creates a price set object
*
* @param array $params (reference) an assoc array of name/value pairs
*
- * @return object CRM_Price_DAO_PriceSet object
+ * @return CRM_Price_DAO_PriceSet object
* @access public
* @static
*/
}
/**
- * Takes a bunch of params that are needed to match certain criteria and
- * retrieves the relevant objects. Typically the valid params are only
- * contact_id. We'll tweak this function to be more full featured over a period
- * of time. This is the inverse function of create. It also stores all the retrieved
- * values in the default array
+ * Fetch object based on array of properties
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param array $defaults (reference ) an assoc array to hold the flattened values
*
- * @return object CRM_Price_DAO_PriceSet object
+ * @return CRM_Price_DAO_PriceSet object
* @access public
* @static
*/
}
/**
- * update the is_active flag in the db
+ * Update the is_active flag in the db
*
* @param int $id id of the database record
* @param $isActive
*
* An array containing price set details (including price fields) is returned
*
- * @param $setID
+ * @param int $setID
* @param bool $required
* @param bool $validOnly
*
/**
* @param CRM_Core_Form $form
- * @param $id
+ * @param int $id
* @param string $entityTable
* @param bool $validOnly
- * @param null $priceSetId
+ * @param int $priceSetId
*
* @return bool|false|int|null
*/
/**
* @param $fields
- * @param $params
+ * @param array $params
* @param $lineItem
* @param string $component
*/
}
/**
- * Function to build the price set form.
+ * Build the price set form.
*
* @param CRM_Core_Form $form
*
*/
static function buildPriceSet(&$form) {
$priceSetId = $form->get('priceSetId');
- $userid = $form->getVar('_userID');
if (!$priceSetId) {
return;
}
) {
$options = CRM_Utils_Array::value('options', $field);
if ($className == 'CRM_Contribute_Form_Contribution_Main' && $component = 'membership') {
+ $userid = $form->getVar('_membershipContactID');
$checklifetime = self::checkCurrentMembership($options, $userid);
if ($checklifetime) {
$form->assign('ispricelifetime', TRUE);
}
/**
- * Function to check the current Membership
+ * Check the current Membership
* having end date null.
*/
static function checkCurrentMembership(&$options, $userid) {
}
/**
- * Function to set daefult the price set fields.
+ * Set daefult the price set fields.
*
- * @param $form
+ * @param CRM_Core_Form $form
* @param $defaults
*
* @return array $defaults
// past price sets discounts are made inaccessible by this as the discount_id is set to NULL
// on the participant record
if (CRM_Price_BAO_PriceSet::removeFrom('civicrm_' . $entityName, $entity->id)) {
- CRM_Core_BAO_Discount::del($this->_id,'civicrm_' . $entityName);
+ CRM_Core_BAO_Discount::del($entity->id,'civicrm_' . $entityName);
}
}
}
if ($sid && self::eventPriceSetDomainID()) {
$domain_id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $sid, 'domain_id', 'id');
if (CRM_Core_Config::domainID() != $domain_id) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
+ CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
}
return TRUE;
}
/**
- * Function to check if auto renew option should be shown
+ * Check if auto renew option should be shown
*
* @param int $priceSetId price set id
*
}
/**
- * Function to retrieve auto renew frequency and interval
+ * Retrieve auto renew frequency and interval
*
* @param int $priceSetId price set id
*
}
/**
- * update the is_quick_config flag in the db
+ * Update the is_quick_config flag in the db
*
* @param int $id id of the database record
* @param boolean $isQuickConfig value we want to set the is_quick_config field
/**
* 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 string $baoName
- * @param integer $id
- * @param integer $newId
+ * @param string $baoName BAO name
+ * @param int $id old event/contribution page id
+ * @param int $newId newly created event/contribution page id
*/
static function copyPriceSet($baoName, $id, $newId) {
$priceSetId = CRM_Price_BAO_PriceSet::getFor($baoName, $id);