Exemplo n.º 1
0
// SalesPlatform.ru end
//Handle migration for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7552--senotesrel
$seDeleteQuery = "DELETE from vtiger_senotesrel WHERE crmid NOT IN(select crmid from vtiger_crmentity)";
Migration_Index_View::ExecuteQuery($seDeleteQuery, array());
$seNotesSql = "ALTER TABLE vtiger_senotesrel ADD CONSTRAINT fk1_crmid FOREIGN KEY(crmid) REFERENCES vtiger_crmentity(crmid) ON DELETE CASCADE";
Migration_Index_View::ExecuteQuery($seNotesSql, array());
//Update uitype of created_user_id field of vtiger_field from 53 to 52
$updateQuery = "UPDATE vtiger_field SET uitype = 52 WHERE fieldname = 'created_user_id'";
Migration_Index_View::ExecuteQuery($updateQuery, array());
/*141*/
//registering handlers for Google sync
require_once 'includes/main/WebUI.php';
require_once 'modules/WSAPP/Utils.php';
require_once 'modules/Google/connectors/Config.php';
wsapp_RegisterHandler('Google_vtigerHandler', 'Google_Vtiger_Handler', 'modules/Google/handlers/Vtiger.php');
wsapp_RegisterHandler('Google_vtigerSyncHandler', 'Google_VtigerSync_Handler', 'modules/Google/handlers/VtigerSync.php');
//updating Google Sync Handler names
$db = PearDatabase::getInstance();
$names = array('Vtiger_GoogleContacts', 'Vtiger_GoogleCalendar');
$result = $db->pquery("SELECT stateencodedvalues FROM vtiger_wsapp_sync_state WHERE name IN (" . generateQuestionMarks($names) . ")", array($names));
$resultRows = $db->num_rows($result);
$appKey = array();
for ($i = 0; $i < $resultRows; $i++) {
    $stateValuesJson = $db->query_result($result, $i, 'stateencodedvalues');
    $stateValues = Zend_Json::decode(decode_html($stateValuesJson));
    $appKey[] = $stateValues['synctrackerid'];
}
if (!empty($appKey)) {
    $sql = 'UPDATE vtiger_wsapp SET name = ? WHERE appkey IN (' . generateQuestionMarks($appKey) . ')';
    $res = Migration_Index_View::ExecuteQuery($sql, array('Google_vtigerSyncHandler', $appKey));
}
Exemplo n.º 2
0
 function registerSynclibEventHandler()
 {
     $className = 'WSAPP_VtigerSyncEventHandler';
     $path = 'modules/WSAPP/synclib/handlers/VtigerSyncEventHandler.php';
     $type = 'vtigerSyncLib';
     wsapp_RegisterHandler($type, $className, $path);
 }