Convert filter field to datepicker
authoreileen <emcnaughton@wikimedia.org>
Tue, 19 Mar 2019 01:44:38 +0000 (14:44 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 21 Mar 2019 06:14:03 +0000 (19:14 +1300)
CRM/Activity/BAO/Activity.php
CRM/Activity/Form/ActivityFilter.php
templates/CRM/Activity/Form/Search/Common.tpl
templates/CRM/Activity/Selector/Selector.tpl
templates/CRM/Core/DatePickerRange.tpl

index 6235dfde0ed52a037219dcc36956bd1a9e869576..9fdcf31deac46c7486b30d1d9c90c8f9156fb08e 100644 (file)
@@ -2429,7 +2429,7 @@ INNER JOIN  civicrm_option_group grp ON (grp.id = option_group_id AND grp.name =
         $activityIcons[$type['value']] = $type['icon'];
       }
     }
-    CRM_Utils_Date::convertFormDateToApiFormat($params, 'activity_date_time', FALSE);
+    CRM_Utils_Date::convertFormDateToApiFormat($params, 'activity_date_time');
 
     // Get contact activities.
     $activities = CRM_Activity_BAO_Activity::getActivities($params);
index ba3c66f34081253543dafff8b0a15a88a04dde50..7b3abd0405c2b86fd9f262767243b0f8f1f5ef30 100644 (file)
@@ -42,12 +42,7 @@ class CRM_Activity_Form_ActivityFilter extends CRM_Core_Form {
 
     $this->add('select', 'activity_type_filter_id', ts('Include'), array('' => ts('- all activity type(s) -')) + $activityOptions);
     $this->add('select', 'activity_type_exclude_filter_id', ts('Exclude'), array('' => ts('- select activity type -')) + $activityOptions);
-    CRM_Core_Form_Date::buildDateRange(
-      $this, 'activity_date_time', 1,
-      '_low', '_high', ts('From:'),
-      FALSE, array(), 'searchDate',
-      FALSE, array('class' => 'crm-select2 medium')
-    );
+    $this->addDatePickerRange('activity_date_time', ts('Date'));
     $this->addSelect('status_id',
       array('entity' => 'activity', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -'))
     );
index 9df96580daab08cdba333fb9d2b70592d919c4ae..315f6cd34e153105bd63956f84365213d5e741e4 100644 (file)
@@ -90,7 +90,7 @@
 
 <tr>
   <td>
-    {include file="CRM/Core/DatePickerRange.tpl" fieldName="activity_date_time" from='_low' to='_high'}
+    {include file="CRM/Core/DatePickerRange.tpl" fieldName="activity_date_time"}
   </td>
 </tr>
 <tr>
index fc44167a6885533cea47e30ee4ae9c1a49fb3096..5ed2140dcbe9da502acb2d9e7deb06cdd24d6903 100644 (file)
@@ -29,6 +29,7 @@
     {ts}Filter by Activity{/ts}</a>
     </div><!-- /.crm-accordion-header -->
     <div class="crm-accordion-body">
+      <form><!-- form element is here to fool the datepicker widget -->
       <table class="no-border form-layout-compressed activity-search-options">
         <tr>
           <td class="crm-contact-form-block-activity_type_filter_id crm-inline-edit-field">
           <td class="crm-contact-form-block-activity_type_exclude_filter_id crm-inline-edit-field">
             {$form.activity_type_exclude_filter_id.label}<br /> {$form.activity_type_exclude_filter_id.html|crmAddClass:medium}
           </td>
-          {include file="CRM/Core/DateRange.tpl" fieldName="activity_date_time" from='_low' to='_high' label='<label>Date</label>'}
+          <td>
+            {include file="CRM/Core/DatePickerRange.tpl" fieldName="activity_date_time"}
+          </td>
           <td class="crm-contact-form-block-activity_status_filter_id crm-inline-edit-field">
             <label>{ts}Status{/ts}</label><br /> {$form.status_id.html|crmAddClass:medium}
           </td>
         </tr>
       </table>
+      </form>
     </div><!-- /.crm-accordion-body -->
   </div><!-- /.crm-accordion-wrapper -->
   <table class="contact-activity-selector-{$context} crm-ajax-table" style="width: 100%;">
index cbf512f006eae938f181d8de7e640db1913a6b42..26aca37e0edd971847c6bd23c9cbf1083aee053a 100644 (file)
@@ -25,6 +25,8 @@
 *}
 {*this is included inside a table row*}
 {assign var=relativeName   value=$fieldName|cat:"_relative"}
+{assign var='from' value=$from|default:'_low'}
+{assign var='to' value=$to|default:'_high'}
 
   {$form.$relativeName.label}<br />
   {$form.$relativeName.html}<br />