diff --git a/layouts/v7/modules/Reports/ScheduleReport.tpl b/layouts/v7/modules/Reports/ScheduleReport.tpl index fbf5be99ab335cb8c80f2518445c10c712cc9d2f..d60695a0c3015664f520dd5150a29772ab475006 100644 --- a/layouts/v7/modules/Reports/ScheduleReport.tpl +++ b/layouts/v7/modules/Reports/ScheduleReport.tpl @@ -163,11 +163,11 @@ </div> {/if} {if $SCHEDULEDREPORTS->get('next_trigger_time')} - <div class="col-lg-12"> + <div class="col-lg-12" style="padding:5px 0px 10px 0px;"> <div class='col-lg-3'> <span class=''>{vtranslate('LBL_NEXT_TRIGGER_TIME', $MODULE)}</span> </div> - <div class='span'> + <div class='col-lg-5'> {$SCHEDULEDREPORTS->getNextTriggerTimeInUserFormat()}<span> ({$CURRENT_USER->time_zone})</span> </div> </div> diff --git a/packages/vtiger/optional/EmailTemplates.zip b/packages/vtiger/optional/EmailTemplates.zip index 7067bee08933e07fc57493687e2390933deb1422..ed7ead222091a8cc6179a6afc2a0e412354c8fc1 100644 Binary files a/packages/vtiger/optional/EmailTemplates.zip and b/packages/vtiger/optional/EmailTemplates.zip differ diff --git a/packages/vtiger/optional/Google.zip b/packages/vtiger/optional/Google.zip index c44156b2ef0cde5e1c71ef28807ebe880966765c..1e046d6e2f75180dc633dcc58f7b215fdb1c23f5 100644 Binary files a/packages/vtiger/optional/Google.zip and b/packages/vtiger/optional/Google.zip differ diff --git a/pkg/vtiger/modules/EmailTemplates/layouts/v7/modules/EmailTemplates/DefaultContentForTemplates.tpl b/pkg/vtiger/modules/EmailTemplates/layouts/v7/modules/EmailTemplates/DefaultContentForTemplates.tpl index df728714d66e1fe9e71facbfab220659e5360069..c2f176ba48211a124d0d9898c3e050a753e39150 100644 --- a/pkg/vtiger/modules/EmailTemplates/layouts/v7/modules/EmailTemplates/DefaultContentForTemplates.tpl +++ b/pkg/vtiger/modules/EmailTemplates/layouts/v7/modules/EmailTemplates/DefaultContentForTemplates.tpl @@ -21,21 +21,6 @@ <center> <table border="0" cellpadding="0" cellspacing="0" class="borderGrey" width="600px"> <tbody> - <tr> - <td colspan="6"><!-- Begin Pre header --> - <table border="0" cellpadding="5" cellspacing="0" height="52" style="font-family: Helvetica,Verdana,sans-serif; font-size: 10px; color: rgb(102, 102, 102); background-color: rgb(232, 245, 254);" width="597"> - <tbody> - <tr> - <td> - <div>Use this area to offer a short teaser of your email's content. Text here will show in the preview area<br /> - of some email clients.</div> - </td> - <td><a href="{$VIEW_IN_BROWSER_TAG}" target="_blank">View in browser</a></td> - </tr> - </tbody> - </table> - <!-- // End Pre header \ --></td> - </tr> <tr style="height:50px;"> <td colspan="6" style="border-top: 1px solid #ddd; font-family: Helvetica,Verdana,sans-serif"></td> </tr> @@ -54,7 +39,7 @@ <tr> <td valign="top" width="350px"> <center> - <div><em>Copyright © 2014 {if !(empty($WEBSITE_URL))}<a href="{$WEBSITE_URL}" target="_blank">{$WEBSITE_URL}</a>{else}your company.com{/if}, All rights reserved.</em></div> + <div><em>Copyright © {date('Y')} {if !(empty($WEBSITE_URL))}<a href="{$WEBSITE_URL}" target="_blank">{$WEBSITE_URL}</a>{else}your company.com{/if}, All rights reserved.</em></div> </center> </td> </tr> diff --git a/pkg/vtiger/modules/Google/modules/Google/connectors/Oauth.php b/pkg/vtiger/modules/Google/modules/Google/connectors/Oauth.php index cdae95dd145ceb1bb5cf98bfaf92d94b290fa895..537440dd7fdd1412abaaa718063d31a32d60e22a 100644 --- a/pkg/vtiger/modules/Google/modules/Google/connectors/Oauth.php +++ b/pkg/vtiger/modules/Google/modules/Google/connectors/Oauth.php @@ -31,6 +31,8 @@ class Google_Oauth_Connector { protected $_oauthOptions = array( 'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER, 'version' => '1.0', + 'consumerKey' => '639253257022.apps.googleusercontent.com', + 'consumerSecret' => 'CxnOsnYx_RNyTWVfzTIenmhQ', 'signatureMethod' => 'HMAC-SHA1', 'requestTokenUrl' => 'https://www.google.com/accounts/OAuthGetRequestToken', 'userAuthorizationUrl' => 'https://www.google.com/accounts/OAuthAuthorizeToken', @@ -45,8 +47,6 @@ class Google_Oauth_Connector { self::initializeSchema(); $this->userId = $userId; $this->_oauthOptions['callbackUrl'] = $callbackUrl; - $this->_oauthOptions['consumerKey'] = VtigerConfig::getOD('GOOGLESYNC_CONSUMER_KEY'); - $this->_oauthOptions['consumerSecret'] = VtigerConfig::getOD('GOOGLESYNC_CONSUMER_SECRET'); $this->db = PearDatabase::getInstance(); } @@ -77,15 +77,15 @@ class Google_Oauth_Connector { $this->userId = Users_Record_Model::getCurrentUserModel()->getId(); if (!$accessToken && !$requestToken){ - $query = "SELECT 1 FROM vtiger_app_oauth1 WHERE userid=? and service=?"; + $query = "SELECT 1 FROM vtiger_google_oauth WHERE userid=? and service=?"; $params = array($this->userId, $service); } else if ($accessToken){ - $query = "SELECT access_token FROM vtiger_app_oauth1 WHERE userid=? and service=? AND access_token<>? AND access_token IS NOT NULL"; + $query = "SELECT access_token FROM vtiger_google_oauth WHERE userid=? and service=? AND access_token<>? AND access_token IS NOT NULL"; $params = array($this->userId, $service, ''); } else if ($requestToken){ - $query = "SELECT request_token FROM vtiger_app_oauth1 WHERE userid=? and service=? AND request_token<>? AND request_token IS NOT NULL"; + $query = "SELECT request_token FROM vtiger_google_oauth WHERE userid=? and service=? AND request_token<>? AND request_token IS NOT NULL"; $params = array($this->userId, $service, ''); } $result = $this->db->pquery($query, $params); @@ -103,10 +103,10 @@ class Google_Oauth_Connector { */ protected function storeAccessToken($service, $token) { $user = Users_Record_Model::getCurrentUserModel(); - $query = "INSERT INTO vtiger_app_oauth1(service,access_token,userid) VALUES(?,?,?)"; + $query = "INSERT INTO vtiger_google_oauth(service,access_token,userid) VALUES(?,?,?)"; $params = array($service, base64_encode(serialize($token)), $user->getid()); if (self::hasStoredToken($service, false, true)) { - $query = "UPDATE vtiger_app_oauth1 SET access_token=? WHERE userid=? AND service=?"; + $query = "UPDATE vtiger_google_oauth SET access_token=? WHERE userid=? AND service=?"; $params = array(base64_encode(serialize($token)), $user->getId(), $service); } @@ -117,7 +117,7 @@ class Google_Oauth_Connector { if(!$this->userId) $this->userId = Users_Record_Model::getCurrentUserModel()->getId(); - $query = "SELECT access_token FROM vtiger_app_oauth1 WHERE userid=? AND service =?"; + $query = "SELECT access_token FROM vtiger_google_oauth WHERE userid=? AND service =?"; $params = array($this->userId, $service); $result = $this->db->pquery($query, $params); @@ -128,10 +128,10 @@ class Google_Oauth_Connector { protected function storeRequestToken($service, $token) { $user = Users_Record_Model::getCurrentUserModel(); - $query = "DELETE FROM vtiger_app_oauth1 where service=? and userid=?"; + $query = "DELETE FROM vtiger_google_oauth where service=? and userid=?"; $this->db->pquery($query, array($service, $user->getId())); - $query = "INSERT INTO vtiger_app_oauth1(service,request_token,userid) values(?,?,?)"; + $query = "INSERT INTO vtiger_google_oauth(service,request_token,userid) values(?,?,?)"; $this->db->pquery($query, array($service, base64_encode(serialize($token)), $user->getId())); } @@ -139,7 +139,7 @@ class Google_Oauth_Connector { protected function retrieveRequestToken($service) { $user = Users_Record_Model::getCurrentUserModel(); - $query = "SELECT request_token FROM vtiger_app_oauth1 WHERE userid=? AND service =?"; + $query = "SELECT request_token FROM vtiger_google_oauth WHERE userid=? AND service =?"; $params = array($user->getId(), $service); $result = $this->db->pquery($query, $params); @@ -180,9 +180,9 @@ class Google_Oauth_Connector { public static function initializeSchema(){ - if(!Vtiger_Utils::CheckTable('vtiger_app_oauth1')) { - Vtiger_Utils::CreateTable('vtiger_app_oauth1', - '(service varchar(64),request_token text,access_token text,userid int, serviceid varchar(255), name varchar(255))',true); + if(!Vtiger_Utils::CheckTable('vtiger_google_oauth')) { + Vtiger_Utils::CreateTable('vtiger_google_oauth', + '(service varchar(64),request_token text,access_token text,userid int)',true); } } diff --git a/pkg/vtiger/modules/Google/modules/Google/connectors/Oauth2.php b/pkg/vtiger/modules/Google/modules/Google/connectors/Oauth2.php index 5b59c6456233328b378a73577cabfa005efd3cd0..58d90bf8e13c7ee75a611f16bd64fe08856ea09e 100644 --- a/pkg/vtiger/modules/Google/modules/Google/connectors/Oauth2.php +++ b/pkg/vtiger/modules/Google/modules/Google/connectors/Oauth2.php @@ -54,13 +54,14 @@ class Google_Oauth2_Connector { const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke'; public function __construct($module,$userId=false) { + global $site_URL; $this->source_module = $module; if($userId) $this->user_id = $userId; $this->service_name = $this->service_provider . $module; - $this->client_id = VtigerConfig::getOD('GOOGLE_SYNC_CLIENT_ID'); - $this->client_secret = VtigerConfig::getOD('GOOGLE_SYNC_CLIENT_SECRET'); - $this->redirect_uri = VtigerConfig::getOD('OAUTH_SERVER_URL'); - $this->scope = 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.google.com/m8/feeds https://www.googleapis.com/auth/calendar'; + $this->client_id = Google_Config_Connector::$clientId; + $this->client_secret = Google_Config_Connector::$clientSecret; + $this->redirect_uri = rtrim($site_URL, '/').'/index.php?module=Google&view=List&operation=sync&sourcemodule='.$this->source_module.'&service='.$this->service_name; + $this->scope = $this->scopes[$this->source_module]; } public function getClientId() { @@ -100,9 +101,6 @@ class Google_Oauth2_Connector { 'access_type=' . urlencode($this->access_type), 'approval_prompt=' . urlencode($this->approval_prompt), ); - if (isset($this->state)) { - $params[] = 'state=' . urlencode($this->state); - } $queryString = implode('&', $params); return self::OAUTH2_AUTH_URL . "?$queryString"; } @@ -119,8 +117,8 @@ class Google_Oauth2_Connector { public function getState($source) { global $site_URL; - $callbackUri = $site_URL . '/index.php?module=Google&view=List&operation=sync&sourcemodule=' . - $this->source_module . '&service=' . $source.'&_ignoreOnBoardCompletion=true'; + $callbackUri = rtrim($site_URL, '/') . '/index.php?module=Google&view=List&operation=sync&sourcemodule=' . + $this->source_module . '&service=' . $source; $stateDetails['url'] = $callbackUri; $parse = parse_url($site_URL); $ipAddr = getHostByName($parse['host']); @@ -183,11 +181,11 @@ class Google_Oauth2_Connector { $modulesSupported = array('Contacts', 'Calendar'); foreach($modulesSupported as $moduleName) { $params = array($this->service_provider.$moduleName,$accessToken,$refresh_token,$this->user_id); - $sql = 'INSERT INTO ' . $this->table_name . ' VALUES (' . generateQuestionMarks($params) . ')'; - $this->db->pquery($sql,$params); - } + $sql = 'INSERT INTO ' . $this->table_name . ' VALUES (' . generateQuestionMarks($params) . ')'; + $this->db->pquery($sql,$params); + } } - + protected function retreiveToken() { if(!$this->user_id) $this->user_id = Users_Record_Model::getCurrentUserModel()->getId(); $query = 'SELECT access_token,refresh_token FROM ' . $this->table_name . ' WHERE userid=? AND service =?'; @@ -232,12 +230,12 @@ class Google_Oauth2_Connector { $encodedToken = $this->fireRequest(self::OAUTH2_TOKEN_URI,array(),$params); $decodedToken = json_decode($encodedToken,true); if(!isset($decodedToken['error'])) { - $decodedToken['created'] = time(); - $token['access_token'] = $decodedToken; - $token['refresh_token'] = $this->token['refresh_token']; - $this->updateAccessToken(json_encode($decodedToken),$token['refresh_token']); - $this->setToken($token); - } + $decodedToken['created'] = time(); + $token['access_token'] = $decodedToken; + $token['refresh_token'] = $this->token['refresh_token']; + $this->updateAccessToken(json_encode($decodedToken),$token['refresh_token']); + $this->setToken($token); + } } public function authorize() { diff --git a/pkg/vtiger/modules/Google/modules/Google/helpers/Utils.php b/pkg/vtiger/modules/Google/modules/Google/helpers/Utils.php index 08da62df1432ef7887c86a2479374230739afcde..68695c71ee587ec8cd007e75301822aba80bb47e 100644 --- a/pkg/vtiger/modules/Google/modules/Google/helpers/Utils.php +++ b/pkg/vtiger/modules/Google/modules/Google/helpers/Utils.php @@ -92,7 +92,7 @@ class Google_Utils_Helper { static function getCallbackUrl($request, $options = array()) { global $site_URL; - $callback = $site_URL . "/index.php?module=" . $request['module'] . "&view=List&sourcemodule=" . $request['sourcemodule']; + $callback = rtrim($site_URL, '/') . "/index.php?module=".$request['module']."&view=List&sourcemodule=".$request['sourcemodule']; foreach ($options as $key => $value) { $callback.="&" . $key . "=" . $value; } diff --git a/pkg/vtiger/modules/Google/modules/Google/models/Contacts.php b/pkg/vtiger/modules/Google/modules/Google/models/Contacts.php index 3d06b8ffaae7a0eda1309ea69c5aa3692f87ca61..559f4e0dde023fe780508604f89a10910c4e74d8 100644 --- a/pkg/vtiger/modules/Google/modules/Google/models/Contacts.php +++ b/pkg/vtiger/modules/Google/modules/Google/models/Contacts.php @@ -195,6 +195,7 @@ class Google_Contacts_Model extends WSAPP_SyncRecordModel { $recordModel->set('mode', ''); $recordModel->set('accountname', $orgName); $recordModel->set('assigned_user_id', $userId); + $recordModel->set('source', 'GOOGLE'); if($description) { $recordModel->set('description', $description); } diff --git a/pkg/vtiger/modules/Google/modules/Google/models/Module.php b/pkg/vtiger/modules/Google/modules/Google/models/Module.php index 81173edec138529e7515cefec9a619bff9e7b639..f841028d1609e5dc2e7e4d4b246917b6e9bb0410 100755 --- a/pkg/vtiger/modules/Google/modules/Google/models/Module.php +++ b/pkg/vtiger/modules/Google/modules/Google/models/Module.php @@ -11,7 +11,7 @@ class Google_Module_Model extends Vtiger_Module_Model { public static function removeSync($module, $id) { $db = PearDatabase::getInstance(); - $query = "DELETE FROM vtiger_app_oauth1 WHERE service = ? AND userid = ?"; + $query = "DELETE FROM vtiger_google_oauth WHERE service = ? AND userid = ?"; $db->pquery($query, array($module, $id)); }