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) »
  • DMS/CMIS (Alfresco ) Integration
Pages: [1]

Author Topic: DMS/CMIS (Alfresco ) Integration  (Read 1790 times)

ghinkel

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Joomla 2.5
  • MySQL version: 5.5
  • PHP version: 5.3
DMS/CMIS (Alfresco ) Integration
March 26, 2014, 10:05:19 am
We have a requirement to integrate civi with alfresco (via CMIS) - basically we want to use Alfresco as a central repository for all file attachments (so when you add an attachment to a case for example, the file gets saved to a document repository in Alfresco.)  I have a good bit of the CMIS code done - just not sure how to intercept civi file uploads (and reads) and redirect them to the cmis routines.  Any tips as to where to start?  (I'm fairly new to civi though I have worked with joomla a fair amount....)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: DMS/CMIS (Alfresco ) Integration
March 26, 2014, 11:39:48 am
There has been talk of this before https://civicrm.org/blog/xavier/civitimesheet and http://forum.civicrm.org/index.php?topic=8061.0
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: DMS/CMIS (Alfresco ) Integration
March 26, 2014, 03:47:37 pm
Don't want to interrupt the higher-level discussion about integration (because that's probably more important), but to answer the narrower question about file-processing events:

a) If you haven't created a Civi extension or used Civi hooks before, see documentation like http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension and http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference .

b) When one wants to intercept DB writes, the place to look is hook_civicrm_pre, hook_civicrm_post, or hook_civicrm_postSave (which is undocumented and lower-level but more consistent/predictable). This isn't quite the same as intercepting file-writes, but we keep a list of files in the DB -- anytime one uploads or deletes a file, there should be a corresponding action on the "civicrm_file" and/or "civicrm_entity_file" table (aka "CRM_Core_DAO_File" or "CRM_Core_DAO_EntityFile"). Your best bet is to write a module which implements all three hooks and then use a debugger or log-statement to inspect the data passing through.

c) For reading file attachments, Civi links to a URL like "/civicrm/file?reset=1&id=1&eid=22" (aka "CRM/Core/Page/File.php"). I don't think there are any hooks for this, but one could write a small patch to trigger a hook in CRM_Core_Page_File::run(), eg

Code: [Select]
<?php
// Write a patch to intercept reads (ie to trigger a hook during reads)
// FILE: CRM/Core/Page/File.php
class CRM_Core_Page_File ... {
  ...
  function 
run() {
   
CRM_Utils_Hook::pageRun($this);
   ...
  }
}

// Write a module which uses the intercept (ie to listen to the hook)
// FILE: myextension.php
function myextension_civicrm_pageRun(&$page) {
  if (
$page instanceof CRM_Core_Page_File) {
    
// do something different from usual
  
}
}

d) If you do write an integration, it would be great to http://wiki.civicrm.org/confluence/display/CRMDOC/Publish+an+Extension

ghinkel

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: Joomla 2.5
  • MySQL version: 5.5
  • PHP version: 5.3
Re: DMS/CMIS (Alfresco ) Integration
March 28, 2014, 07:25:37 am
thanks for the information.  I have worked with hooks before - I purposely kept the question vague to see if there was a 'better way' that I was unaware of.  You've given me a couple of excellent avenues to pursue.  If I can come up with a suitably generic solution I will definitely publish it!
Thanks again 

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • DMS/CMIS (Alfresco ) Integration

This forum was archived on 2017-11-26.