class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_ContributionSoft {
/**
- * construct method
+ * Construct method
*/
function __construct() {
parent::__construct();
}
/**
- * function to add contribution soft credit record
+ * Add contribution soft credit record
*
* @param array $params (reference ) an assoc array of name/value pairs
*
}
/**
- * 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_Contribute_BAO_ContributionSoft object
+ * @return CRM_Contribute_BAO_ContributionSoft object
* @access public
* @static
*/
}
/**
- * Function to delete soft credits
+ * Delete soft credits
+ *
+ * @param array $params
*
- * @param int $contributionTypeId
* @static
*/
static function del($params) {
$contributionSoft->delete();
}
+ /**
+ * @param int $contact_id
+ * @param int $isTest
+ *
+ * @return array
+ */
static function getSoftContributionTotals($contact_id, $isTest = 0) {
$query = '
SELECT SUM(amount) as amount, AVG(total_amount) as average, cc.currency
}
/**
- * Function to retrieve soft contributions for contribution record.
- * @param array $params an associated array
- * @param boolean $all include PCP data
+ * Retrieve soft contributions for contribution record.
*
- * @return array of soft contribution ids, amounts, and associated contact ids
- * @static
+ * @param int $contributionID
+ * @param boolean $all include PCP data
+ *
+ * @return array of soft contribution ids, amounts, and associated contact ids
+ * @static
*/
static function getSoftContribution($contributionID, $all = FALSE) {
$pcpFields = array(
return $softContribution;
}
+ /**
+ * @param int $contributionID
+ * @param bool $isPCP
+ *
+ * @return array
+ */
static function getSoftCreditIds($contributionID , $isPCP = FALSE) {
$query = "
SELECT id
/**
* Function to retrieve the list of soft contributions for given contact.
- * @param int $contact_id contact id
*
- * @return array
- * @static
+ * @param int $contact_id contact id
+ * @param int $isTest
+ * @param string $filter additional filter criteria, later used in where clause
+ *
+ * @return array
+ * @static
*/
- static function getSoftContributionList($contact_id, $isTest = 0) {
+ static function getSoftContributionList($contact_id, $filter = NULL, $isTest = 0) {
$query = '
SELECT ccs.id, ccs.amount as amount,
ccs.contribution_id,
LEFT JOIN civicrm_contact contact ON
ccs.contribution_id = cc.id AND cc.contact_id = contact.id
LEFT JOIN civicrm_financial_type cct ON cc.financial_type_id = cct.id
- WHERE cc.is_test = %2 AND ccs.contact_id = %1
- ORDER BY cc.receive_date DESC';
+ ';
+
+ $where = "
+ WHERE cc.is_test = %2 AND ccs.contact_id = %1";
+ if ($filter) {
+ $where .= $filter;
+ }
+
+ $query .= "{$where} ORDER BY cc.receive_date DESC";
$params = array(
1 => array($contact_id, 'Integer'),
* @static
*/
+ /**
+ * @param CRM_Core_Form $form
+ * @param array $params
+ * @param int $honoreeprofileId
+ * @param int $honorId
+ */
static function formatHonoreeProfileFields($form, $params, $honoreeprofileId, $honorId = NULL) {
$profileContactType = CRM_Core_BAO_UFGroup::getContactType($honoreeprofileId);
$profileFields = CRM_Core_BAO_UFGroup::getFields($honoreeprofileId);