[Vtigercrm-developers] Work around to Transfer Ownership bypassing logging and event handlers

johnnyrockets johnb at newsreview.com
Thu Mar 19 23:47:34 GMT 2015


Hi all,

Is there a reason that the Transfer Ownership function doesn't call a
module's save method?  It appears to me that this bypasses quite a few
useful features in Vtiger, most notably event handlers (beforesave,
aftersave, etc) and logging (nothing shows up in the audit history).

Does anyone happen to have a workaround for this?  My objective is to track
all accounts where the "assigned_to" field has changed using the Transfer
Ownership feature so that I can then modify another system.

I suppose that I could hack the Vtiger/models/Module.php
transferRecordsOwnership method and add code to handle this.  Here is the
transferRecordOwnership method that I referred to:

public function transferRecordsOwnership($transferOwnerId,
$relatedModuleRecordIds){
    $db = PearDatabase::getInstance();
    $query = 'UPDATE vtiger_crmentity SET smownerid = ? WHERE crmid IN ('. 
generateQuestionMarks($relatedModuleRecordIds).')';
    $db->pquery($query, array($transferOwnerId,$relatedModuleRecordIds));
    
    // My custom handling could go here
}

If I did go this route, would it break future updates? 

Another option would be to add a db trigger to track when the crmentity
table smownerid changes and track changes that way.  Both options seem
equally unpalatable to me.  I'm hoping that someone might be able to shed
some light on a better solution.

Thank you all very much for your time and assistance with this.  I really
appreciate it.

John Biz



--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Work-around-to-Transfer-Ownership-bypassing-logging-and-event-handlers-tp15656.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.


More information about the vtigercrm-developers mailing list