* An array containing price set details (including price fields) is returned
*
* @param int $setID
+ * Price Set ID.
* @param bool $required
+ * Appears to have no effect based on reading the code.
* @param bool $validOnly
+ * Should only fields where today's date falls within the valid range be returned?
*
* @return array
- * array consisting of field details
+ * Array consisting of field details
*/
public static function getSetDetail($setID, $required = TRUE, $validOnly = FALSE) {
// create a new tree
}
/**
- * Get the Price Field ID. We call this function when more than one being present would represent an error
+ * Get the Price Field ID.
+ *
+ * We call this function when more than one being present would represent an error
* starting format derived from current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId))
* @param array $priceSet
*
/**
+ * Initiate price set such that various non-BAO things are set on the form.
+ *
+ * This function is not really a BAO function so the location is misleading.
+ *
* @param CRM_Core_Form $form
* @param int $id
+ * Form entity id.
* @param string $entityTable
* @param bool $validOnly
* @param int $priceSetId
+ * Price Set ID
*
* @return bool|false|int|null
*/
}
/**
+ * Get line item purchase information.
+ *
+ * This function takes the input parameters and interprets out of it what has been purchased.
+ *
* @param $fields
+ * This is the output of the function CRM_Price_BAO_PriceSet::getSetDetail($priceSetID, FALSE, FALSE);
+ * And, it would make sense to introduce caching into that function and call it from here rather than
+ * require the $fields array which is passed from pillar to post around the form in order to pass it in here.
* @param array $params
+ * Params reflecting form input e.g with fields 'price_5' => 7, 'price_8' => array(7, 8)
* @param $lineItem
+ * Line item array to be altered.
* @param string $component
+ * This parameter appears to only be relevant to determining whether memberships should be auto-renewed.
+ * (and is effectively a boolean for 'is_membership' which could be calculated from the line items.)
*/
public static function processAmount(&$fields, &$params, &$lineItem, $component = '') {
// using price set
}
/**
- * Check the current Membership
- * having end date null.
+ * Check the current Membership having end date null.
+ *
+ * @param array $options
+ * @param int $userid
+ * Probably actually contact ID.
+ *
+ * @return bool
*/
public static function checkCurrentMembership(&$options, $userid) {
if (!$userid || empty($options)) {
return;
}
static $_contact_memberships = array();
- $checklifetime = FALSE;
+ $checkLifetime = FALSE;
foreach ($options as $key => $value) {
if (!empty($value['membership_type_id'])) {
if (!isset($_contact_memberships[$userid][$value['membership_type_id']])) {
$currentMembership = $_contact_memberships[$userid][$value['membership_type_id']];
if (!empty($currentMembership) && empty($currentMembership['end_date'])) {
unset($options[$key]);
- $checklifetime = TRUE;
+ $checkLifetime = TRUE;
}
}
}
- if ($checklifetime) {
+ if ($checkLifetime) {
return TRUE;
}
else {
* Check if price set id provides option for
* user to select both auto-renew and non-auto-renew memberships
*
+ * @param int $id
+ *
+ * @return bool
*/
public static function checkMembershipPriceSet($id) {
$query