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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • CiviCRM Logging Improvements
Pages: [1]

Author Topic: CiviCRM Logging Improvements  (Read 2744 times)

polestar

  • I post frequently
  • ***
  • Posts: 162
  • Karma: 11
    • Target Integration
CiviCRM Logging Improvements
March 18, 2011, 04:25:58 pm
Hey guys,

This has been discussed briefly in a different topic in APIs Forum http://forum.civicrm.org/index.php?topic=18728

In a nutshell, so that the changes to group and tags be extracted using API, the change to a group or a tag has to be logged in the database. This requires that CiviCRM should log when a contact is added to a Group or a tag.

We have discussed that one way this can be achieved is by extending the existing civicrm_log table to have, action (create, update, delete) and id_contact fields and then populate the existing field to log the changes with civicrm_activity, civicrm_contact, civicrm_domain, civicrm_event, civicrm_participant (already there), civicrm_group_contact and civicrm_entity_tag (new to be added).

Once this is done, we will have to extend the BAO for group_contact and tag_contact to start logging the changes. (Thanks to Xavier for the valuable suggestions)

We would like to know what the opinion of the core team is and steps forward to get this implemented as soon as possible so that we can proceed further with CiviSync.

Thanks
Rohit
CiviCRM - Installation & Support | Virtual Private Servers (VPS) with Joomla/Drupal and CiviCRM | SugarCRM & vTiger CRM Installation and Support
Target Integration | www.targetintegration.com
Subscribe to Knowledgement - Your guide to effective business | http://www.knowledgement.ie

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: CiviCRM Logging Improvements
March 18, 2011, 04:48:22 pm
I did this for a client with regard to tags, but just logged the "tag added"/"tag removed" action in the log table's description field. was able to do it all with hooks. let me know if you want the code.

our solution was adequate for our needs, but I would agree that it would be useful to break out the structure into separate columns in order to improve searchability (and general data storage). the problem with the log table is that it currently accommodates contact edits and activities added to records -- and with this, would also store tags added. so it's sort of an evolving use for the table.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

polestar

  • I post frequently
  • ***
  • Posts: 162
  • Karma: 11
    • Target Integration
Re: CiviCRM Logging Improvements
March 18, 2011, 04:57:53 pm
I agree this can be achieved using hooks but would like to get this included in the core if possible.

I will take the offer for the code, it may help us get things moving quickly and by the time the improvements are made to the core. :) Will send you a PM.
CiviCRM - Installation & Support | Virtual Private Servers (VPS) with Joomla/Drupal and CiviCRM | SugarCRM & vTiger CRM Installation and Support
Target Integration | www.targetintegration.com
Subscribe to Knowledgement - Your guide to effective business | http://www.knowledgement.ie

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: CiviCRM Logging Improvements
March 18, 2011, 05:13:03 pm
no prob: http://pastebin.com/QfA2s0A1
and I agree it should be in core
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

polestar

  • I post frequently
  • ***
  • Posts: 162
  • Karma: 11
    • Target Integration
Re: CiviCRM Logging Improvements
March 26, 2011, 03:15:03 pm
Well guys, I really need to know what the thoughts are here. Even if they are not to include this in the core. Lobo, David could you please let us know what do you think.

Has anyone else other than ourselves and icdweb had a need of the feature?
CiviCRM - Installation & Support | Virtual Private Servers (VPS) with Joomla/Drupal and CiviCRM | SugarCRM & vTiger CRM Installation and Support
Target Integration | www.targetintegration.com
Subscribe to Knowledgement - Your guide to effective business | http://www.knowledgement.ie

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviCRM Logging Improvements
March 26, 2011, 10:33:06 pm
Hi,

I think this improvement is needed everytime you want to sync civicrm with an external system in one form or another. I've seen it re-developed on at least half a dozen projects, IMO that's a sign that's needed.

From a user point of view, tagging a contact is a much a contact change as modifying its email. Having one in the  change log but not the other doesn't make sense. Having them both recorded in civicrm_log and being able to parse it would be a nice improvement.

That is a different feature set than the new option to keep an history of the values saved. Both useful and that's about adding two fields in a table and adding a few calls.

I'd like to see it in the core.

@polestar are you going to write the api to log.get ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: CiviCRM Logging Improvements
March 26, 2011, 11:45:00 pm
Being able to retrieve more detailed 'last_modified' data when syncing contacts would be really useful. At the moment I query CiviCRM for contacts modified after a certain date to sync with an accounts package but more control over what 'modified' means would be great.

