CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • set default activity timeline order
Pages: [1]

Author Topic: set default activity timeline order  (Read 4255 times)

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
set default activity timeline order
August 12, 2009, 08:45:37 pm
currently, the default order for activities listed in a timeline appears to be:

> status (completed activities are bumped to the bottom)
  > date
     > name/type (?)

The order of the activities defined in the xml file has no impact on the order. That becomes a problem if you have a series of activities that don't require a reference (date) offset, but DO need to display in a specific order.

Does anyone have a creative workaround?

I propose we add a weight field to civicrm_case table, and allow an order (weight) to be set in the xml file, passed to this field. The default sort order should then be the weight field. It probably would be good to have a mechanism for changing the order through the interface, but at the very least, this would enable control over a standard use case by populating the case activities in configured order.

As a side note -- I think some of the case activities (like open case) need to be flagged as reserved, as some of them are referenced by name in the code (changing the activity label/name breaks things).

support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: set default activity timeline order
August 12, 2009, 10:27:15 pm
ok, i'm working this out -- not too bad. it's actually the civicrm_activity table that needs the weight field added.

I have the order field added to the xml and passed through to the db when the case is created. But I'm not sure how to control the default order of the activities in the case view. Any ideas?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: set default activity timeline order
August 13, 2009, 06:12:54 am

if u really want to hack this in for 2.2 / 3.0 :)

1. Add a column to the activity_type table to record the weight (this is already present since activity type reuses the option value table which has a weight)

2. edit the file: CRM/Case/BAO/Case.php, line 532 (order by clause) and include the weight after the date

However this also means that activity types are always ordered the same way irrespective of the ordering in an activity set (which makes sense most of the time)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: set default activity timeline order
August 13, 2009, 06:52:03 am
it's actually the civicrm_activity table that needs weight added.
and thanks for the tip on the order clause -- that's exactly what i needed.

so now I have it setup where there's an additional (optional) field in the xml field called <order>#</order> inside:

<ActivitySets>
  <ActivitySet>
     <ActivityTypes>
         <Activity Type>

which controls the order. The sort order actually goes by overdue date, display date, and then order. I might argue that the weight (order) should be first, as it gives people the ability to override date-based orders.

Any interest in adding this to core? Should I file an issue with my mods?
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: set default activity timeline order
August 13, 2009, 10:40:11 am
The sort order, at least in 3.0, is overdue activities first in date ascending order, followed by everything else date descending.

I don't see any issues with adding the order parameter to override the date, as long as it falls back to the current sorting if order is not present.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: set default activity timeline order
May 08, 2011, 10:11:30 pm
hey brian - did the issue/patch ever go through - just had request to reverse the date order of Activities in the Activity Summary - sounds like you have gone a useful step beyond this
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: set default activity timeline order
May 09, 2011, 03:56:29 am
no -- i never filed a patch.
i'll touch base with dgg/lobo today and then track down the code.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: set default activity timeline order
May 09, 2011, 01:48:02 pm
thanks brian - sounds like a useful addition
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: set default activity timeline order
May 09, 2011, 05:18:16 pm
Brian - So just to confirm the proposed mods:
1. Add 'weight' column to civicrm_activity - int(10), default NULL
2. And modify xml processor to write a value to that field when <order>N</order> is defined for that activity type
3. Modify order by in queries to include 'weight' first

A few notes on this ...
* What's the desired sort for activities that are added the case after it's opened? If they don't have weight assigned - they'll fall above or below the automatically created group regardless of their date / status. Is that ok?
* When an activity is edited, a new copy is made. You'll need to check whether the new weight column is cloned (assuming you want the activity to maintain it's place in the order).
* There's two different queries for case activities (both in Case/BAO/Case.php). getCaseActivityQuery is used for dashboard and Find Cases. getCaseActivity is used for the dataTable widget in the Manage Case screen.

Protect your investment in CiviCRM by  becoming a Member!

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: set default activity timeline order
May 10, 2011, 09:57:45 am
i need to dig out the implementation i did for the client, to remind myself of the specifics. but your list seems right. the order/weight is optional, and really only used to distinguish activities that are precreated by a timeline but have no date offset that would impact the order. if set, I believe the order should persist through whatever edits are made, and only change i the user is using the dynamic sort in the activity listing. the point is to allow for an "order of operation" that may be independent of the dates. or in the case of a prepopulated timeline, the order is defined (A before B), but when they are to actually take place is not.

i logged the jira issue here:
http://issues.civicrm.org/jira/browse/CRM-8069
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: set default activity timeline order
July 20, 2011, 03:38:54 am
brian - any upcoming windows you might be able to "dig out the implementation"?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: set default activity timeline order
July 21, 2011, 12:15:10 am
patches added by brian today to http://issues.civicrm.org/jira/browse/CRM-8069
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • set default activity timeline order

This forum was archived on 2017-11-26.