Skip to content
Snippets Groups Projects
Commit f7bb2215 authored by Satish's avatar Satish
Browse files

Throwing warning "require_once failed to open stream no such file or directory" in Google Sync

parent d555a7e7
No related branches found
No related tags found
1 merge request!89Throwing warning "require_once failed to open stream no such file or directory" in Google Sync
No preview for this file type
<?php
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*************************************************************************************/
vimport('~~/modules/WSAPP/Handlers/vtigerCRMHandler.php');
vimport('~~/include/Webservices/Utils.php');
class Google_Vtiger_Handler extends vtigerCRMHandler {
public function put($recordDetails, $user) {
global $current_user;
$current_user = $user;
$this->user = $user;
$recordDetails = $this->syncToNativeFormat($recordDetails);
$createdRecords = $recordDetails['created'];
$updatedRecords = $recordDetails['updated'];
$deletedRecords = $recordDetails['deleted'];
if (count($createdRecords) > 0) {
$createdRecords = $this->translateReferenceFieldNamesToIds($createdRecords, $user);
$createdRecords = $this->fillNonExistingMandatoryPicklistValues($createdRecords);
$createdRecords = $this->fillMandatoryFields($createdRecords, $user);
}
foreach ($createdRecords as $index => $record) {
try {
$createdRecords[$index] = vtws_create($record['module'], $record, $this->user);
} catch (Exception $ex) {
unset($createdRecords[$index]);
continue;
}
}
if (count($updatedRecords) > 0) {
$updatedRecords = $this->translateReferenceFieldNamesToIds($updatedRecords, $user);
}
$crmIds = array();
foreach ($updatedRecords as $index => $record) {
$webserviceRecordId = $record["id"];
$recordIdComp = vtws_getIdComponents($webserviceRecordId);
$crmIds[] = $recordIdComp[1];
}
$assignedRecordIds = array();
if ($this->isClientUserSyncType()|| $this->isClientUserAndGroupSyncType()) {
$assignedRecordIds = wsapp_checkIfRecordsAssignToUser($crmIds, $this->user->id);
// To check if the record assigned to group
if($this->isClientUserAndGroupSyncType()){
$groupIds = $this->getGroupIds($this->user->id);
foreach ($groupIds as $group) {
$groupRecordId = wsapp_checkIfRecordsAssignToUser($crmIds, $group);
$assignedRecordIds = array_merge($assignedRecordIds, $groupRecordId);
}
}
// End
}
foreach ($updatedRecords as $index => $record) {
$webserviceRecordId = $record["id"];
//While Updating Vtiger Record, should not update these values for event
if($record['module'] == 'Events') {
unset($record['eventstatus']);
unset($record['activitytype']);
unset($record['duration_hours']);
}
$recordIdComp = vtws_getIdComponents($webserviceRecordId);
try {
if (in_array($recordIdComp[1], $assignedRecordIds)) {
$updatedRecords[$index] = vtws_revise($record, $this->user);
} else if (!$this->isClientUserSyncType()) {
$updatedRecords[$index] = vtws_revise($record, $this->user);
} else {
$this->assignToChangedRecords[$index] = $record;
}
} catch (Exception $e) {
unset($updatedRecords[$index]);
continue;
}
}
$hasDeleteAccess = null;
$deletedCrmIds = array();
foreach ($deletedRecords as $index => $record) {
$webserviceRecordId = $record;
$recordIdComp = vtws_getIdComponents($webserviceRecordId);
$deletedCrmIds[] = $recordIdComp[1];
}
$assignedDeletedRecordIds = wsapp_checkIfRecordsAssignToUser($deletedCrmIds, $this->user->id);
// To get record id's assigned to group of the current user
if($this->isClientUserAndGroupSyncType()){
foreach ($groupIds as $group) {
$groupRecordId = wsapp_checkIfRecordsAssignToUser($deletedCrmIds, $group);
$assignedDeletedRecordIds = array_merge($assignedDeletedRecordIds, $groupRecordId);
}
}
// End
foreach ($deletedRecords as $index => $record) {
$idComp = vtws_getIdComponents($record);
if (empty($hasDeleteAccess)) {
$handler = vtws_getModuleHandlerFromId($idComp[0], $this->user);
$meta = $handler->getMeta();
$hasDeleteAccess = $meta->hasDeleteAccess();
}
if ($hasDeleteAccess) {
if (in_array($idComp[1], $assignedDeletedRecordIds)) {
try {
vtws_delete($record, $this->user);
} catch (Exception $e) {
unset($deletedRecords[$index]);
continue;
}
}
}
}
$recordDetails['created'] = $createdRecords;
$recordDetails['updated'] = $updatedRecords;
$recordDetails['deleted'] = $deletedRecords;
return $this->nativeToSyncFormat($recordDetails);
}
}
<?php
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*************************************************************************************/
vimport('~~/modules/WSAPP/synclib/handlers/VtigerSyncEventHandler.php');
class Google_VtigerSync_Handler extends WSAPP_VtigerSyncEventHandler {
public function getSyncServerInstance(){
return new Google_SyncServer_Controller();
}
}
...@@ -51,7 +51,7 @@ class Google_List_View extends Vtiger_PopupAjax_View { ...@@ -51,7 +51,7 @@ class Google_List_View extends Vtiger_PopupAjax_View {
$oauth2 = new Google_Oauth2_Connector($sourceModule); $oauth2 = new Google_Oauth2_Connector($sourceModule);
if ($request->has('oauth_verifier')) { if ($request->has('oauth_verifier')) {
try { try {
$oauth->getHttpClient($sourceModule); $oauth2->getHttpClient($sourceModule);
} catch (Exception $e) { } catch (Exception $e) {
$viewer->assign('DENY', true); $viewer->assign('DENY', true);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment