Convert EventFees to datepicker
authorMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Fri, 19 Oct 2018 15:25:52 +0000 (16:25 +0100)
committerMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Tue, 23 Oct 2018 21:26:18 +0000 (22:26 +0100)
CRM/Event/Form/EventFees.php
templates/CRM/Event/Form/EventFees.tpl

index 30672a1d7900e7161acb79fb06c0910e4467061a..7e52f49b2ef56c89afaf1bec6377e3a0625a0b05 100644 (file)
@@ -41,6 +41,8 @@ class CRM_Event_Form_EventFees {
    * Set variables up before form is built.
    *
    * @param CRM_Core_Form $form
+   *
+   * @throws \CRM_Core_Exception
    */
   public static function preProcess(&$form) {
     //as when call come from register.php
@@ -111,7 +113,7 @@ class CRM_Event_Form_EventFees {
         $defaults[$form->_pId]['receipt_text'] = $details[$form->_eventId]['confirm_email_text'];
       }
 
-      list($defaults[$form->_pId]['receive_date'], $defaults[$form->_pId]['receive_date_time']) = CRM_Utils_Date::setDateDefaults();
+      $defaults[$form->_pId]['receive_date'] = date('Y-m-d H:i:s');
     }
 
     //CRM-11601 we should keep the record contribution
@@ -137,12 +139,6 @@ class CRM_Event_Form_EventFees {
 
       $billingDefaults = $form->getProfileDefaults('Billing', $form->_contactId);
       $defaults[$form->_pId] = array_merge($defaults[$form->_pId], $billingDefaults);
-
-      //             // hack to simplify credit card entry for testing
-      //             $defaults[$form->_pId]['credit_card_type']     = 'Visa';
-      //             $defaults[$form->_pId]['credit_card_number']   = '4807731747657838';
-      //             $defaults[$form->_pId]['cvv2']                 = '000';
-      //             $defaults[$form->_pId]['credit_card_exp_date'] = array( 'Y' => '2012', 'M' => '05' );
     }
 
     // if user has selected discount use that to set default
@@ -235,12 +231,7 @@ class CRM_Event_Form_EventFees {
                  'receive_date',
                  'total_amount',
                ) as $f) {
-        if ($f == 'receive_date') {
-          list($defaults[$form->_pId]['receive_date']) = CRM_Utils_Date::setDateDefaults($contribution->$f);
-        }
-        else {
-          $defaults[$form->_pId][$f] = $contribution->$f;
-        }
+        $defaults[$form->_pId][$f] = $contribution->$f;
       }
     }
     return $defaults[$form->_pId];
@@ -428,7 +419,7 @@ SELECT  id, html_type
           array('' => ts('- select -')) + $financialTypes
         );
 
-        $form->addDateTime('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDateTime'));
+        $form->add('datepicker', 'receive_date', ts('Received'), array(), FALSE, array('time' => TRUE));
 
         $form->add('select', 'payment_instrument_id',
           ts('Payment Method'),
index 32405421288c8d25e8b88d8015408095d1478070..580dd991cc5a2e8180cec6e23d9373a5a659a60e 100644 (file)
@@ -87,7 +87,7 @@
                 <tr class="crm-event-eventfees-form-block-total_amount"><td class="label">{$form.total_amount.label}</td><td>{$form.total_amount.html|crmMoney:$currency}</td></tr>
                 <tr>
                     <td class="label" >{$form.receive_date.label}</td>
-                    <td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
+                    <td>{$form.receive_date.html}</td>
                 </tr>
                 {if $showTransactionId }
                     <tr class="crm-event-eventfees-form-block-trxn_id"><td class="label">{$form.trxn_id.label}</td><td>{$form.trxn_id.html}</td></tr>