From: yashodha Date: Tue, 30 Apr 2013 23:55:20 +0000 (+0530) Subject: CRM-12463 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a45a51e3eead16c27246a84cb3ea522f76853a3a;p=civicrm-core.git CRM-12463 --- 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(); + } +} +