Exemplo n.º 1
0
 /**
  * computes changes of records and writes them to the logbook
  * 
  * NOTE: expects last_modified_by and last_modified_time to be set
  * properly in the $_newRecord
  * 
  * @param  Tinebase_Record_Abstract $_newRecord record from user data
  * @param  Tinebase_Record_Abstract $_curRecord record from storage
  * @param  string $_model
  * @param  string $_backend
  * @param  string $_id
  * @return Tinebase_Record_RecordSet RecordSet of Tinebase_Model_ModificationLog
  */
 public function writeModLog($_newRecord, $_curRecord, $_model, $_backend, $_id)
 {
     $commonModLog = $this->_getCommonModlog($_model, $_backend, array('last_modified_time' => $_newRecord->last_modified_time, 'last_modified_by' => $_newRecord->last_modified_by), $_id);
     $diffs = $_curRecord->diff($_newRecord);
     if (!empty($diffs) && Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' diffs: ' . print_r($diffs, TRUE));
     }
     if (!empty($diffs) && Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' curRecord: ' . print_r($_curRecord->toArray(), TRUE));
     }
     $modifications = new Tinebase_Record_RecordSet('Tinebase_Model_ModificationLog');
     $this->_loopModifications($diffs, $commonModLog, $modifications, $_curRecord->toArray(), $_curRecord->getModlogOmitFields());
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Logged ' . count($modifications) . ' modifications.');
     }
     return $modifications;
 }