| Server IP : 138.197.176.125 / Your IP : 216.73.217.122 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/googleoffice365SuiteTesting/ |
Upload File : |
<?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.
************************************************************************************/
include_once 'modules/Vtiger/CRMEntity.php';
class CTGoogleSuite extends Vtiger_CRMEntity {
var $table_name = 'vtiger_ctgooglesuite';
var $table_index= 'ctgooglesuiteid';
var $customFieldTable = Array('vtiger_ctgooglesuitecf', 'ctgooglesuiteid');
var $tab_name = Array('vtiger_crmentity', 'vtiger_ctgooglesuite', 'vtiger_ctgooglesuitecf');
var $tab_name_index = Array(
'vtiger_crmentity' => 'crmid',
'vtiger_ctgooglesuite' => 'ctgooglesuiteid',
'vtiger_ctgooglesuitecf'=>'ctgooglesuiteid');
var $list_fields = Array (
'ctgooglesuite No' => Array('ctgooglesuite', 'ctgooglesuite_no'),
'Assigned To' => Array('crmentity','smownerid')
);
var $list_fields_name = Array (
'ctgooglesuite No' => 'ctgooglesuite_no',
'Assigned To' => 'assigned_user_id',
);
var $list_link_field = 'ctgooglesuite_no';
var $search_fields = Array(
'ctgooglesuite No' => Array('ctgooglesuite', 'ctgooglesuite_no'),
'Assigned To' => Array('vtiger_crmentity','assigned_user_id'),
);
var $search_fields_name = Array (
'ctgooglesuite No' => 'ctgooglesuite_no',
'Assigned To' => 'assigned_user_id',
);
var $popup_fields = Array ('ctgooglesuite_no');
var $def_basicsearch_col = 'ctgooglesuite_no';
var $def_detailview_recname = 'ctgooglesuite_no';
var $mandatory_fields = Array('ctgooglesuite_no','assigned_user_id');
var $default_order_by = 'ctgooglesuite_no';
var $default_sort_order='ASC';
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType) {
global $adb;
if($eventType == 'module.postinstall') {
self::checkWebServiceEntry();
self::installTokenGenerateFile();
// TODO Handle actions after this module is installed.
} else if($eventType == 'module.disabled') {
// TODO Handle actions before this module is being uninstalled.
} else if($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else if($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
self::installTokenGenerateFile();
} else if($eventType == 'module.postupdate') {
self::checkWebServiceEntry();
self::installTokenGenerateFile();
// TODO Handle actions after this module is updated.
}
}
static function checkWebServiceEntry() {
global $log;
$log->debug("Entering checkWebServiceEntry() method....");
global $adb;
$sql = "SELECT count(id) AS cnt FROM vtiger_ws_entity WHERE name = 'CTGoogleSuite'";
$result = $adb->query($sql);
if($adb->num_rows($result) > 0)
{
$no = $adb->query_result($result, 0, 'cnt');
if($no == 0)
{
$tabid = $adb->getUniqueID("vtiger_ws_entity");
$ws_entitySql = "INSERT INTO vtiger_ws_entity ( id, name, handler_path, handler_class, ismodule ) VALUES".
" (?, 'CTGoogleSuite','include/Webservices/VtigerModuleOperation.php', 'VtigerModuleOperation' , 1)";
$res = $adb->pquery($ws_entitySql, array($tabid));
$log->debug("Entered Record in vtiger WS entity ");
}
}
$log->debug("Exiting checkWebServiceEntry() method....");
}
static function installTokenGenerateFile() {
global $adb;
$fileArr =array('getGoogleToken');
foreach ($fileArr as $key => $filename) {
$dest1 = $filename.".php";
$source1 = "modules/CTGoogleSuite/".$filename.".php";
chmod($source1, 0777);
if (file_exists($source1)) {
copy($source1, $dest1);
chmod($dest1, 0777);
}
}
}
}
?>