Author Topic: adding some features to contact notes  (Read 3230 times)

Offline TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
adding some features to contact notes
« on: August 20, 2010, 03:46:03 pm »
Hi,

My client is interested in adding some features to the Notes tab for contacts:
  • Support for marking a note as "private" so that only the note creator will see it.
  • Support for follow-up comments on a note; we're not looking at multi-threaded comments (meaning, not comments attached to comments, just any number of comments attached directly to a note) and probably wouldn't want that level of complexity.

This probably would not apply to notes on contributions, relationships, etc.  As far as I know, Contact is the only entity for which Civi supports multiple notes, and I would think this kind of feature would only be useful where there are multiple notes.

Also, for our purposes we don't foresee needing the APIs to support access to the note comments, though I think it makes sense for the APIs to respect any "private" flag on a note. 

I'm also not sure how the note privacy would fit in with ACLs, but since this is a per-note setting defined by the note creator, it seems that ACLs should not be used to bypass or override note privacy.

Any thoughts from the core devs (or others) on how this might or might not be useful as a core feature in a future release? 

Thanks,
TM
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

Offline 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: adding some features to contact notes
« Reply #1 on: August 21, 2010, 02:17:07 pm »

since the notes table (civicrm_notes) is shared across all objects, i suspect all objects can benefit from these changes

also just restricting the note to "creator_id" seems a bit weak. Might want to "hook" this so a module can decide what permissioning scheme u need. Might also need another permission to edit/view all notes

seems like you'll need at least two new db fields: is_private and parent_id

i suspect to get this into core we'll need to generalize this a bit. but its definitely something that folks have asked for

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

Offline TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
Re: adding some features to contact notes
« Reply #2 on: August 26, 2010, 11:16:43 am »
(Sorry, didn't realize you had replied a week ago. Email notifications seem a little spotty on the forums, eh?)


Okay, I'm looking into this a little deeper with your comments in mind.  

Using hooks to handle is_private: great idea.

Adding a parent_id column: Yes, great.  Would allow for comments to be multi-threaded (a la slashdot) and to be marked private themselves -- at least in the data structure; whether the UI wants to handle that is another question, depending on the situation.

How would you feel about us contributing some of this, so that the basic structure is there and is used in some cases, and then leave the other cases for future development?  This would mean we start off with:
  • Modify table structure and DAO to include is_private and parent_id columns
  • Add method to Notes BAO to fetch note tree.
  • Add features to Contact Notes to support creation of comments attached to notes, and marking notes as private. (Comments not multi-threaded, and comments not markable as private).
  • Create hook_civicrm_notePrivacy
  • Default to limiting is_private notes only to creator_id, but invoke hook_civicrm_notePrivacy to allow change of that.

Later, based on user demand and/or available resources, we or someone else could expand this to include UI for note comments on other entity types, API access for note comments, note comments in reports, etc.

Would this, or something very close to it, be a useful contribution?

Thanks,
TM
« Last Edit: August 26, 2010, 05:38:38 pm by TwoMice »
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

Offline TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
Re: adding some features to contact notes
« Reply #3 on: September 06, 2010, 12:23:26 pm »
For reference,  a blog entry about getting these features into CiviCRM 3.3:
http://civicrm.org/blogs/allenshaw/adding-privacy-and-comments-civicrm-notes
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.