From b9a90a9c6339972cf9f7f747b8a7124cada4961d Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 6 Sep 2016 15:42:06 +0530 Subject: [PATCH] additional fix for offline pay now --- CRM/Contribute/Form/Contribution.php | 17 ++++--- CRM/Contribute/Selector/Search.php | 6 +++ .../CRM/Contribute/Form/Contribution.tpl | 46 ++++++++++--------- 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 8d17c73030..f8f9baf8fd 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -290,9 +290,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // Set title if ($this->_mode && $this->_id) { - $this->setPageTitle(ts('Contribution (Pay Now)')); $this->_payNow = TRUE; $this->assign('payNow', $this->_payNow); + CRM_Utils_System::setTitle(ts('Pay with Credit Card')); } elseif ($this->_mode) { $this->setPageTitle($this->_ppID ? ts('Credit Card Pledge Payment') : ts('Credit Card Contribution')); @@ -550,15 +550,16 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $defaults['hidden_AdditionalDetail'] = 1; } - $paneNames = array( - ts('Additional Details') => 'AdditionalDetail', - ); + $paneNames = array(); + if (empty($this->_payNow)) { + $paneNames[ts('Additional Details')] = 'AdditionalDetail'; + } //Add Premium pane only if Premium is exists. $dao = new CRM_Contribute_DAO_Product(); $dao->is_active = 1; - if ($dao->find(TRUE)) { + if ($dao->find(TRUE) && empty($this->_payNow)) { $paneNames[ts('Premium Information')] = 'Premium'; } @@ -755,7 +756,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP ); $currencyFreeze = FALSE; - if ($this->_mode && $this->_id && ($this->_action & CRM_Core_Action::UPDATE)) { + if (!empty($this->_payNow) && ($this->_action & CRM_Core_Action::UPDATE)) { $statusElement->freeze(); $currencyFreeze = TRUE; $attributes['total_amount']['readonly'] = TRUE; @@ -869,7 +870,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // CRM-7362 --add campaigns. CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values)); - CRM_Contribute_Form_SoftCredit::buildQuickForm($this); + if (empty($this->_payNow)) { + CRM_Contribute_Form_SoftCredit::buildQuickForm($this); + } $js = NULL; if (!$this->_mode) { diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index 91cec687be..c799ad09d8 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -418,6 +418,12 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C if ($result->is_pay_later && CRM_Utils_Array::value('contribution_status_name', $row) == 'Pending') { $row['contribution_status'] .= ' (' . ts('Pay Later') . ')'; + $links[CRM_Core_Action::ADD] = array( + 'name' => ts('Pay with Credit Card'), + 'url' => 'civicrm/contact/view/contribution', + 'qs' => 'reset=1&action=update&id=%%id%%&cid=%%cid%%&context=%%cxt%%&mode=live', + 'title' => ts('Pay with Credit Card'), + ); } elseif (CRM_Utils_Array::value('contribution_status_name', $row) == 'Pending') { $row['contribution_status'] .= ' (' . ts('Incomplete Transaction') . ')'; diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index e72413b9fc..fd2ba2b433 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -86,12 +86,6 @@ {ts}(test){/ts} {/if} {help id="id-financial_type"} - - {if $contactId && $contribID && $contributionMode EQ null && $contribution_status_id eq 2} - {capture assign=payNowLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=update&id=`$contribID`&cid=`$contactId`&context=`$context`&mode=live"}{/capture} - » {ts}Pay Now{/ts} - {/if} - {if $action eq 2 and $lineItem and !$defaultContribution} @@ -187,6 +181,12 @@ {$form.contribution_status_id.html} {if $contribution_status_id eq 2}{if $is_pay_later }: {ts}Pay Later{/ts} {else}: {ts}Incomplete Transaction{/ts}{/if}{/if} + + {if $contactId && $contribID && $contributionMode EQ null && $contribution_status_id eq 2} + {capture assign=payNowLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=update&id=`$contribID`&cid=`$contactId`&context=`$context`&mode=live"}{/capture} + » {ts}Pay with Credit Card{/ts} + {/if} + {/if} @@ -234,24 +234,26 @@ {include file='CRM/Core/BillingBlockWrapper.tpl'} -
-
- {ts}Soft Credit{/ts} {help id="id-soft_credit"} -
-
- - - - -
- {include file="CRM/Contribute/Form/SoftCredit.tpl"} -
+ {if !$payNow} +
+
+ {ts}Soft Credit{/ts} {help id="id-soft_credit"} +
+
+ + + + +
+ {include file="CRM/Contribute/Form/SoftCredit.tpl"} +
+
-
+ {/if} - {if $siteHasPCPs} + {if $siteHasPCPs && !$payNow}
{ts}Personal Campaign Page{/ts} {help id="id-pcp"} @@ -353,7 +355,9 @@
{/if} -
+ {if !$payNow} +
+ {/if} {*include custom data js file*} {include file="CRM/common/customData.tpl"} -- 2.25.1