additional fix for offline pay now
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 6 Sep 2016 10:12:06 +0000 (15:42 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Tue, 6 Sep 2016 10:12:06 +0000 (15:42 +0530)
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Selector/Search.php
templates/CRM/Contribute/Form/Contribution.tpl

index 8d17c7303044a3c07393a5e4143a448b717a4b31..f8f9baf8fdcdc3052f5239b16a87918e96780985 100644 (file)
@@ -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) {
index 91cec687be25b9d03d8be4b7e7d8870e2de61610..c799ad09d8351162f19829f1cd8100169b9bf05f 100644 (file)
@@ -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') . ')';
index e72413b9fc58c062d402e44cf47a5aaf9ebf7d6c..fd2ba2b43372be2903b9e5964b16bdd40a9a47cc 100644 (file)
         {ts}(test){/ts}
       {/if} {help id="id-financial_type"}
       </td>
-      <td>
-        {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}
-          <a class="open-inline-noreturn action-item crm-hover-button" href="{$payNowLink}">&raquo; {ts}Pay Now{/ts}</a>
-        {/if}
-      </td>
     </tr>
     {if $action eq 2 and $lineItem and !$defaultContribution}
     <tr>
         <td>{$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}
         </td>
+        <td>
+        {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}
+          <a class="open-inline-noreturn action-item crm-hover-button" href="{$payNowLink}">&raquo; {ts}Pay with Credit Card{/ts}</a>
+        {/if}
+      </td>
       </tr>
     {/if}
 
   {include file='CRM/Core/BillingBlockWrapper.tpl'}
 
     <!-- start of soft credit -->
-    <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noSoftCredit}collapsed{/if}" id="softCredit">
-      <div class="crm-accordion-header">
-        {ts}Soft Credit{/ts}&nbsp;{help id="id-soft_credit"}
-      </div>
-      <div class="crm-accordion-body">
-        <table class="form-layout-compressed">
-          <tr class="crm-contribution-form-block-soft_credit_to">
-            <td colspan="2">
-              {include file="CRM/Contribute/Form/SoftCredit.tpl"}
-            </td>
-          </tr>
-        </table>
+    {if !$payNow}
+      <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noSoftCredit}collapsed{/if}" id="softCredit">
+        <div class="crm-accordion-header">
+          {ts}Soft Credit{/ts}&nbsp;{help id="id-soft_credit"}
+        </div>
+        <div class="crm-accordion-body">
+          <table class="form-layout-compressed">
+            <tr class="crm-contribution-form-block-soft_credit_to">
+              <td colspan="2">
+                {include file="CRM/Contribute/Form/SoftCredit.tpl"}
+              </td>
+            </tr>
+          </table>
+        </div>
       </div>
-    </div>
+    {/if}
     <!-- end of soft credit -->
 
     <!-- start of PCP -->
-    {if $siteHasPCPs}
+    {if $siteHasPCPs && !$payNow}
       <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noPCP}collapsed{/if}" id="softCredit">
         <div class="crm-accordion-header">
           {ts}Personal Campaign Page{/ts}&nbsp;{help id="id-pcp"}
     </div>
     {/if}
 
-  <div id="customData" class="crm-contribution-form-block-customData"></div>
+  {if !$payNow}
+    <div id="customData" class="crm-contribution-form-block-customData"></div>
+  {/if}
 
   {*include custom data js file*}
   {include file="CRM/common/customData.tpl"}