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

URL support for some params in event search #14477

Merged
merged 1 commit into from
Jun 28, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jun 7, 2019

Overview

URL support for some params in event search -

sort_name
participant_status_id
participant_register_date_low
participant_register_date_high
participant_register_date_relative

Date format is a string of numbers YmdHIS - e.g 20180101

Before

No url param support

After

URL support for some params
sort_name
participant_status_id
participant_register_date_low
participant_register_date_high
participant_register_date_relative

Date format is a string of numbers YmdHIS - e.g 20180101

  • ie
    civicrm/event/search?reset=1&sort_name=p&participant_status_id=1&participant_register_date_low=20180101
    gives

Screen Shot 2019-06-07 at 5 25 28 PM

Technical Details

Part of a generic approach that is not widely used as yet

Comments

Utilising this approach requires field standardisation & metadata fixing - which will eventually support a move away from quickform

Docs PR is here https://github.com/civicrm/civicrm-dev-docs/issues/624

@civibot
Copy link

civibot bot commented Jun 7, 2019

(Standard links)

@civibot civibot bot added the master label Jun 7, 2019
@eileenmcnaughton eileenmcnaughton changed the title [wip] Part defaults URL support for some params in event search Jun 7, 2019
@eileenmcnaughton eileenmcnaughton force-pushed the part_defaults branch 2 times, most recently from a6d3dc0 to 5690c47 Compare June 7, 2019 06:48
@yashodha
Copy link
Contributor

yashodha commented Jun 7, 2019

test this please

@yashodha
Copy link
Contributor

@eileenmcnaughton I reckon all the search forms allow URL support for some params which may/may not be intuitive. Should we document all this somewhere (may be a related ticket) so that this is helpful for people without having to look into the code?

@eileenmcnaughton
Copy link
Contributor Author

@yashodha I guess it's a moving target - I think @monishdeb has been working on this a bit too & will continue to a bit - perhaps we just document the format it should work on - but say 'not all fields do & it might change between versions'?

@MegaphoneJon
Copy link
Contributor

test this please

@Stoob
Copy link
Contributor

Stoob commented Jun 13, 2019

I have done testing, this was the string I used.
?reset=1&sort_name=smith&participant_status_id=1&participant_register_date_low=20180101&participant_register_date_high=20190601
It appears to work but here is what could be clarified IMHO:

  • the ?reset=1 parameter is also required for these other parameters to work
  • how to use relative filters. For example "participant_register_date_relative=Today" did not work. What is the format?

@eileenmcnaughton
Copy link
Contributor Author

@Stoob reset=1 is in most urls - don't know exactly why but it seems to matter

Date format is a long string of numbers 20181908 or 20181908134500

Relative date format comes from the civicrm_option_value table - for me this (& most sites) this is the list.

How do you feel about doing a docs PR

Today this.day
This week this.week
This calendar month this.month
This quarter this.quarter
This fiscal year this.fiscal_year
This calendar year this.year
Yesterday previous.day
Previous week previous.week
Previous calendar month previous.month
Previous quarter previous.quarter
Previous fiscal year previous.fiscal_year
Previous calendar year previous.year
Last 7 days including today ending.week
Last 30 days including today ending_30.day
Last 60 days including today ending_60.day
Last 90 days including today ending_90.day
Last 12 months including today ending.year
Last 2 years including today ending_2.year
Last 3 years including today ending_3.year
Tomorrow starting.day
Next week next.week
Next calendar month next.month
Next quarter next.quarter
Next fiscal year next.fiscal_year
Next calendar year next.year
Next 7 days including today starting.week
Next 30 days including today starting.month
Next 60 days including today starting_2.month
Next 90 days including today starting.quarter
Next 12 months including today starting.year
Current week to-date current.week
Current calendar month to-date current.month
Current quarter to-date current.quarter
Current calendar year to-date current.year
To end of yesterday earlier.day
To end of previous week earlier.week
To end of previous calendar month earlier.month
To end of previous quarter earlier.quarter
To end of previous calendar year earlier.year
From start of current day greater.day
From start of current week greater.week
From start of current calendar month greater.month
From start of current quarter greater.quarter
From start of current calendar year greater.year
To end of current week less.week
To end of current calendar month less.month
To end of current quarter less.quarter
To end of current calendar year less.year
Previous 2 days previous_2.day
Previous 2 weeks previous_2.week
Previous 2 calendar months previous_2.month
Previous 2 quarters previous_2.quarter
Previous 2 calendar years previous_2.year
Day prior to yesterday previous_before.day
Week prior to previous week previous_before.week
Month prior to previous calendar month previous_before.month
Quarter prior to previous quarter previous_before.quarter
Year prior to previous calendar year previous_before.year
From end of previous week greater_previous.week
From end of previous calendar month greater_previous.month
From end of previous quarter greater_previous.quarter
From end of previous calendar year greater_previous.year

This adds url support for sort_name & participant_status_id & participant_register_date to event search

civicrm/event/search?reset=1&sort_name=p&participant_status_id=1&participant_register_date_low=20180101
@eileenmcnaughton
Copy link
Contributor Author

I've just rebased this as we just merged a contribution search url defaults fix - would be good if someone could review so we can 'keep the changes together'

@eileenmcnaughton
Copy link
Contributor Author

test this please

@seamuslee001
Copy link
Contributor

@eileenmcnaughton this seems to work mostly but i note that adding force=1 doesn't do what we want (maybe addressed in another PR). I also noticed that adding partipant_register_date_relative=this.day didn't work not using 1 instead of this.day that didn't work either

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 OK - I think those are non- blocking - I did start to have some doubts about the relative part of it so maybe we'll re-test that

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 ok to merge?

@seamuslee001
Copy link
Contributor

I'm going to merge this as the url strings suggested seem to work, noting sorting out when force=1 is used and the _relative versions still need some work

@seamuslee001 seamuslee001 merged commit 886b8ee into civicrm:master Jun 28, 2019
@seamuslee001 seamuslee001 deleted the part_defaults branch June 28, 2019 23:05
@eileenmcnaughton
Copy link
Contributor Author

thanks @seamuslee001

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.

5 participants