X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FBAO%2FContributionSoft.php;h=a5eaeb3cac2b445b14e9e391fbef49cb8a945875;hb=2f0647c7ae0cf29bc75cf7ab5e4da896a01a8a99;hp=ad18669da48b4f81d9cc4eb1fe453070d8f3d92e;hpb=681aa547248b9c7d92d368f4879f75f941eba90b;p=civicrm-core.git diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index ad18669da4..a5eaeb3cac 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -35,19 +35,20 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_ContributionSoft { /** - * Construct method + * Construct method. */ public function __construct() { parent::__construct(); } /** - * Add contribution soft credit record + * Add contribution soft credit record. * - * @param array $params (reference ) an assoc array of name/value pairs - * - * @return object soft contribution of object that is added + * @param array $params + * (reference ) an assoc array of name/value pairs. * + * @return object + * soft contribution of object that is added */ public static function add(&$params) { $contributionSoft = new CRM_Contribute_DAO_ContributionSoft(); @@ -62,13 +63,14 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio } /** - * Fetch object based on array of properties + * 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 + * @param array $params + * (reference ) an assoc array of name/value pairs. + * @param array $defaults + * (reference ) an assoc array to hold the flattened values. * - * @return CRM_Contribute_BAO_ContributionSoft object - * @static + * @return CRM_Contribute_BAO_ContributionSoft */ public static function retrieve(&$params, &$defaults) { $contributionSoft = new CRM_Contribute_DAO_ContributionSoft(); @@ -81,16 +83,15 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio } /** - * Delete soft credits + * Delete soft credits. * * @param array $params * - * @static */ public static function del($params) { //delete from contribution soft table $contributionSoft = new CRM_Contribute_DAO_ContributionSoft(); - foreach($params as $column => $value) { + foreach ($params as $column => $value) { $contributionSoft->$column = $value; } $contributionSoft->delete(); @@ -110,8 +111,10 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio WHERE cc.is_test = %2 AND ccs.contact_id = %1 GROUP BY currency'; - $params = array(1 => array($contact_id, 'Integer'), - 2 => array($isTest, 'Integer')); + $params = array( + 1 => array($contact_id, 'Integer'), + 2 => array($isTest, 'Integer'), + ); $cs = CRM_Core_DAO::executeQuery($query, $params); @@ -141,10 +144,11 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio * Retrieve soft contributions for contribution record. * * @param int $contributionID - * @param boolean $all include PCP data + * @param bool $all + * Include PCP data. * - * @return array of soft contribution ids, amounts, and associated contact ids - * @static + * @return array + * Array of soft contribution ids, amounts, and associated contact ids */ public static function getSoftContribution($contributionID, $all = FALSE) { $pcpFields = array( @@ -186,7 +190,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio 'amount' => $dao->amount, 'contact_name' => $dao->display_name, 'soft_credit_type' => $dao->soft_credit_type_id, - 'soft_credit_type_label' => CRM_Core_OptionGroup::getLabel('soft_credit_type', $dao->soft_credit_type_id) + 'soft_credit_type_label' => CRM_Core_OptionGroup::getLabel('soft_credit_type', $dao->soft_credit_type_id), ); $count++; } @@ -201,7 +205,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio * * @return array */ - public static function getSoftCreditIds($contributionID , $isPCP = FALSE) { + public static function getSoftCreditIds($contributionID, $isPCP = FALSE) { $query = " SELECT id FROM civicrm_contribution_soft @@ -231,12 +235,13 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio /** * Function to retrieve the list of soft contributions for given contact. * - * @param int $contact_id contact id - * @param int $isTest - * @param string $filter additional filter criteria, later used in where clause + * @param int $contact_id + * Contact id. + * @param string $filter + * @param int $isTest + * Additional filter criteria, later used in where clause. * * @return array - * @static */ public static function getSoftContributionList($contact_id, $filter = NULL, $isTest = 0) { $query = ' @@ -274,7 +279,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio $params = array( 1 => array($contact_id, 'Integer'), - 2 => array($isTest, 'Integer') + 2 => array($isTest, 'Integer'), ); $cs = CRM_Core_DAO::executeQuery($query, $params); $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(); @@ -302,15 +307,11 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio return $result; } - /* - * Function to assign honor profile fields to template/form, if $honorId (as soft-credit's contact_id) - * is passed then whole honoreeprofile fields with title/value assoc array assigned or only honoreeName - * is assigned - * - * @static - */ - /** + * Function to assign honor profile fields to template/form, if $honorId (as soft-credit's contact_id) + * is passed then whole honoreeprofile fields with title/value assoc array assigned or only honoreeName + * is assigned + * * @param CRM_Core_Form $form * @param array $params * @param int $honoreeprofileId @@ -342,24 +343,26 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio ); unset($profileFields['prefix_id']); } - $honorName .= ' ' . $params['first_name'] . ' ' . $params['last_name']; - unset($profileFields['first_name']); - unset($profileFields['last_name']); - if (array_key_exists('suffix_id', $params)) { - $honorName .= ' ' . CRM_Utils_Array::value(CRM_Utils_Array::value('suffix_id', $params), + $honorName .= ' ' . $params['first_name'] . ' ' . $params['last_name']; + unset($profileFields['first_name']); + unset($profileFields['last_name']); + if (array_key_exists('suffix_id', $params)) { + $honorName .= ' ' . CRM_Utils_Array::value(CRM_Utils_Array::value('suffix_id', $params), CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id') ); - unset($profileFields['suffix_id']); - } - break; - case 'Organization': - $honorName = $params['organization_name']; - unset($profileFields['organization_name']); - break; - case 'Household': - $honorName = $params['household_name']; - unset($profileFields['household_name']); - break; + unset($profileFields['suffix_id']); + } + break; + + case 'Organization': + $honorName = $params['organization_name']; + unset($profileFields['organization_name']); + break; + + case 'Household': + $honorName = $params['household_name']; + unset($profileFields['household_name']); + break; } if ($honorId) { @@ -374,5 +377,5 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio $form->assign('honorName', $honorName); } } -} +}