Convert the Fullfilled Date field in preimum section on backoffice contribution from...
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 29 Mar 2019 21:13:34 +0000 (08:13 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 1 Apr 2019 04:33:54 +0000 (15:33 +1100)
Fix up defaults

CRM/Contribute/DAO/ContributionProduct.php
CRM/Contribute/Form/AdditionalInfo.php
CRM/Contribute/Form/Contribution.php
templates/CRM/Contribute/Form/AdditionalInfo/Premium.tpl
xml/schema/Contribute/ContributionProduct.xml

index 398db85756ea723e771cb6a6762200f7a531dec9..a8e344185c109ef0ce52d1049e3cf35197ed51c9 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionProduct.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:82892e993d78273218096926fa04282e)
+ * (GenCodeChecksum:b5a1b3fa2819c4dfe99635fef8583a42)
  */
 
 /**
@@ -193,6 +193,10 @@ class CRM_Contribute_DAO_ContributionProduct extends CRM_Core_DAO {
           'entity' => 'ContributionProduct',
           'bao' => 'CRM_Contribute_DAO_ContributionProduct',
           'localizable' => 0,
+          'html' => [
+            'type' => 'Select Date',
+            'formatType' => 'activityDate',
+          ],
         ],
         'contribution_start_date' => [
           'name' => 'start_date',
index ec27855294ba7f0f88ee91b4d7633f67e12ac47d..8eedeaa8d9987566eab4f4048185b910822a99b6 100644 (file)
@@ -81,7 +81,7 @@ class CRM_Contribute_Form_AdditionalInfo {
     $js .= "</script>\n";
     $form->assign('initHideBoxes', $js);
 
-    $form->addDate('fulfilled_date', ts('Fulfilled'), FALSE, array('formatType' => 'activityDate'));
+    $form->add('datepicker', 'fulfilled_date', ts('Fulfilled'), [], FALSE, array('time' => FALSE));
     $form->addElement('text', 'min_amount', ts('Minimum Contribution Amount'));
   }
 
@@ -192,7 +192,7 @@ class CRM_Contribute_Form_AdditionalInfo {
     $dao = new CRM_Contribute_DAO_ContributionProduct();
     $dao->contribution_id = $contributionID;
     $dao->product_id = $selectedProductID;
-    $dao->fulfilled_date = CRM_Utils_Date::processDate($params['fulfilled_date'], NULL, TRUE);
+    $dao->fulfilled_date = $params['fulfilled_date'];
     $isDeleted = FALSE;
 
     //CRM-11106
@@ -369,9 +369,8 @@ class CRM_Contribute_Form_AdditionalInfo {
           $params['product_option'] = $form->_options[$productDAO->id][$productOptionID];
         }
       }
-
       if (!empty($params['fulfilled_date'])) {
-        $form->assign('fulfilled_date', CRM_Utils_Date::processDate($params['fulfilled_date']));
+        $form->assign('fulfilled_date', $params['fulfilled_date']);
       }
     }
 
index cc1f6247e74f4a9c0caead1e40b62810981a9f96..8326d73c03cee3f9a5d3f3635d35d2d06340f08a 100644 (file)
@@ -412,7 +412,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
         $defaults['product_name'] = array($this->_productDAO->product_id);
       }
       if ($this->_productDAO->fulfilled_date) {
-        list($defaults['fulfilled_date']) = CRM_Utils_Date::setDateDefaults($this->_productDAO->fulfilled_date);
+        $defaults['fulfilled_date'] = $this->_productDAO->fulfilled_date;
       }
     }
 
index c5ab2ac887851d970863d33d3efdb5d277377738..351e5805c9f44e087cca036824176e78d01f9b23 100644 (file)
  +--------------------------------------------------------------------+
 *}
 {* this template is used for adding/editing Premium Information *}
- <div id="id-premium" class="section-shown crm-contribution-additionalinfo-premium-form-block">
-     <table class="form-layout-compressed">
-        <tr class="crm-contribution-form-block-product_name">
-           <td class="label">{$form.product_name.label}</td>
-     <td class="html-adjust">{$form.product_name.html}</td>
-        </tr>
-     </table>
+<div id="id-premium" class="section-shown crm-contribution-additionalinfo-premium-form-block">
+  <table class="form-layout-compressed">
+    <tr class="crm-contribution-form-block-product_name">
+      <td class="label">{$form.product_name.label}</td>
+      <td class="html-adjust">{$form.product_name.html}</td>
+    </tr>
+  </table>
 
-    <div id="premium_contri">
-        <table class="form-layout-compressed">
-    <tr class="crm-contribution-form-block-min_amount">
-             <td class="label">{$form.min_amount.label}</td>
-       <td class="html-adjust">{$form.min_amount.html|crmAddClass:'no-border'|crmMoney:$currency}</td>
-          </tr>
-        </table>
-        <div class="spacer"></div>
-    </div>
+  <div id="premium_contri">
     <table class="form-layout-compressed">
+      <tr class="crm-contribution-form-block-min_amount">
+        <td class="label">{$form.min_amount.label}</td>
+        <td class="html-adjust">{$form.min_amount.html|crmAddClass:'no-border'|crmMoney:$currency}</td>
+      </tr>
+    </table>
+    <div class="spacer"></div>
+  </div>
+  <table class="form-layout-compressed">
     <tr class="crm-contribution-form-block-fulfilled_date">
-             <td class="label">{$form.fulfilled_date.label}</td>
-       <td class="html-adjust">{include file="CRM/common/jcalendar.tpl" elementName=fulfilled_date}</td>
-          </tr>
-        </table>
+      <td class="label">{$form.fulfilled_date.label}</td>
+      <td class="html-adjust">{$form.fulfilled_date.html}</td>
+    </tr>
+  </table>
 </div>
 
-      {literal}
-        <script type="text/javascript">
-            var min_amount = document.getElementById("min_amount");
-            min_amount.readOnly = 1;
-          function showMinContrib( ) {
-               var product = document.getElementsByName("product_name[0]")[0];
-               var product_id = product.options[product.selectedIndex].value;
-               var min_amount = document.getElementById("min_amount");
-
-
-               var amount = [];
-               amount[0] = '';
-
-               if( product_id > 0 ) {
-      cj('#premium_contri').show();
-               } else {
-            cj('#premium_contri').hide();
-             }
-
-      {/literal}
-
-      var index = 1;
-      {foreach from= $mincontribution item=amt key=id}
-            {literal}amount[index]{/literal} = "{$amt}"
-            {literal}index = index + 1{/literal}
-      {/foreach}
-      {literal}
-          if(amount[product_id]) {
-              min_amount.value = amount[product_id];
-          } else {
-              min_amount.value = "";
-          }
-     }
-     </script>
-     {/literal}
-{if $action eq 1 or $action eq 2 or $action eq null }
-    <script type="text/javascript">
-       showMinContrib( );
-    </script>
+{literal}
+  <script type="text/javascript">
+    var min_amount = document.getElementById("min_amount");
+      min_amount.readOnly = 1;
+      function showMinContrib( ) {
+        var product = document.getElementsByName("product_name[0]")[0];
+        var product_id = product.options[product.selectedIndex].value;
+        var min_amount = document.getElementById("min_amount");
+        var amount = [];
+        amount[0] = '';
+        if (product_id > 0) {
+          cj('#premium_contri').show();
+        } else {
+          cj('#premium_contri').hide();
+        }
+{/literal}
+       var index = 1;
+       {foreach from= $mincontribution item=amt key=id}
+         {literal}amount[index]{/literal} = "{$amt}"
+         {literal}index = index + 1{/literal}
+       {/foreach}
+{literal}
+       if (amount[product_id]) {
+         min_amount.value = amount[product_id];
+       } else {
+         min_amount.value = "";
+      }
+    }
+  </script>
+{/literal}
+{if $action eq 1 or $action eq 2 or $action eq null}
+   <script type="text/javascript">
+    showMinContrib();
+  </script>
 {/if}
 {if $action ne 2 or $showOption eq true}
-    {$initHideBoxes}
+  {$initHideBoxes}
 {/if}
index ce6865ec5d3c832e414b3631959490d844422591..d5ff804a1009cc7e04f5368cf5f4dbaca6c61f12 100644 (file)
     <export>true</export>
     <comment>Optional. Can be used to record the date this product was fulfilled or shipped.</comment>
     <add>1.4</add>
+    <html>
+      <type>Select Date</type>
+      <formatType>activityDate</formatType>
+    </html>
   </field>
   <field>
     <name>start_date</name>