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

Core/dev#692 : Use url search arguments in Activity Search forms [sub-PR of #13651] #13716

Closed
wants to merge 3 commits into from

Conversation

monishdeb
Copy link
Member

Overview

This is a sub-PR of #13651. This PR extends the fix and make all possible activity search filters to be used as a url arguments on forced search using 'Find Activity' or 'Advance Search'

Before

Search arguments didn't work

After

Behavior on advanced search and 'Find Activity' search form:
after

Comments

ping @eileenmcnaughton @colemanw @lcdservices

@civibot
Copy link

civibot bot commented Feb 27, 2019

(Standard links)

@civibot civibot bot added the master label Feb 27, 2019
@monishdeb monishdeb changed the title Use url search arguments in Activity Search forms Core/dev#692 : Use url search arguments in Activity Search forms [sub-PR of #13651] Feb 27, 2019
@eileenmcnaughton
Copy link
Contributor

Can we please use the same approach on the activity form as in the grant search form which was the one where we experimented going down this track & also converting search date ranges

Note this takes 'strings' from urls - which means minimum validation so we will probably need to review from a security pov

@@ -308,14 +308,12 @@ public static function whereClauseSingle(&$values, &$query) {
}

case 'activity_tags':
$value = array_keys($value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an unrelated cleanup? we could get this change merged I guess

* @return string|array
*/
public function formatSpecialFormValue($name, $value, $dataType) {
if ($dataType == 'Date') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we should convert any date fields to datepicker first - e.g copy what was done on grant search. We don't want to build handling for the old format

@monishdeb
Copy link
Member Author

@eileenmcnaughton can we discuss this patch? About what would be the best approach to include special fields, unlucky ones which didn't find its place in Activity.getFields API result

@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Mar 11, 2019

@monishdeb OK - my mine review focus at the moment is to get the Payment.create code consolidated so I'm not digging too deep into this as yet.

But, my goal would be to break this down & pick off the ones we can convert to using the existing methodology first & then look out how to handle some others. I'm imagining that those that can't be retrieved by getfields would be merged into those that CAN be retrieved by getfields within a line or 2 of that getfields call

There is a lot in this PR - the first file touched is the Activtiy_BAO_Query so we would want any changes to that file to be in it's own PR with a unit test. I wonder why we aren't sharing handing for tags with the main tags where clause - feels like repetition

@eileenmcnaughton
Copy link
Contributor

This is pretty stale so I'm closing. I would note that the way we have been making fields url accessible is by adding them to the metadata - ie the 5 fields added to the form like this

  /**
   * Get the metadata for fields to be included on the activity search form.
   *
   * @todo ideally this would be a trait included on the activity search & advanced search
   * rather than a static function.
   */
  public static function getSearchFieldMetadata() {
    $fields = ['activity_type_id', 'activity_date_time', 'priority_id', 'activity_location'];
    $metadata = civicrm_api3('Activity', 'getfields', [])['values'];
    $metadata = array_intersect_key($metadata, array_flip($fields));
    $metadata['activity_text'] = [
      'title' => ts('Activity Text'),
      'type' => CRM_Utils_Type::T_STRING,
      'is_pseudofield' => TRUE,
    ];
    return $metadata;
  }

Are url accessible.

I took a quick look at adding tags - this would be the general approach - but it's not working yet

#14901

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants