/**
  * the constructor
  *
  * don't use the constructor. use the singleton 
  */
 private function __construct()
 {
     $this->_applicationName = 'Tasks';
     $this->_modelName = 'Tasks_Model_Task';
     $this->_backend = Tasks_Backend_Factory::factory(Tasks_Backend_Factory::SQL);
     $this->_recordAlarmField = 'due';
 }
예제 #2
0
 /**
  * the constructor
  *
  * don't use the constructor. use the singleton 
  */
 private function __construct()
 {
     $this->_applicationName = 'Tasks';
     $this->_modelName = 'Tasks_Model_Task';
     $this->_backend = Tasks_Backend_Factory::factory(Tasks_Backend_Factory::SQL);
     $this->_currentAccount = Tinebase_Core::getUser();
     $this->_recordAlarmField = 'due';
 }
 /**
  * Migrates Infologs from egw 1.4 to Tasks.
  * 
  * @return void
  */
 public static function MigrateInfolog2Tasks()
 {
     $tasksBackend = Tasks_Backend_Factory::factory(Tasks_Backend_Factory::SQL);
     $db = Tinebase_Core::getDb();
     $stmt = $db->query($db->select()->from('egw_infolog'));
     while ($infolog = $stmt->fetchObject()) {
         $Task = self::$_mapping;
         foreach (array('info_datemodified', 'info_datecompleted', 'info_enddate', 'info_startdate') as $datefield) {
             if ((int) $infolog->{$datefield} == 0) {
                 continue;
             }
             $infolog->{$datefield} = new Tinebase_DateTime($infolog->{$datefield});
         }
         foreach (self::$_mapping as $TaskKey => $InfoKey) {
             if (!$InfoKey) {
                 continue;
             }
             // Map fields
             if (isset($infolog->{$InfoKey})) {
                 $Task[$TaskKey] = $infolog->{$InfoKey};
             }
         }
         //$Task['identifier'] = self::id2uid($Task['identifier']);      // uid
         unset($Task['identifier']);
         $Task['class'] = self::getClass($Task['class']);
         $Task['status'] = self::getStatus($Task['status']);
         $Task['container'] = self::getOwnersContainer($infolog->info_owner);
         $Task['organizer'] = $Task['organizer'] ? $Task['organizer'] : $Task['created_by'];
         error_log(print_r($Task, true));
         try {
             $Task20 = new Tasks_Model_Task(NULL, true, true);
             $Task20->setFromArray($Task);
         } catch (Tinebase_Exception_Record_Validation $e) {
             $validation_errors = $Task20->getValidationErrors();
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug('Could not migrate Infolog with info_id ' . $infolog->info_id . "\n" . 'Tasks_Setup_MigrateFromTine14::infolog2Task: ' . $e->getMessage() . "\n" . "Tasks_Model_Task::validation_errors: \n" . print_r($validation_errors, true));
             }
             continue;
         }
         $tasksBackend->create($Task20);
     }
 }