From 00a1afe2ee602240062e3434e64c1593875d5eff Mon Sep 17 00:00:00 2001 From: monishdeb Date: Sat, 5 Apr 2014 19:13:28 +0530 Subject: [PATCH] CRM-14377 minor fix and improvement in SC and PCP panes in Contribution Form ---------------------------------------- * CRM-14377: http://issues.civicrm.org/jira/browse/CRM-14377 --- CRM/Contribute/Form/ContributionView.php | 6 ++++-- CRM/Contribute/Form/SoftCredit.php | 7 +++++++ templates/CRM/Contribute/Form/Contribution.tpl | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index f003909004..23e08dd5b8 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -118,8 +118,10 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { //assign soft credit record if exists. $SCRecords = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($values['contribution_id'], TRUE); - $this->assign('softContributions', $SCRecords['soft_credit']); - unset($SCRecords['soft_credit']); + if (!empty($SCRecords['soft_credit'])) { + $this->assign('softContributions', $SCRecords['soft_credit']); + unset($SCRecords['soft_credit']); + } //assign pcp record if exists foreach ($SCRecords as $name => $value) { diff --git a/CRM/Contribute/Form/SoftCredit.php b/CRM/Contribute/Form/SoftCredit.php index 53e1574f07..9d4d2a628d 100644 --- a/CRM/Contribute/Form/SoftCredit.php +++ b/CRM/Contribute/Form/SoftCredit.php @@ -160,7 +160,10 @@ class CRM_Contribute_Form_SoftCredit { * Function used to set defaults for soft credit block */ static function setDefaultValues(&$defaults, &$form) { + //Used to hide/unhide PCP and/or Soft-credit Panes + $noPCP = $noSoftCredit = TRUE; if (!empty($form->_softCreditInfo['soft_credit'])) { + $noSoftCredit = FALSE; foreach ($form->_softCreditInfo['soft_credit'] as $key => $value) { $defaults["soft_credit_amount[$key]"] = CRM_Utils_Money::format($value['amount'], NULL, '%a'); $defaults["soft_credit_contact_id[$key]"] = $value['contact_id']; @@ -168,6 +171,7 @@ class CRM_Contribute_Form_SoftCredit { } } if (!empty($form->_softCreditInfo['pcp_id'])) { + $noPCP = FALSE; $pcpInfo = $form->_softCreditInfo; $pcpId = CRM_Utils_Array::value('pcp_id', $pcpInfo); $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'title'); @@ -178,6 +182,9 @@ class CRM_Contribute_Form_SoftCredit { $defaults['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcpInfo); $defaults['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcpInfo); } + + $form->assign('noSoftCredit', $noSoftCredit); + $form->assign('noPCP', $noPCP); } /** diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index 3940f61734..d546be3940 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -223,7 +223,7 @@ -
+
{ts}Soft Credit{/ts} {help id="id-soft_credit"}
@@ -241,7 +241,7 @@ {if $siteHasPCPs} -
+
{ts}Personal Campaign Page{/ts} {help id="id-pcp"}
-- 2.25.1