Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Datepicker][REF] Convert mailing date field on mailing search screen… #15181

Conversation

seamuslee001
Copy link
Contributor

… to date picker

Overview

This converts the mailing/sms date on the unscheudled and scheduled and the find sms screens to use date picker

Before

jclander used

After

date picker used

ping @eileenmcnaughton

@civibot
Copy link

civibot bot commented Sep 1, 2019

(Standard links)

@civibot civibot bot added the master label Sep 1, 2019
@eileenmcnaughton
Copy link
Contributor

test this please

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 this works but there were a couple of things I found confusing

  1. how does this relate to advanced search? Several breakpoints later I agree the answer is 'it doesn't'

  2. I found the resulting date wrangling still pretty overdone & confusing.
    IMHO this is more readable & does the same thing. Note mysql is pretty cheerful about the format '2019-01-09 23:59:59' so I don't think we need to covert it to ISO now it's being consistently handled prior to that point (yay datepickder)

-    CRM_Contact_BAO_Query::fixDateValues($params["mailing_relative"], $params['mailing_low'], $params['mailing_high']);
+    if (!empty($params['mailing_relative'])) {
+      list($params['mailing_low'], $params['mailing_high']) = CRM_Utils_Date::getFromTo($params["mailing_relative"], $params['mailing_low'], $params['mailing_high']);
+      unset($params['mailing_relative']);
+    }
+    elseif(!empty($params['mailing_high'])) {
+      $params['mailing_high'] .= ' ' . '23:59:59';
+    }
 
     $parent = $this->controller->getParent();
     if (!empty($params)) {
@@ -133,12 +139,7 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form {
         if (isset($params[$field]) &&
           !CRM_Utils_System::isNull($params[$field])
         ) {
-          $queryParams = $params[$field];
-          if (($field == 'mailing_low' || $field == 'mailing_high') && empty($params['mailing_relative'])) {
-            $time = (strrpos($field, 'high')) ? '23:59:59' : '00:00:00';
-            $queryParams = CRM_Utils_Date::isoToMySQL($queryParams . ' ' . $time);
-          }
-          $parent->set($field, $queryParams);
+          $parent->set($field, $params[$field]);
         }

@seamuslee001 seamuslee001 force-pushed the mailing_search_date_picker_conversion branch from cf341e0 to 6de4fe3 Compare September 4, 2019 22:31
@seamuslee001
Copy link
Contributor Author

@eileenmcnaughton i have updated this with your proposed change

@eileenmcnaughton
Copy link
Contributor

Unrelated fail

@eileenmcnaughton eileenmcnaughton merged commit 2ce691d into civicrm:master Sep 5, 2019
@seamuslee001 seamuslee001 deleted the mailing_search_date_picker_conversion branch September 5, 2019 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants