<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
}
// Handle soft credit and / or link to personal campaign page
- list($type, $softIDs) = CRM_Contribute_BAO_ContributionSoft::getSoftCreditType($contribution->id);
+ $softIDs = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id);
+
+ //Delete PCP against this contribution and create new on submitted PCP information
+ $pcpId = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id, TRUE);
+ if ($pcpId) {
+ $deleteParams = array('id' => $pcpId);
+ CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
+ }
if ($pcp = CRM_Utils_Array::value('pcp', $params)) {
- if (!empty($type) && $type == 'soft') {
- $deleteParams = array('contribution_id' => $contribution->id);
- CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
- }
$softParams = array();
$softParams['contribution_id'] = $contribution->id;
$softParams['pcp_id'] = $pcp['pcp_made_through_id'];
$softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
CRM_Contribute_BAO_ContributionSoft::add($softParams);
}
- elseif (isset($params['soft_credit'])) {
+ if (isset($params['soft_credit'])) {
$softParams = $params['soft_credit'];
if (!empty($softIDs)) {
'headerPattern' => '/^honor_contact_email$/i',
'where' => 'honor_email.email',
),
- 'honor_contact_id' => array(
- 'name' => 'honor_contact_id',
- 'title' => 'Honor Contact ID',
- 'headerPattern' => '/^honor_contact_id$/i',
- 'where' => 'civicrm_contribution.honor_contact_id',
- ),
- 'honor_type_label' => array(
- 'name' => 'honor_type_label',
- 'title' => 'Honor Type Label',
- 'headerPattern' => '/^honor_type_label$/i',
- 'where' => 'honor_type.label',
- ),
'contribution_soft_credit_name' => array(
'name' => 'contribution_soft_credit_name',
'title' => 'Soft Credit Name',
$dates['end_date'],
$dates['join_date'],
'today',
- TRUE
+ TRUE,
+ $membership->membership_type_id,
+ (array) $membership
);
$formattedParams = array(