Ejemplo n.º 1
0
 /**
  * function to 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
  * @access public
  *
  */
 public static function add(&$params)
 {
     $contributionSoft = new CRM_Contribute_DAO_ContributionSoft();
     $contributionSoft->copyValues($params);
     // set currency for CRM-1496
     if (!isset($contributionSoft->currency)) {
         $config = CRM_Core_Config::singleton();
         $contributionSoft->currency = $config->defaultCurrency;
     }
     return $contributionSoft->save();
 }
 /**
  * function to 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
  * @access public
  *
  */
 public static function add(&$params)
 {
     $contributionSoftID = CRM_Utils_Array::value('id', $params);
     if ($contributionSoftID) {
         CRM_Utils_Hook::pre('edit', 'ContributionSoft', $contributionSoftID, $params);
     } else {
         CRM_Utils_Hook::pre('create', 'ContributionSoft', NULL, $params);
     }
     $contributionSoft = new CRM_Contribute_DAO_ContributionSoft();
     $contributionSoft->copyValues($params);
     // set currency for CRM-1496
     if (!isset($contributionSoft->currency)) {
         $config = CRM_Core_Config::singleton();
         $contributionSoft->currency = $config->defaultCurrency;
     }
     $result = $contributionSoft->save();
     if ($contributionSoftID) {
         CRM_Utils_Hook::post('edit', 'ContributionSoft', $contributionSoft->id, $contributionSoft);
     } else {
         CRM_Utils_Hook::post('create', 'ContributionSoft', $contributionSoft->id, $contributionSoft);
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  *  Function to create soft contributon with contribution record.
  *  @param array $params an associated array 
  *
  *  @return soft contribution id
  *  @static
  */
 static function addSoftContribution($params)
 {
     require_once 'CRM/Contribute/DAO/ContributionSoft.php';
     $softContribution = new CRM_Contribute_DAO_ContributionSoft();
     $softContribution->copyValues($params);
     // set currency for CRM-1496
     if (!isset($softContribution->currency)) {
         $config =& CRM_Core_Config::singleton();
         $softContribution->currency = $config->defaultCurrency;
     }
     return $softContribution->save();
 }
Ejemplo n.º 4
0
 /**
  * Add soft credit to for recurring payment.
  *
  * copy soft credit record of first recurring contribution.
  * and add new soft credit against $targetContributionId
  *
  * @param int $recurId
  * @param int $targetContributionId
  */
 public static function addrecurSoftCredit($recurId, $targetContributionId)
 {
     $soft_contribution = new CRM_Contribute_DAO_ContributionSoft();
     $soft_contribution->contribution_id = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recurId, 'id', 'contribution_recur_id');
     // Check if first recurring contribution has any associated soft credit.
     if ($soft_contribution->find(TRUE)) {
         $soft_contribution->contribution_id = $targetContributionId;
         unset($soft_contribution->id);
         $soft_contribution->save();
     }
 }
Ejemplo n.º 5
0
 /**
  *  Function to create soft contributon with contribution record.
  *  @param array $params an associated array 
  *
  *  @return soft contribution id
  *  @static
  */
 static function addSoftContribution($params)
 {
     require_once 'CRM/Contribute/DAO/ContributionSoft.php';
     $softContribution = new CRM_Contribute_DAO_ContributionSoft();
     $softContribution->copyValues($params);
     return $softContribution->save();
 }