From a45a51e3eead16c27246a84cb3ea522f76853a3a Mon Sep 17 00:00:00 2001 From: yashodha Date: Wed, 1 May 2013 05:25:20 +0530 Subject: [PATCH] CRM-12463 --- CRM/Contribute/BAO/ContributionSoft.php | 96 +++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 CRM/Contribute/BAO/ContributionSoft.php diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php new file mode 100644 index 0000000000..6fbae9f6a6 --- /dev/null +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -0,0 +1,96 @@ +copyValues($params); + return $contributionSoft->save(); + } + + /** + * 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 + * + * @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 + * @access public + * @static + */ + static function retrieve(&$params, &$defaults) { + $contributionSoft = new CRM_Contribute_DAO_ContributionSoft(); + $contributionSoft->copyValues($params); + if ($contributionSoft->find(TRUE)) { + CRM_Core_DAO::storeValues($contributionSoft, $defaults); + return $contributionSoft; + } + return NULL; + } + + /** + * Function to delete soft credits + * + * @param int $contributionTypeId + * @static + */ + static function del($contributionID) { + //delete from contribution soft table + $contributionSoft = new CRM_Contribute_DAO_ContributionSoft(); + $contributionSoft->id = $contributionID; + $contributionSoft->delete(); + } +} + -- 2.25.1