additional fixes
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 2 Sep 2016 07:01:32 +0000 (12:31 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 2 Sep 2016 07:01:32 +0000 (12:31 +0530)
CRM/Contribute/Form/Contribution.php
CRM/Financial/BAO/FinancialAccount.php
templates/CRM/Contribute/Form/Contribution.tpl

index 78af5f2fbf72df3a59296163abfe786eb0e5152c..8d17c7303044a3c07393a5e4143a448b717a4b31 100644 (file)
@@ -291,6 +291,8 @@ 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);
     }
     elseif ($this->_mode) {
       $this->setPageTitle($this->_ppID ? ts('Credit Card Pledge Payment') : ts('Credit Card Contribution'));
@@ -1507,7 +1509,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
           $pId = $contributionDetails['participant'];
         }
       }
-      $this->_params['contribution_id'] = $this->_id;
+      if (!empty($this->_payNow)) {
+        $this->_params['contribution_id'] = $this->_id;
+      }
     }
 
     if (!$priceSetId && !empty($submittedValues['total_amount']) && $this->_id) {
index bc7994cd833b0360b2f722bb8eca4510bc4f4dce..0efbc9a542f4f015729ae1b54bde8add40f91af2 100644 (file)
@@ -378,7 +378,8 @@ LIMIT 1";
     }
     $recognitionDate = CRM_Utils_Array::value('revenue_recognition_date', $params);
     if (!(!CRM_Utils_System::isNull($recognitionDate)
-      || ($contributionID && !CRM_Utils_System::isNull($params['prevContribution']->revenue_recognition_date)))
+      || ($contributionID && isset($params['prevContribution'])
+      && !CRM_Utils_System::isNull($params['prevContribution']->revenue_recognition_date)))
     ) {
       return FALSE;
     }
index 12ba4398315ad15ceceab26c86fb1fe0259c419e..e72413b9fc58c062d402e44cf47a5aaf9ebf7d6c 100644 (file)
@@ -41,7 +41,7 @@
   {if $contributionMode}
   <div class="help">
     {if $contactId}
-      {ts 1=$displayName 2=$contributionMode|upper}Use this form to {if $contribID} edit {else} submit a new {/if} contribution on behalf of %1. <strong>A
+      {ts 1=$displayName 2=$contributionMode|upper}Use this form to {if $payNow} edit {else} submit a new {/if} contribution on behalf of %1. <strong>A
         %2 transaction will be submitted</strong> using the selected payment processor.{/ts}
     {else}
       {ts 1=$displayName 2=$contributionMode|upper}Use this form to submit a new contribution. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts}
       <td class="label">{$form.total_amount.label}</td>
       <td {$valueStyle}>
         <span id='totalAmount'>{$form.currency.html|crmAddClass:eight}&nbsp;{$form.total_amount.html|crmAddClass:eight}</span>
-        {if $hasPriceSets}
-          <span id='totalAmountORPriceSet'> {ts}OR{/ts}</span>
-          <span id='selectPriceSet'>{$form.price_set_id.html}</span>
-          <div id="priceset" class="hiddenElement"></div>
-        {/if}
+        {if !$payNow}
+          {if $hasPriceSets}
+            <span id='totalAmountORPriceSet'> {ts}OR{/ts}</span>
+            <span id='selectPriceSet'>{$form.price_set_id.html}</span>
+            <div id="priceset" class="hiddenElement"></div>
+          {/if}
 
-        {if $ppID}{ts}<a href='#' onclick='adjustPayment();'>adjust payment amount</a>{/ts}{help id="adjust-payment-amount"}{/if}
-        <div id="totalAmountBlock">
-          {if $hasPriceSets}<span class="description">{ts}Alternatively, you can use a price set.{/ts}</span>{/if}
-          <div id="totalTaxAmount" class="label"></div>
-        </div>
+          {if $ppID}{ts}<a href='#' onclick='adjustPayment();'>adjust payment amount</a>{/ts}{help id="adjust-payment-amount"}{/if}
+          <div id="totalAmountBlock">
+            {if $hasPriceSets}<span class="description">{ts}Alternatively, you can use a price set.{/ts}</span>{/if}
+            <div id="totalTaxAmount" class="label"></div>
+          </div>
+        {/if}
       </td>
     </tr>
 
-      {if $buildRecurBlock && !$contribID}
+      {if $buildRecurBlock && !$payNow}
       <tr id='recurringPaymentBlock' class='hiddenElement'>
         <td></td>
         <td>
   {* CRM-7362 --add campaign to contributions *}
   {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignTrClass="crm-contribution-form-block-campaign_id"}
 
-    {if $contributionMode && !$contribID}
+    {if $contributionMode}
     {if $email and $outBound_option != 2}
      <tr class="crm-contribution-form-block-is_email_receipt">
        <td class="label">{$form.is_email_receipt.label}</td>
       </td>
     </tr>
     {/if}
-    {if !$contributionMode || $contribID}
+    {if !$contributionMode || $payNow}
       <tr class="crm-contribution-form-block-contribution_status_id">
         <td class="label">{$form.contribution_status_id.label}</td>
         <td>{$form.contribution_status_id.html}
         </td>
       </tr>
     {/if}
-    {if $form.revenue_recognition_date && !$contribID}
+    {if $form.revenue_recognition_date && !$payNow}
       <tr class="crm-contribution-form-block-revenue_recognition_date">
         <td class="label">{$form.revenue_recognition_date.label}</td>
         <td>{$form.revenue_recognition_date.html}</td>