It would also be really useful to have this sort of 'real' log information display on the contact change log tab (and preferably log changes rather than activities when contributions are made but I'm probably out on a limb with that one.) I think when a contact was tagged / when a tag was removed is the sort of thing users expect to see on the change log tab from the feedback we get
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

polestar

  • I post frequently
  • ***
  • Posts: 162
  • Karma: 11
    • Target Integration
Re: CiviCRM Logging Improvements
March 27, 2011, 07:17:09 am
@X+
Yes we will be happy to volunteer if the directions and support is available from the team.

@Eileen
Yes that's what our experience is as well. Users would like to see when and what was changed by who.
CiviCRM - Installation & Support | Virtual Private Servers (VPS) with Joomla/Drupal and CiviCRM | SugarCRM & vTiger CRM Installation and Support
Target Integration | www.targetintegration.com
Subscribe to Knowledgement - Your guide to effective business | http://www.knowledgement.ie

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: CiviCRM Logging Improvements
March 27, 2011, 08:06:26 pm

Hey polestar:

Seems like this is essential for CiviSync. If you can achieve this via a hook, i would definitely go with that approach thus avoiding the issue of if/when it gets into core.

I think using one table to record all changes made to a contact (or its associated records like contributions / events etc) does not seem very scalable. The log table as used currently does have scale issues and we dont have an archival / compression policy either. So adding more objects while solving this issue makes the rapidly growing nature a bit worse

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: CiviCRM Logging Improvements
March 28, 2011, 12:52:46 am
@Polestar,

Then it would be useful to implement it as a separate module than civisync, so it can be enabled separately and shared among other sync services.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

polestar

  • I post frequently
  • ***
  • Posts: 162
  • Karma: 11
    • Target Integration
Re: CiviCRM Logging Improvements
March 28, 2011, 03:13:51 pm
Yes; it seems like an separate module will be the way to go.

@lobo CiviSync version 1 is still working away without the group logging functionality. it synchronises all the groups every time a sync process runs. But this will be the efficient way of doing it.

Looking at the suggestions above I think others think there is a need for this to be there in the core.

I think for now we are going to integrate this in our CMS Component/Module which is already developed to manage the API Keys and Site Key.

Until next time...
CiviCRM - Installation & Support | Virtual Private Servers (VPS) with Joomla/Drupal and CiviCRM | SugarCRM & vTiger CRM Installation and Support
Target Integration | www.targetintegration.com
Subscribe to Knowledgement - Your guide to effective business | http://www.knowledgement.ie

alanms

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Re: CiviCRM Logging Improvements
May 30, 2011, 11:46:06 am
lcdweb:- I'm a little confused, must have missed something... I tried the code you offered and it didn't work because, as far as I can tell,  hook_tags_civicrm_post doesn't exist... have I missed something? Is there some patch or extension not in the regular download or upgrade that everyone 'in the know' already uses? Or is it something you wrote for a client? (also, surely it'd be hook_civicrm_tags_post - but there's no tag related hooks listed the regular way on http://wiki.civicrm.org/confluence/display/CRMDOC40/CiviCRM+hook+specification )

polestar:- Are any of these features included in the CMS Module you released with http://civicrm.org/blogs/polestar/civisync-cms-componentmodule-released ? I can only see mention of the API key feature in the description.

Anyone:- What's the latest on this? Any progress since this discussion? I see there's still no group/tag logging in 4.0.1

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: CiviCRM Logging Improvements
May 30, 2011, 12:01:36 pm
tags is the module name
so in drupalese, that means --
implement the hook in module tags called civicrm_post
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

nickkhun23

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: CiviCRM
  • CMS version: CiviCRM
  • MySQL version: CiviCRM
  • PHP version: CiviCRM
Re: CiviCRM Logging Improvements
June 08, 2011, 01:18:50 am
Quote from: polestar on March 18, 2011, 04:57:53 pm
I agree this can be achieved using hooks but would like to get this included in the core if possible.

I will take the offer for the code, it may help us get things moving quickly and by the time the improvements are made to the core. :) Will send you a PM.
I'm totally agree with you !
Watch Kung Fu Panda 2 Online Free

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • CiviCRM Logging Improvements

This forum was archived on 2017-11-26.