Skip to content

Commit

Permalink
Get rid of jcalendar range in custom data
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Nov 1, 2019
1 parent f512329 commit dce4317
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions CRM/Contact/Form/Search/Criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ public static function notes(&$form) {
* Generate the custom Data Fields based for those with is_searchable = 1.
*
* @param CRM_Contact_Form_Search $form
*
* @throws \CiviCRM_API3_Exception
*/
public static function custom(&$form) {
$form->add('hidden', 'hidden_custom', 1);
Expand All @@ -624,8 +626,8 @@ public static function custom(&$form) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
if ($field['data_type'] == 'Date' && $field['is_search_range']) {
CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
if ($field['data_type'] === 'Date' && $field['is_search_range']) {
$form->addDatePickerRange($elementName, $field['label']);
}
else {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
Expand Down
4 changes: 2 additions & 2 deletions CRM/Core/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public static function addCustomFormFields(&$form, $extends) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
if ($field['data_type'] == 'Date' && $field['is_search_range']) {
CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
if ($field['data_type'] === 'Date' && $field['is_search_range']) {
$form->addDatePickerRange($elementName, $field['label']);
}
else {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, TRUE);
Expand Down
3 changes: 1 addition & 2 deletions templates/CRM/Custom/Form/Search.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
{$form.$element_name_from.html|crmAddClass:six}
  {$form.$element_name_to.label}  {$form.$element_name_to.html|crmAddClass:six}
{elseif $element.skip_calendar NEQ true }
<td class="label"><label for='{$element_name}'>{$element.label}</label>
{include file="CRM/Core/DateRange.tpl" fieldName=$element_name from='_from' to='_to'}</td><td>
{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName=$element_name}<td>
{/if}
{else}
<td class="label">{$form.$element_name.label}</td><td>
Expand Down

0 comments on commit dce4317

Please sign in to comment.