projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #5214 from jitendrapurohit/CRM-15934changes
[civicrm-core.git]
/
CRM
/
Contribute
/
BAO
/
Contribution.php
diff --git
a/CRM/Contribute/BAO/Contribution.php
b/CRM/Contribute/BAO/Contribution.php
index 6d83725beffb90dd2358c66acb752fcf9c2be34e..76accef4136f25088da787ae89edc6c19076738e 100644
(file)
--- a/
CRM/Contribute/BAO/Contribution.php
+++ b/
CRM/Contribute/BAO/Contribution.php
@@
-23,7
+23,7
@@
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+
*/
/**
*
/**
*
@@
-38,7
+38,6
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
* Static field for all the contribution information that we can potentially import
*
* @var array
* Static field for all the contribution information that we can potentially import
*
* @var array
- * @static
*/
static $_importableFields = NULL;
*/
static $_importableFields = NULL;
@@
-46,7
+45,6
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
* Static field for all the contribution information that we can potentially export
*
* @var array
* Static field for all the contribution information that we can potentially export
*
* @var array
- * @static
*/
static $_exportableFields = NULL;
*/
static $_exportableFields = NULL;
@@
-66,11
+64,17
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
*/
public $_component = NULL;
*/
public $_component = NULL;
- /*
- * construct method
+ /**
+ * Possibly obsolete variable.
+ *
+ * If you use it please explain why it is set in the create function here.
+ *
+ * @var string
*/
*/
+ public $trxn_result_code;
+
/**
/**
- * Class constructor
+ * Class constructor
.
*
* @return \CRM_Contribute_DAO_Contribution
*/
*
* @return \CRM_Contribute_DAO_Contribution
*/
@@
-81,7
+85,7
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
}
/**
}
/**
- * Takes an associative array and creates a contribution object
+ * Takes an associative array and creates a contribution object
.
*
* the function extract all the params it needs to initialize the create a
* contribution object. the params array could contain additional unused name/value
*
* the function extract all the params it needs to initialize the create a
* contribution object. the params array could contain additional unused name/value
@@
-92,12
+96,11
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
* @param array $ids
* The array that holds all the db ids.
*
* @param array $ids
* The array that holds all the db ids.
*
- * @return CRM_Contribute_BAO_Contribution object
- * @static
+ * @return CRM_Contribute_BAO_Contribution|void
*/
public static function add(&$params, $ids = array()) {
if (empty($params)) {
*/
public static function add(&$params, $ids = array()) {
if (empty($params)) {
- return;
+ return
NULL
;
}
//per http://wiki.civicrm.org/confluence/display/CRM/Database+layer we are moving away from $ids array
$contributionID = CRM_Utils_Array::value('contribution', $ids, CRM_Utils_Array::value('id', $params));
}
//per http://wiki.civicrm.org/confluence/display/CRM/Database+layer we are moving away from $ids array
$contributionID = CRM_Utils_Array::value('contribution', $ids, CRM_Utils_Array::value('id', $params));
@@
-202,7
+205,7
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
}
/**
}
/**
- * Get defaults for new entity
+ * Get defaults for new entity
.
* @return array
*/
public static function getDefaults() {
* @return array
*/
public static function getDefaults() {
@@
-226,7
+229,6
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
* The array that holds all the db ids.
*
* @return CRM_Contribute_BAO_Contribution|null the found object or null
* The array that holds all the db ids.
*
* @return CRM_Contribute_BAO_Contribution|null the found object or null
- * @static
*/
public static function &getValues($params, &$values, &$ids) {
if (empty($params)) {
*/
public static function &getValues($params, &$values, &$ids) {
if (empty($params)) {
@@
-248,9
+250,13
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
}
/**
}
/**
- *
@param array $params
+ *
Calculate net_amount & fee_amount if they are not set.
*
*
- * @return mixed
+ * Net amount should be total - fee.
+ * This should only be called for new contributions.
+ *
+ * @param array $params
+ * Params for a new contribution before they are saved.
*/
public static function calculateMissingAmountParams(&$params) {
if (!isset($params['fee_amount'])) {
*/
public static function calculateMissingAmountParams(&$params) {
if (!isset($params['fee_amount'])) {
@@
-290,15
+296,14
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
}
/**
}
/**
- * Takes an associative array and creates a contribution object
+ * Takes an associative array and creates a contribution object
.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param array $ids
* The array that holds all the db ids.
*
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param array $ids
* The array that holds all the db ids.
*
- * @return CRM_Contribute_BAO_Contribution object
- * @static
+ * @return CRM_Contribute_BAO_Contribution
*/
public static function create(&$params, $ids = array()) {
$dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date');
*/
public static function create(&$params, $ids = array()) {
$dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date');
@@
-400,7
+405,11
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
$softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp);
$softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp);
$softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
$softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp);
$softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp);
$softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
- CRM_Contribute_BAO_ContributionSoft::add($softParams);
+ $contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($softParams);
+ //Send notification to owner for PCP
+ if ($contributionSoft->pcp_id) {
+ CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
+ }
}
if (isset($params['soft_credit'])) {
$softParams = $params['soft_credit'];
}
if (isset($params['soft_credit'])) {
$softParams = $params['soft_credit'];
@@
-488,7
+497,6
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
* True if we want to resolve the values in the reverse direction (value -> name).
*
* @return void
* True if we want to resolve the values in the reverse direction (value -> name).
*
* @return void
- * @static
*/
public static function resolveDefaults(&$defaults, $reverse = FALSE) {
self::lookupValue($defaults, 'financial_type', CRM_Contribute_PseudoConstant::financialType(), $reverse);
*/
public static function resolveDefaults(&$defaults, $reverse = FALSE) {
self::lookupValue($defaults, 'financial_type', CRM_Contribute_PseudoConstant::financialType(), $reverse);
@@
-498,12
+506,18
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
}
/**
}
/**
- * convert associative array names to values
- * and vice-versa.
+ * Convert associative array names to values and vice-versa.
*
* This function is used by both the web form layer and the api. Note that
* the api needs the name => value conversion, also the view layer typically
* requires value => name conversion
*
* This function is used by both the web form layer and the api. Note that
* the api needs the name => value conversion, also the view layer typically
* requires value => name conversion
+ *
+ * @param array $defaults
+ * @param string $property
+ * @param array $lookup
+ * @param bool $reverse
+ *
+ * @return bool
*/
public static function lookupValue(&$defaults, $property, &$lookup, $reverse) {
$id = $property . '_id';
*/
public static function lookupValue(&$defaults, $property, &$lookup, $reverse) {
$id = $property . '_id';
@@
-527,10
+541,9
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
}
/**
}
/**
- * Takes a bunch of params that are needed to match certain criteria and
- * retrieves the relevant objects. 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
+ * Retrieve DB object based on input parameters.
+ *
+ * It also stores all the retrieved values in the default array.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
@@
-540,8
+553,7
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
* @param array $ids
* (reference) the array that holds all the db ids.
*
* @param array $ids
* (reference) the array that holds all the db ids.
*
- * @return CRM_Contribute_BAO_Contribution object
- * @static
+ * @return CRM_Contribute_BAO_Contribution
*/
public static function retrieve(&$params, &$defaults, &$ids) {
$contribution = CRM_Contribute_BAO_Contribution::getValues($params, $defaults, $ids);
*/
public static function retrieve(&$params, &$defaults, &$ids) {
$contribution = CRM_Contribute_BAO_Contribution::getValues($params, $defaults, $ids);
@@
-549,7
+561,7
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
}
/**
}
/**
- * Combine all the importable fields from the lower levels object
+ * Combine all the importable fields from the lower levels object
.
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
@@
-560,7
+572,6
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
*
* @return array
* array of importable Fields
*
* @return array
* array of importable Fields
- * @static
*/
public static function &importableFields($contactType = 'Individual', $status = TRUE) {
if (!self::$_importableFields) {
*/
public static function &importableFields($contactType = 'Individual', $status = TRUE) {
if (!self::$_importableFields) {
@@
-648,13
+659,21
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
),
);
),
);
+ $contributionPage = array(
+ 'contribution_page' => array(
+ 'title' => ts('Contribution Page'),
+ 'name' => 'contribution_page',
+ 'where' => 'civicrm_contribution_page.title',
+ 'data_type' => CRM_Utils_Type::T_STRING,
+ ),
+ );
+
$contributionNote = array(
$contributionNote = array(
- 'contribution_note' =>
- array(
- 'title' => ts('Contribution Note'),
- 'name' => 'contribution_note',
- 'data_type' => CRM_Utils_Type::T_TEXT,
- ),
+ 'contribution_note' => array(
+ 'title' => ts('Contribution Note'),
+ 'name' => 'contribution_note',
+ 'data_type' => CRM_Utils_Type::T_TEXT,
+ ),
);
$contributionRecurId = array(
);
$contributionRecurId = array(
@@
-699,7
+718,7
@@
class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
),
);
),
);
- $fields = array_merge($impFields, $typeField, $contributionStatus, $optionField, $expFieldProduct,
+ $fields = array_merge($impFields, $typeField, $contributionStatus, $
contributionPage, $
optionField, $expFieldProduct,
$expFieldsContrib, $contributionNote, $contributionRecurId, $extraFields, $softCreditFields, $financialAccount,
CRM_Core_BAO_CustomField::getFieldsForImport('Contribution')
);
$expFieldsContrib, $contributionNote, $contributionRecurId, $extraFields, $softCreditFields, $financialAccount,
CRM_Core_BAO_CustomField::getFieldsForImport('Contribution')
);
@@
-767,13
+786,12
@@
INNER JOIN civicrm_contact contact ON ( contact.id = civicrm_contribution.conta
}
/**
}
/**
- * Delete the indirect records associated with this contribution first
+ * Delete the indirect records associated with this contribution first
.
*
* @param int $id
*
*
* @param int $id
*
- * @return mixed|null $results no of deleted Contribution on success, false otherwise
- * @access public
- * @static
+ * @return mixed|null
+ * $results no of deleted Contribution on success, false otherwise
*/
public static function deleteContribution($id) {
CRM_Utils_Hook::pre('delete', 'Contribution', $id, CRM_Core_DAO::$_nullArray);
*/
public static function deleteContribution($id) {
CRM_Utils_Hook::pre('delete', 'Contribution', $id, CRM_Core_DAO::$_nullArray);
@@
-840,18
+858,16
@@
INNER JOIN civicrm_contact contact ON ( contact.id = civicrm_contribution.conta
}
/**
}
/**
- * Check if there is a contribution with the same trxn_id or invoice_id
+ * Check if there is a contribution with the same trxn_id or invoice_id
.
*
* @param array $input
* An assoc array of name/value pairs.
* @param array $duplicates
*
* @param array $input
* An assoc array of name/value pairs.
* @param array $duplicates
- * (reference ) store ids of duplicate contribs.
- *
+ * (reference) store ids of duplicate contribs.
* @param int $id
*
* @param int $id
*
- * @return bool
ean
+ * @return bool
* true if duplicate, false otherwise
* true if duplicate, false otherwise
- * static
*/
public static function checkDuplicate($input, &$duplicates, $id = NULL) {
if (!$id) {
*/
public static function checkDuplicate($input, &$duplicates, $id = NULL) {
if (!$id) {
@@
-894,17
+910,16
@@
INNER JOIN civicrm_contact contact ON ( contact.id = civicrm_contribution.conta
}
/**
}
/**
- * Takes an associative array and creates a contribution_product object
+ * Takes an associative array and creates a contribution_product object
.
*
* the function extract all the params it needs to initialize the create a
* contribution_product object. the params array could contain additional unused name/value
* pairs
*
* @param array $params
*
* the function extract all the params it needs to initialize the create a
* contribution_product object. the params array could contain additional unused name/value
* pairs
*
* @param array $params
- * (reference
) an assoc array of name/value pairs.
+ * (reference) an assoc array of name/value pairs.
*
*
- * @return CRM_Contribute_BAO_ContributionProduct object
- * @static
+ * @return CRM_Contribute_DAO_ContributionProduct
*/
public static function addPremium(&$params) {
$contributionProduct = new CRM_Contribute_DAO_ContributionProduct();
*/
public static function addPremium(&$params) {
$contributionProduct = new CRM_Contribute_DAO_ContributionProduct();
@@
-913,7
+928,7
@@
INNER JOIN civicrm_contact contact ON ( contact.id = civicrm_contribution.conta
}
/**
}
/**
- * Get list of contribution fields for profile
+ * Get list of contribution fields for profile
.
* For now we only allow custom contribution fields to be in
* profile
*
* For now we only allow custom contribution fields to be in
* profile
*
@@
-922,7
+937,6
@@
INNER JOIN civicrm_contact contact ON ( contact.id = civicrm_contribution.conta
*
* @return array
* the list of contribution fields
*
* @return array
* the list of contribution fields
- * @static
*/
public static function getContributionFields($addExtraFields = TRUE) {
$contributionFields = CRM_Contribute_DAO_Contribution::export();
*/
public static function getContributionFields($addExtraFields = TRUE) {
$contributionFields = CRM_Contribute_DAO_Contribution::export();
@@
-949,9
+963,7
@@
INNER JOIN civicrm_contact contact ON ( contact.id = civicrm_contribution.conta
}
/**
}
/**
- * Add extra fields specific to contribtion
- *
- * @static
+ * Add extra fields specific to contribution.
*/
public static function getSpecialContributionFields() {
$extraFields = array(
*/
public static function getSpecialContributionFields() {
$extraFields = array(
@@
-1013,14
+1025,14
@@
GROUP BY p.id
}
/**
}
/**
- * Get list of contribution In Honor of contact Ids
+ * Get list of contribution In Honor of contact Ids
.
*
* @param int $honorId
* In Honor of Contact ID.
*
*
* @param int $honorId
* In Honor of Contact ID.
*
- * @return return the list of contribution fields
+ * @return array
+ * list of contribution fields
*
*
- * @static
*/
public static function getHonorContacts($honorId) {
$params = array();
*/
public static function getHonorContacts($honorId) {
$params = array();
@@
-1051,13
+1063,13
@@
GROUP BY p.id
}
/**
}
/**
- * Get the sort name of a contact for a particular contribution
+ * Get the sort name of a contact for a particular contribution
.
*
* @param int $id
* Id of the contribution.
*
*
* @param int $id
* Id of the contribution.
*
- * @return null|string
sort name of the contact if found
- *
@static
+ * @return null|string
+ *
sort name of the contact if found
*/
public static function sortName($id) {
$id = CRM_Utils_Type::escape($id, 'Integer');
*/
public static function sortName($id) {
$id = CRM_Utils_Type::escape($id, 'Integer');
@@
-1158,7
+1170,6
@@
WHERE civicrm_contribution.contact_id = civicrm_contact.id
*
* @return array
* contribution id if success else NULL
*
* @return array
* contribution id if success else NULL
- * static
*/
public static function checkDuplicateIds($params) {
$dao = new CRM_Contribute_DAO_Contribution();
*/
public static function checkDuplicateIds($params) {
$dao = new CRM_Contribute_DAO_Contribution();
@@
-1182,7
+1193,7
@@
WHERE civicrm_contribution.contact_id = civicrm_contact.id
}
/**
}
/**
- * Get the contribution details for component export
+ * Get the contribution details for component export
.
*
* @param int $exportMode
* Export mode.
*
* @param int $exportMode
* Export mode.
@@
-1192,7
+1203,6
@@
WHERE civicrm_contribution.contact_id = civicrm_contact.id
* @return array
* associated array
*
* @return array
* associated array
*
- * @static
*/
public static function getContributionDetails($exportMode, $componentIds) {
$paymentDetails = array();
*/
public static function getContributionDetails($exportMode, $componentIds) {
$paymentDetails = array();
@@
-1251,11
+1261,10
@@
LEFT JOIN civicrm_option_value contribution_status ON (civicrm_contribution.cont
* Create address associated with contribution record.
*
* @param array $params
* Create address associated with contribution record.
*
* @param array $params
- * An associated array.
* @param int $billingLocationTypeID
*
* @param int $billingLocationTypeID
*
- * @return
address id
- *
@static
+ * @return
int
+ *
address id
*/
public static function createAddress(&$params, $billingLocationTypeID) {
$billingFields = array(
*/
public static function createAddress(&$params, $billingLocationTypeID) {
$billingFields = array(
@@
-1286,12
+1295,11
@@
LEFT JOIN civicrm_option_value contribution_status ON (civicrm_contribution.cont
}
/**
}
/**
- * Delete billing address record related contribution
+ * Delete billing address record related contribution
.
*
* @param int $contributionId
* @param int $contactId
*
*
* @param int $contributionId
* @param int $contactId
*
- * @static
*/
public static function deleteAddress($contributionId = NULL, $contactId = NULL) {
$clauses = array();
*/
public static function deleteAddress($contributionId = NULL, $contactId = NULL) {
$clauses = array();
@@
-1336,8
+1344,8
@@
WHERE $condition
* @param string $componentName
* Event/Membership.
*
* @param string $componentName
* Event/Membership.
*
- * @return
$contributionId pending contribution id.
- *
@static
+ * @return
int
+ *
pending contribution id.
*/
public static function checkOnlinePendingContribution($componentId, $componentName) {
$contributionId = NULL;
*/
public static function checkOnlinePendingContribution($componentId, $componentName) {
$contributionId = NULL;
@@
-1391,7
+1399,13
@@
LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_
}
/**
}
/**
- * This function update contribution as well as related objects.
+ * Update contribution as well as related objects.
+ *
+ * @param array $params
+ * @param bool $processContributionObject
+ *
+ * @return array
+ * @throws \Exception
*/
public static function transitionComponents($params, $processContributionObject = FALSE) {
// get minimum required values.
*/
public static function transitionComponents($params, $processContributionObject = FALSE) {
// get minimum required values.
@@
-1593,7
+1607,7
@@
LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_
WHERE membership_id=$membership->id
ORDER BY id DESC
LIMIT 1;";
WHERE membership_id=$membership->id
ORDER BY id DESC
LIMIT 1;";
- $dao = new CRM_Core_DAO;
+ $dao = new CRM_Core_DAO
()
;
$dao->query($sql);
if ($dao->fetch()) {
if (!empty($dao->membership_type_id)) {
$dao->query($sql);
if ($dao->fetch()) {
if (!empty($dao->membership_type_id)) {
@@
-1747,7
+1761,11
@@
LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_
}
/**
}
/**
- * This function returns all contribution related object ids.
+ * Returns all contribution related object ids.
+ *
+ * @param $contributionId
+ *
+ * @return array
*/
public static function getComponentDetails($contributionId) {
$componentDetails = $pledgePayment = array();
*/
public static function getComponentDetails($contributionId) {
$componentDetails = $pledgePayment = array();
@@
-1758,6
+1776,7
@@
LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_
$query = "
SELECT c.id as contribution_id,
c.contact_id as contact_id,
$query = "
SELECT c.id as contribution_id,
c.contact_id as contact_id,
+ c.contribution_recur_id,
mp.membership_id as membership_id,
m.membership_type_id as membership_type_id,
pp.participant_id as participant_id,
mp.membership_id as membership_id,
m.membership_type_id as membership_type_id,
pp.participant_id as participant_id,
@@
-1793,6
+1812,9
@@
LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_
if ($dao->pledge_payment_id) {
$pledgePayment[] = $dao->pledge_payment_id;
}
if ($dao->pledge_payment_id) {
$pledgePayment[] = $dao->pledge_payment_id;
}
+ if ($dao->contribution_recur_id) {
+ $componentDetails['contributionRecur'] = $dao->contribution_recur_id;
+ }
}
if ($pledgePayment) {
}
if ($pledgePayment) {
@@
-1837,7
+1859,7
@@
LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_
}
/**
}
/**
- * Get individual id for onbehalf contribution
+ * Get individual id for onbehalf contribution
.
*
* @param int $contributionId
* Contribution id.
*
* @param int $contributionId
* Contribution id.
@@
-1913,7
+1935,6
@@
INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
/**
* @return array
/**
* @return array
- * @static
*/
public static function getContributionDates() {
$config = CRM_Core_Config::singleton();
*/
public static function getContributionDates() {
$config = CRM_Core_Config::singleton();
@@
-1945,11
+1966,13
@@
INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
);
}
);
}
- /*
- * Load objects relations to contribution object
+ /*
*
+ * Load objects relations to contribution object
.
* Objects are stored in the $_relatedObjects property
* In the first instance we are just moving functionality from BASEIpn -
* Objects are stored in the $_relatedObjects property
* In the first instance we are just moving functionality from BASEIpn -
- * see http://issues.civicrm.org/jira/browse/CRM-9996
+ * @see http://issues.civicrm.org/jira/browse/CRM-9996
+ *
+ * Note that the unit test for the BaseIPN class tests this function
*
* @param array $input
* Input as delivered from Payment Processor.
*
* @param array $input
* Input as delivered from Payment Processor.
@@
-1959,13
+1982,6
@@
INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
* Is Payment processor / contribution page required.
* @param bool $loadAll
* Load all related objects - even where id not passed in? (allows API to call this).
* Is Payment processor / contribution page required.
* @param bool $loadAll
* Load all related objects - even where id not passed in? (allows API to call this).
- * Note that the unit test for the BaseIPN class tests this function
- */
- /**
- * @param $input
- * @param $ids
- * @param bool $required
- * @param bool $loadAll
*
* @return bool
* @throws Exception
*
* @return bool
* @throws Exception
@@
-2125,12
+2141,12
@@
WHERE contribution_id = %1 ";
return TRUE;
}
return TRUE;
}
- /*
+ /*
*
* Create array of message information - ie. return html version, txt version, to field
*
* @param array $input
* Incoming information.
* Create array of message information - ie. return html version, txt version, to field
*
* @param array $input
* Incoming information.
- * - is_recur - should this be treated as recurring (not sure why you wouldn't
+ *
- is_recur - should this be treated as recurring (not sure why you wouldn't
* just check presence of recur object but maintaining legacy approach
* to be careful)
* @param array $ids
* just check presence of recur object but maintaining legacy approach
* to be careful)
* @param array $ids
@@
-2138,20
+2154,14
@@
WHERE contribution_id = %1 ";
* @param array $values
* Any values that may have already been compiled by calling process.
* This is augmented by values 'gathered' by gatherMessageValues
* @param array $values
* Any values that may have already been compiled by calling process.
* This is augmented by values 'gathered' by gatherMessageValues
+ * @param bool $recur
* @param bool $returnMessageText
* Distinguishes between whether to send message or return.
* message text. We are working towards this function ALWAYS returning message text & calling
* function doing emails / pdfs with it
* @param bool $returnMessageText
* Distinguishes between whether to send message or return.
* message text. We are working towards this function ALWAYS returning message text & calling
* function doing emails / pdfs with it
+ *
* @return array
* messages
* @return array
* messages
- */
- /**
- * @param $input
- * @param $ids
- * @param $values
- * @param bool $recur
- * @param bool $returnMessageText
- *
* @throws Exception
*/
public function composeMessageArray(&$input, &$ids, &$values, $recur = FALSE, $returnMessageText = TRUE) {
* @throws Exception
*/
public function composeMessageArray(&$input, &$ids, &$values, $recur = FALSE, $returnMessageText = TRUE) {
@@
-2275,26
+2285,18
@@
WHERE contribution_id = %1 ";
}
}
}
}
- /*
+ /*
*
* Gather values for contribution mail - this function has been created
* as part of CRM-9996 refactoring as a step towards simplifying the composeMessage function
* Values related to the contribution in question are gathered
*
* @param array $input
* Input into function (probably from payment processor).
* Gather values for contribution mail - this function has been created
* as part of CRM-9996 refactoring as a step towards simplifying the composeMessage function
* Values related to the contribution in question are gathered
*
* @param array $input
* Input into function (probably from payment processor).
+ * @param array $values
* @param array $ids
* @param array $ids
- * The set of ids related to the inpu
r
t.
+ * The set of ids related to the input.
*
* @return array
*
* @return array
- *
- * NB don't add direct calls to the function as we intend to change the signature
- */
- /**
- * @param $input
- * @param $values
- * @param array $ids
- *
- * @return mixed
*/
public function _gatherMessageValues($input, &$values, $ids = array()) {
// set display address of contributor
*/
public function _gatherMessageValues($input, &$values, $ids = array()) {
// set display address of contributor
@@
-2494,7
+2496,6
@@
WHERE contribution_id = %1 ";
$values['financial_type_id'] = $this->financial_type_id;
}
$values['financial_type_id'] = $this->financial_type_id;
}
-
$template->assign('trxn_id', $this->trxn_id);
$template->assign('receive_date',
CRM_Utils_Date::mysqlToIso($this->receive_date)
$template->assign('trxn_id', $this->trxn_id);
$template->assign('receive_date',
CRM_Utils_Date::mysqlToIso($this->receive_date)
@@
-2603,8
+2604,7
@@
WHERE contribution_id = %1 ";
*
* @param bool $isNotCancelled
*
*
* @param bool $isNotCancelled
*
- * @return boolean
- * @static
+ * @return bool
*/
public static function isCancelSubscriptionSupported($contributionId, $isNotCancelled = TRUE) {
$cacheKeyString = "$contributionId";
*/
public static function isCancelSubscriptionSupported($contributionId, $isNotCancelled = TRUE) {
$cacheKeyString = "$contributionId";
@@
-2629,14
+2629,13
@@
WHERE contribution_id = %1 ";
}
/**
}
/**
- * Check whether subscription is already cancelled
+ * Check whether subscription is already cancelled
.
*
* @param int $contributionId
* Contribution id.
*
* @return string
* contribution status
*
* @param int $contributionId
* Contribution id.
*
* @return string
* contribution status
- * @static
*/
public static function isSubscriptionCancelled($contributionId) {
$sql = "
*/
public static function isSubscriptionCancelled($contributionId) {
$sql = "
@@
-2654,7
+2653,7
@@
WHERE contribution_id = %1 ";
}
/**
}
/**
- * Create all financial accounts entry
+ * Create all financial accounts entry
.
*
* @param array $params
* Contribution object, line item array and params for trxn.
*
* @param array $params
* Contribution object, line item array and params for trxn.
@@
-2663,7
+2662,6
@@
WHERE contribution_id = %1 ";
* @param array $financialTrxnValues
*
* @return null|object
* @param array $financialTrxnValues
*
* @return null|object
- * @static
*/
public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) {
$skipRecords = $update = $return = $isRelatedId = FALSE;
*/
public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) {
$skipRecords = $update = $return = $isRelatedId = FALSE;
@@
-2811,7
+2809,6
@@
WHERE contribution_id = %1 ";
$params['trxnParams']['trxn_id'] = $params['prevContribution']->trxn_id;
$params['trxnParams']['status_id'] = $params['prevContribution']->contribution_status_id;
$params['trxnParams']['trxn_id'] = $params['prevContribution']->trxn_id;
$params['trxnParams']['status_id'] = $params['prevContribution']->contribution_status_id;
-
if (!(($params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatuses)
|| $params['prevContribution']->contribution_status_id == array_search('In Progress', $contributionStatuses))
&& $params['contribution']->contribution_status_id == array_search('Completed', $contributionStatuses))
if (!(($params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatuses)
|| $params['prevContribution']->contribution_status_id == array_search('In Progress', $contributionStatuses))
&& $params['contribution']->contribution_status_id == array_search('Completed', $contributionStatuses))
@@
-2850,6
+2847,7
@@
WHERE contribution_id = %1 ";
//Update contribution status
$params['trxnParams']['status_id'] = $params['contribution']->contribution_status_id;
//Update contribution status
$params['trxnParams']['status_id'] = $params['contribution']->contribution_status_id;
+ $params['trxnParams']['trxn_id'] = $params['contribution']->trxn_id;
if (!empty($params['contribution_status_id']) &&
$params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id
) {
if (!empty($params['contribution_status_id']) &&
$params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id
) {
@@
-2955,7
+2953,7
@@
WHERE contribution_id = %1 ";
}
/**
}
/**
- * Update all financial accounts entry
+ * Update all financial accounts entry
.
*
* @param array $params
* Contribution object, line item array and params for trxn.
*
* @param array $params
* Contribution object, line item array and params for trxn.
@@
-2965,7
+2963,6
@@
WHERE contribution_id = %1 ";
*
* @param null $skipTrxn
*
*
* @param null $skipTrxn
*
- * @static
*/
public static function updateFinancialAccounts(&$params, $context = NULL, $skipTrxn = NULL) {
$itemAmount = $trxnID = NULL;
*/
public static function updateFinancialAccounts(&$params, $context = NULL, $skipTrxn = NULL) {
$itemAmount = $trxnID = NULL;
@@
-3128,7
+3125,7
@@
WHERE contribution_id = %1 ";
}
/**
}
/**
- * Check status validation on update of a contribution
+ * Check status validation on update of a contribution
.
*
* @param array $values
* Previous form values before submit.
*
* @param array $values
* Previous form values before submit.
@@
-3140,7
+3137,6
@@
WHERE contribution_id = %1 ";
* List of errors.
*
* @return bool
* List of errors.
*
* @return bool
- * @static
*/
public static function checkStatusValidation($values, &$fields, &$errors) {
if (CRM_Utils_System::isNull($values) && !empty($fields['id'])) {
*/
public static function checkStatusValidation($values, &$fields, &$errors) {
if (CRM_Utils_System::isNull($values) && !empty($fields['id'])) {
@@
-3167,14
+3163,13
@@
WHERE contribution_id = %1 ";
}
/**
}
/**
- * Delete contribution of contact
+ * Delete contribution of contact
.
*
* CRM-12155
*
* @param int $contactId
* Contact id.
*
*
* CRM-12155
*
* @param int $contactId
* Contact id.
*
- * @static
*/
public static function deleteContactContribution($contactId) {
$contribution = new CRM_Contribute_DAO_Contribution();
*/
public static function deleteContactContribution($contactId) {
$contribution = new CRM_Contribute_DAO_Contribution();
@@
-3190,12
+3185,10
@@
WHERE contribution_id = %1 ";
* @see CRM_Core_DAO::buildOptions
*
* @param string $fieldName
* @see CRM_Core_DAO::buildOptions
*
* @param string $fieldName
- * @param string $context
- * : @see CRM_Core_DAO::buildOptionsContext.
- * @param array $props
- * : whatever is known about this dao object.
+ * @param string $context see CRM_Core_DAO::buildOptionsContext.
+ * @param array $props whatever is known about this dao object.
*
*
- * @return
A
rray|bool
+ * @return
a
rray|bool
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
$className = __CLASS__;
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
$className = __CLASS__;
@@
-3226,7
+3219,7
@@
WHERE contribution_id = %1 ";
}
/**
}
/**
- * Validate financial type
+ * Validate financial type
.
*
* CRM-13231
*
*
* CRM-13231
*
@@
-3236,7
+3229,6
@@
WHERE contribution_id = %1 ";
* @param string $relationName
*
* @return array|bool
* @param string $relationName
*
* @return array|bool
- * @static
*/
public static function validateFinancialType($financialTypeId, $relationName = 'Expense Account is') {
$expenseTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE '{$relationName}' "));
*/
public static function validateFinancialType($financialTypeId, $relationName = 'Expense Account is') {
$expenseTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE '{$relationName}' "));
@@
-3249,20
+3241,15
@@
WHERE contribution_id = %1 ";
}
}
- /*
- * Function to record additional payment for partial and refund contributions
+ /*
*
+ * Function to record additional payment for partial and refund contributions
.
*
* @param int $contributionId
*
* @param int $contributionId
- *
:
is the invoice contribution id (got created after processing participant payment).
- * @param array $trxnData
- *
:
to take user provided input of transaction details.
+ * is the invoice contribution id (got created after processing participant payment).
+ * @param array $trxn
s
Data
+ * to take user provided input of transaction details.
* @param string $paymentType
* 'owed' for purpose of recording partial payments, 'refund' for purpose of recording refund payments.
* @param string $paymentType
* 'owed' for purpose of recording partial payments, 'refund' for purpose of recording refund payments.
- */
- /**
- * @param int $contributionId
- * @param $trxnsData
- * @param string $paymentType
* @param int $participantId
*
* @return null|object
* @param int $participantId
*
* @return null|object
@@
-3473,7
+3460,7
@@
WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']})
}
/**
}
/**
- * Get list of payments displayed by Contribute_Page_PaymentInfo
+ * Get list of payments displayed by Contribute_Page_PaymentInfo
.
*
* @param int $id
* @param $component
*
* @param int $id
* @param $component
@@
-3606,10
+3593,18
@@
WHERE con.id = {$contributionId}
return CRM_Utils_Array::value('financial_account_id', $result);
}
return CRM_Utils_Array::value('financial_account_id', $result);
}
+ /**
+ * Check tax amount.
+ *
+ * @param array $params
+ * @param bool $isLineItem
+ *
+ * @return mixed
+ */
public static function checkTaxAmount($params, $isLineItem = FALSE) {
$taxRates = CRM_Core_PseudoConstant::getTaxRates();
public static function checkTaxAmount($params, $isLineItem = FALSE) {
$taxRates = CRM_Core_PseudoConstant::getTaxRates();
- // Update contribution
+ // Update contribution
.
if (!empty($params['id'])) {
$id = $params['id'];
$values = $ids = array();
if (!empty($params['id'])) {
$id = $params['id'];
$values = $ids = array();
@@
-3679,4
+3674,5
@@
WHERE con.id = {$contributionId}
}
return $params;
}
}
return $params;
}
+
}
}