mergeconflich resolved

This commit is contained in:
jennydmz
2015-11-27 16:32:44 -04:00
49 changed files with 3516 additions and 84 deletions

View File

@@ -29,7 +29,8 @@
"underscore/underscore": "1.5.2",
"colosa/pmUI": "dev-master",
"colosa/MichelangeloFE": "dev-master",
"colosa/pmdynaform": "dev-master"
"colosa/pmdynaform": "dev-master",
"google/apiclient": "1.1.*"
},
"require-dev":{
"guzzle/guzzle":"~3.1.1",

View File

@@ -2301,14 +2301,26 @@ class Cases
$sAction = '';
break;
}
$aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction
);
if(array_key_exists('gmail',$_SESSION) || (array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1)){
$aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction .
'&gmail=1'
);
} else{
$aNextStep = array(
'TYPE' => $oStep->getStepTypeObj(),
'UID' => $oStep->getStepUidObj(),
'POSITION' => $oStep->getStepPosition(),
'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' .
$oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() .
'&ACTION=' . $sAction
);
}
$iPosition = $iLastStep;
}
}
@@ -2316,12 +2328,21 @@ class Cases
}
}
if (!$aNextStep) {
$aNextStep = array(
'TYPE' => 'DERIVATION',
'UID' => -1,
'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'
);
if(array_key_exists('gmail',$_SESSION) || (array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1)){
$aNextStep = array(
'TYPE' => 'DERIVATION',
'UID' => -1,
'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN&gmail=1'
);
}else {
$aNextStep = array(
'TYPE' => 'DERIVATION',
'UID' => -1,
'POSITION' => ($iLastStep + 1),
'PAGE' => 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'
);
}
}
return $aNextStep;
} catch (exception $e) {
@@ -3605,6 +3626,16 @@ class Cases
'APP_DOC_FILENAME' => 'char',
'APP_DOC_INDEX' => 'integer'
);
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
while ($aRow = $oDataset->getRow()) {
$aAux = $oAppDocument->load($aRow['APP_DOC_UID'], $aRow['DOC_VERSION']);
$lastVersion = $oAppDocument->getLastAppDocVersion($aRow['APP_DOC_UID'], $sApplicationUID);
@@ -3664,6 +3695,15 @@ class Cases
}
}
$aFields['COMMENT'] = $aFields['APP_DOC_COMMENT'];
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aRow['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('INPUT',
$driveDownload) && $enablePMGmail
) {
$aFields['DOWNLOAD_LINK'] = $driveDownload['INPUT'];
}
/*----------------------------------********---------------------------------*/
if (($aRow['DOC_VERSION'] == $lastVersion) || ($sAppDocuUID != "")) {
$aInputDocuments[] = $aFields;
}
@@ -3888,6 +3928,93 @@ class Cases
$strPathName = PATH_DOCUMENT . G::getPathFromUID($applicationUid) . PATH_SEP;
$strFileName = $appDocUid . "_" . $docVersion . "." . $extension;
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
if ($pmDrive->getStatusService()) {
$app = new Application();
$user = new Users();
$dataUser = $user->load($userUid);
$pmDrive->setDriveUser($dataUser['USR_EMAIL']);
$appData = $app->Load($applicationUid);
if ($appData['APP_DRIVE_FOLDER_UID'] == null) {
$process = new Process();
$process->setProUid($appData['PRO_UID']);
$result = $pmDrive->createFolder($process->getProTitle() . ' - ' . G::LoadTranslation("ID_CASE") . ' #' . $appData['APP_NUMBER'],
$pmDrive->getFolderIdPMDrive($userUid));
$appData['APP_DRIVE_FOLDER_UID'] = $result->id;
$app->update($appData);
}
$result = $pmDrive->uploadFile('application/' . $extension, $fileTmpName, $file,
$appData['APP_DRIVE_FOLDER_UID']);
$appDocument->setDriveDownload('INPUT', $result->webContentLink);
$fileIdDrive = $result->id;
$arrayField['DOC_VERSION'] = $docVersion;
$arrayField['APP_DOC_UID'] = $appDocUid;
$appDocument->update($arrayField);
//add permissions
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(ApplicationPeer::PRO_UID);
$criteria->addSelectColumn(TaskUserPeer::TAS_UID);
$criteria->addSelectColumn(TaskUserPeer::USR_UID);
$criteria->addSelectColumn(TaskUserPeer::TU_RELATION);
$criteria->add(ApplicationPeer::APP_UID, $applicationUid);
$criteria->addJoin(ApplicationPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN);
$dataset = ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$userPermission = array();
while ($dataset->next()) {
$row = $dataset->getRow();
if ($row['TU_RELATION'] == 1) {
//users
$dataUser = $user->load($row['USR_UID']);
if (array_search($dataUser['USR_EMAIL'], $userPermission) === false) {
$objectPermissions = $this->getAllObjects($row['PRO_UID'], $applicationUid, $row['TAS_UID'],
$row['USR_UID']);
$userPermission[] = $dataUser['USR_EMAIL'];
}
} else {
//Groups
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
$criteria->addSelectColumn(UsersPeer::USR_UID);
$criteria->add(GroupUserPeer::GRP_UID, $row['USR_UID']);
$criteria->addJoin(GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$oDataset = AppDelegationPeer::doSelectRS($criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($oDataset->next()) {
$aRow = $oDataset->getRow();
if (array_search($aRow['USR_EMAIL'], $userPermission) === false) {
$objectPermissions = $this->getAllObjects($row['PRO_UID'], $applicationUid,
$row['TAS_UID'], $aRow['USR_UID']);
$userPermission[] = $aRow['USR_EMAIL'];
}
}
}
}
$userPermission = array_unique($userPermission);
foreach ($userPermission as $key => $val) {
$pmDrive->setPermission($appData['APP_DRIVE_FOLDER_UID'], $val, 'user', 'writer');
$pmDrive->setPermission($fileIdDrive, $val);
}
}
}
/*----------------------------------********---------------------------------*/
switch ($option) {
case "xmlform":
G::uploadFile($fileTmpName, $strPathName, $strFileName);
@@ -4570,6 +4697,15 @@ class Cases
'APP_DOC_FILENAME' => 'char', 'APP_DOC_INDEX' => 'integer'
);
$oUser = new Users();
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
while ($aRow = $oDataset->getRow()) {
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(AppDelegationPeer::APP_UID, $sApplicationUID);
@@ -4630,6 +4766,15 @@ class Cases
}
}
}
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aRow['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('INPUT',
$driveDownload) && $enablePMGmail
) {
$aFields['DOWNLOAD_LINK'] = $driveDownload['INPUT'];
}
/*----------------------------------********---------------------------------*/
if ($lastVersion == $aRow['DOC_VERSION']) {
//Show only last version
$aInputDocuments[] = $aFields;
@@ -4707,6 +4852,15 @@ class Cases
$aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_DOWNLOAD');
$aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . $aRow['APP_DOC_UID'];
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aRow['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('ATTACHED',
$driveDownload) && $enablePMGmail
) {
$aFields['DOWNLOAD_LINK'] = $driveDownload['ATTACHED'];
}
/*----------------------------------********---------------------------------*/
if ($lastVersion == $aRow['DOC_VERSION']) {
//Show only last version
$aInputDocuments[] = $aFields;
@@ -4774,6 +4928,15 @@ class Cases
}
}
}
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aRow['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('INPUT',
$driveDownload) && $enablePMGmail
) {
$aFields['DOWNLOAD_LINK'] = $driveDownload['INPUT'];
}
/*----------------------------------********---------------------------------*/
if ($lastVersion == $aRow['DOC_VERSION']) {
//Show only last version
$aInputDocuments[] = $aFields;
@@ -4881,6 +5044,15 @@ class Cases
'APP_DOC_INDEX' => 'integer'
);
$oUser = new Users();
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
while ($aRow = $oDataset->getRow()) {
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(AppDelegationPeer::APP_UID, $sApplicationUID);
@@ -4984,6 +5156,21 @@ class Cases
$firstDocLabel = $fileDocLabel;
}
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aAux['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('OUTPUT_DOC',
$driveDownload) && $enablePMGmail
) {
$fileDoc = $driveDownload['OUTPUT_DOC'];
}
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('OUTPUT_PDF',
$driveDownload) && $enablePMGmail
) {
$filePdf = $driveDownload['OUTPUT_PDF'];
}
/*----------------------------------********---------------------------------*/
$aFields = array(
'APP_DOC_UID' => $aAux['APP_DOC_UID'],
'DOC_UID' => $aAux['DOC_UID'],

View File

@@ -0,0 +1,211 @@
<?php
class labelsGmail
{
function listLabels($service)
{
$labels = array();
try {
$labelsResponse = $service->users_labels->listUsersLabels('me');
if ($labelsResponse->getLabels()) {
$labels = array_merge($labels, $labelsResponse->getLabels());
}
} catch (Exception $e) {
print 'An error occurred: ' . $e->getMessage();
}
return $labels;
}
/**
* Modify the Labels a Message is associated with.
*
* @param Google_Service_Gmail $service Authorized Gmail API instance.
* @param string $userId User's email address. The special value 'me'
* can be used to indicate the authenticated user.
* @param string $messageId ID of Message to modify.
* @param array $labelsToAdd Array of Labels to add.
* @param array $labelsToRemove Array of Labels to remove.
*/
function modifyMessage($service, $userId, $messageId, $labelsToAdd, $labelsToRemove) {
$mods = new Google_Service_Gmail_ModifyMessageRequest();
$mods->setAddLabelIds($labelsToAdd);
$mods->setRemoveLabelIds($labelsToRemove);
try {
$message = $service->users_messages->modify($userId, $messageId, $mods);
} catch (Exception $e) {
print 'An error occurred: ' . $e->getMessage();
}
}
/**
* Get list of Messages in user's mailbox.
*
* @param Google_Service_Gmail $service Authorized Gmail API instance.
* @param string $userId User's email address. The special value 'me'
* can be used to indicate the authenticated user.
* @return array Array of Messages.
*/
function listMessages($service, $userId, $query, $labels) {
$pageToken = NULL;
$messages = array();
$opt_param = array();
do {
try {
if ($pageToken) {
$opt_param['pageToken'] = $pageToken;
}
$opt_param['labelIds'] = $labels;
$opt_param['q'] = $query;
$opt_param['maxResults'] = 3;
$messagesResponse = $service->users_messages->listUsersMessages($userId, $opt_param);
if ($messagesResponse->getMessages()) {
$messages = array_merge($messages, $messagesResponse->getMessages());
}
} catch (Exception $e) {
print 'An error occurred: ' . $e->getMessage();
}
} while ($pageToken);
return $messages;
}
function setLabels($caseId, $index, $actualLastIndex, $unassigned=false){
//First getting the actual thread data
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$appData = $Pmgmail->getDraftApp($caseId, $index);
foreach ($appData as $application){
$appNumber = $application['APP_NUMBER'];
$index = $application['DEL_INDEX'];
$threadUsr = $application['USR_UID'];
$proName = $application['APP_PRO_TITLE'];
$threadStatus = $application['DEL_THREAD_STATUS'];
}
if($threadStatus == 'CLOSED' || $unassigned == true){
//Getting the privious User email
$oUsers = new \Users();
$usrData = $oUsers->loadDetails($threadUsr);
$mail = $usrData['USR_EMAIL'];
//The Subject to search the email
$subject = "[PM] " .$proName. " Case: ". $appNumber;
require_once PATH_TRUNK . 'vendor' . PATH_SEP . 'google' . PATH_SEP . 'apiclient' . PATH_SEP . 'src' . PATH_SEP . 'Google' . PATH_SEP . 'autoload.php';
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.pmGoogleApi.php");
$pmGoogle = new PMGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope('https://www.googleapis.com/auth/gmail.modify');
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
//getting all the label's ids of the user's mail
$listlabels = $this->listLabels($service);
foreach ($listlabels as $label) {
$labId = $label->getId();
$labName = $label->getName();
switch($labName){
case "* Inbox":
$idLabInbox = $labId;
break;
case "* Participated":
$idLabParticipated = $labId;
break;
case "* Unassigned":
$idLabUnassigned = $labId;
break;
case "* Draft":
$idLabDraft = $labId;
break;
case "* Paused":
$idLabPaused = $labId;
break;
}
}
if($actualLastIndex == 0){
$labelsToRemove = $idLabDraft;
$labelsToSearch = "*-draft";
$labelsToAdd = $idLabParticipated;
} else if ( ($actualLastIndex == -1) && ($unassigned == true) ){ //Unassigned
$labelsToRemove = $idLabUnassigned;
$labelsToSearch = "*-unassigned";
$labelsToAdd = $idLabInbox;
} else if($actualLastIndex >= 1) {
$labelsToRemove = $idLabInbox;
$labelsToSearch = "*-inbox";
$labelsToAdd = $idLabParticipated;
}
//Searching the email in the user's mail
$q = "subject:('".preg_quote($subject, '-')."') label:('".$labelsToSearch."')";
$messageList = $this->listMessages($service, $mail, $q, $labelsToRemove);
foreach ($messageList as $message) {
$messageId = $message->getId();
$modifyResult = $this->modifyMessage($service, $mail, $messageId, array($labelsToAdd), array($labelsToRemove));
}
}
}
/**
* Delete Label with given ID.
*
* @param Google_Service_Gmail $service Authorized Gmail API instance.
* @param string $userId User's email address. The special value 'me'
* can be used to indicate the authenticated user.
* @param string $labelId Id of Label to be updated.
*/
public function deleteLabel($service, $user, $labelId)
{
try {
$service->users_labels->delete($user, $labelId);
} catch (Exception $e) {
error_log('An error deleting gmail labels occurred: '.$e->getMessage());
}
}
/**
* Delete PMGmail integration labels getting the list of labels in an email account.
* @param string $mail User mail adress.
*
*/
public function deletePMGmailLabels($mail)
{
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.pmGoogleApi.php");
$pmGoogle = new PMGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope('https://www.googleapis.com/auth/gmail.modify');
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$count = 0;
$listlabels = $this->listLabels($service);
foreach ($listlabels as $label) {
if ($label->getName() == '* Inbox' ||
$label->getName() == '* Participated' ||
$label->getName() == '* Unassigned' ||
$label->getName() == '* Draft' ||
$label->getName() == '* Inbox' ||
$label->getName() == '--- ProcessMaker ---' ||
$label->getName() == '* Paused'
) {
$oresp = $this->deleteLabel($service, 'me', $label->getId());
$count++;
}
}
return $count . ' labels successfully deleted.';
}
}

View File

@@ -0,0 +1,269 @@
<?php
/**
* class.pmDrive.php
*
* @package workflow.engine.class
*
*/
G::LoadClass( "pmGoogleApi" );
class PMDrive extends PMGoogleApi
{
private $folderIdPMDrive = '';
private $folderNamePMDrive;
/**
* Validate if exist folder PMDrive
*
* @param $userUid id user
*/
private function validateFolderPMDrive($usrUid)
{
if ($this->folderIdPMDrive != '') {
return;
}
$user = new Users();
$dataUser = $user->load($usrUid);
if (!empty($dataUser['USR_EMAIL'])) {
$this->setDriveUser($dataUser['USR_EMAIL']);
}
$this->folderIdPMDrive = empty($dataUser['USR_PMDRIVE_FOLDER_UID']) ? '' : $dataUser['USR_PMDRIVE_FOLDER_UID'];
$conf = $this->getConfigGmail();
$this->folderNamePMDrive = empty($conf->aConfig['folderNamePMDrive']) ? 'PMDrive (' . SYS_SYS . ')' : $conf->aConfig['folderNamePMDrive'];
if ($this->folderIdPMDrive == '') {
$folderid = $this->createFolder($this->folderNamePMDrive);
$this->folderIdPMDrive = $folderid->id;
$dataUser['USR_PMDRIVE_FOLDER_UID'] = $folderid->id;
$user->update($dataUser);
}
}
public function getFolderIdPMDrive($usrUid)
{
$this->validateFolderPMDrive($usrUid);
return $this->folderIdPMDrive;
}
/**
* Set account user
*
* @param $user email user
*/
public function setFolderNamePMDrive($name)
{
$conf = $this->getConfigGmail();
$conf->aConfig['folderNamePMDrive'] = $name;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->folderNamePMDrive = $name;
}
/**
* Set account user
*
* @param $user email user
*/
public function setDriveUser($user)
{
$this->setUser($user);
}
/**
* Instance google service Drive
*
* @return Google_Service_Drive $service Drive API service instance.
*/
private function serviceDrive()
{
$client = $this->serviceClient();
$service = new Google_Service_Drive($client);
return $service;
}
/**
* Retrieve a list of File resources.
*
* @param string $fileId uid file
* @return Array List of Google_Service_Drive_DriveFile resources.
*/
public function listFolder($fileId)
{
$this->setScope('https://www.googleapis.com/auth/drive');
$this->setScope('https://www.googleapis.com/auth/drive.file');
$this->setScope('https://www.googleapis.com/auth/drive.readonly');
$this->setScope('https://www.googleapis.com/auth/drive.metadata.readonly');
$this->setScope('https://www.googleapis.com/auth/drive.appdata');
$this->setScope('https://www.googleapis.com/auth/drive.metadata');
$service = $this->serviceDrive();
try {
$rows = array();
$parameters['q'] = "'" . $fileId . "' in parents and trashed = false";
$parents = $service->files->listFiles($parameters);
foreach ($parents->getItems() as $parent) {
$rows = $parent;
}
} catch (Exception $e) {
error_log( G::LoadTranslation("ID_MSG_AJAX_FAILURE") . $e->getMessage());
}
return $rows;
}
/**
* Retrieve a list of File resources.
*
* @param string $name Title of the file to insert, including the extension.
* @param string $parentId Parent folder's ID.
* @return Google_Service_Drive_DriveFile The file that was inserted. NULL is returned if an API error occurred.
*/
public function createFolder($name, $parentId = null)
{
$this->setScope('https://www.googleapis.com/auth/drive.file');
$service = $this->serviceDrive();
$file = new Google_Service_Drive_DriveFile();
$file->setMimeType("application/vnd.google-apps.folder");
$file->setTitle($name);
if ($parentId != null) {
$parent = new Google_Service_Drive_ParentReference();
$parent->setId($parentId);
$file->setParents(array($parent));
}
try {
$createdFolder = $service->files->insert($file);
} catch (Exception $e) {
$createdFolder = null;
error_log ( "An error occurred: " . $e->getMessage());
}
return $createdFolder;
}
/**
* upload new file
*
* @param string $mime MIME type of the file to insert.
* @param string $src location of the file to insert.
* @param string $name Title of the file to insert, including the extension.
* @return Google_Service_Drive_DriveFile The file that was inserted. NULL is returned if an API error occurred.
*/
public function uploadFile($mime, $src, $name, $parentId = null)
{
$this->setScope('https://www.googleapis.com/auth/drive.file');
$service = $this->serviceDrive();
$file = new Google_Service_Drive_DriveFile();
$file->setMimeType("*/*");
$file->setTitle($name);
// Set the parent folder.
if ($parentId != null) {
$parent = new Google_Service_Drive_ParentReference();
$parent->setId($parentId);
$file->setParents(array($parent));
}
$data = file_get_contents($src);
try {
$createdFile = $service->files->insert(
$file,
array(
'data' => $data,
'mimeType' => $mime,
'uploadType' => 'media'
)
);
} catch (Exception $e) {
error_log( "An error occurred: " . $e->getMessage());
}
return $createdFile;
}
/**
* Download a file's content.
*
* @param string $fileId id file.
* @return String The file's content if successful, null otherwise
*/
public function downloadFile($fileId)
{
$this->setScope('https://www.googleapis.com/auth/drive');
$this->setScope('https://www.googleapis.com/auth/drive.appdata');
$this->setScope('https://www.googleapis.com/auth/drive.apps.readonly');
$this->setScope('https://www.googleapis.com/auth/drive.file');
$this->setScope('https://www.googleapis.com/auth/drive.metadata');
$this->setScope('https://www.googleapis.com/auth/drive.metadata.readonly');
$this->setScope('https://www.googleapis.com/auth/drive.readonly');
$service = $this->serviceDrive();
try {
$file = $service->files->get($fileId);
$response = null;
$downloadUrl = $file->getDownloadUrl();
if ($downloadUrl) {
$request = new Google_Http_Request($downloadUrl, 'GET', null, null);
$httpRequest = $service->getClient()->getAuth()->authenticatedRequest($request);
if ($httpRequest->getResponseHttpCode() == 200) {
$response = $httpRequest->getResponseBody();
} else {
error_log( "An error occurred. ");
}
} else {
error_log( "The file doesn't have any content stored on Drive.");
}
} catch (Exception $e) {
error_log( "An error occurred: " . $e->getMessage());
}
return $response;
}
/**
* Insert a new permission.
*
* @param String $fileId ID of the file to insert permission for.
* @param String $value User or group e-mail address, domain name or NULL for "default" type.
* @param String $type The value "user", "group", "domain" or "default".
* @param String $role The value "owner", "writer" or "reader".
* @return Google_Servie_Drive_Permission The inserted permission. NULL is returned if an API error occurred.
*/
public function setPermission($fileId, $value, $type = 'user', $role = 'reader', $sendNotification = false)
{
$this->setScope('https://www.googleapis.com/auth/drive');
$this->setScope('https://www.googleapis.com/auth/drive.file');
$service = $this->serviceDrive();
$newPermission = new Google_Service_Drive_Permission();
$newPermission->setValue($value);
$newPermission->setType($type);
$newPermission->setRole($role);
try {
$permission = $service->permissions->insert(
$fileId,
$newPermission,
array(
'sendNotificationEmails' => $sendNotification
)
);
} catch (Exception $e) {
error_log('permission error: ' . $e->getMessage());
}
return $permission;
}
}

View File

@@ -339,9 +339,23 @@ class pmDynaform
}
}
if ($key === "type" && ($value === "file") && isset($this->fields["APP_DATA"]["APPLICATION"])) {
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
$oCriteria = new Criteria("workflow");
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
$oCriteria->addSelectColumn(AppDocumentPeer::DOC_VERSION);
/*----------------------------------********---------------------------------*/
if ($enablePMGmail) {
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD);
}
/*----------------------------------********---------------------------------*/
$oCriteria->add(AppDocumentPeer::APP_UID, $this->fields["APP_DATA"]["APPLICATION"]);
$oCriteria->add(AppDocumentPeer::APP_DOC_FIELDNAME, $json->name);
$rs = AppDocumentPeer::doSelectRS($oCriteria);
@@ -349,7 +363,17 @@ class pmDynaform
$links = array();
while ($rs->next()) {
$row = $rs->getRow();
array_push($links, "../cases/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"]);
$linkDownload = "../cases/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"];
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($row['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('ATTACHED',
$driveDownload) && $enablePMGmail
) {
$linkDownload = $driveDownload['ATTACHED'];
}
/*----------------------------------********---------------------------------*/
array_push($links, $linkDownload);
}
$json->data = new stdClass();
$json->data->value = $links;

View File

@@ -2902,4 +2902,63 @@ function PMFSaveCurrentData ()
}
return $result;
}
}
/**
* @method
* This function determines if the domain of the passed email addres is hosted in
* a gmail server.
* This function test just the domain, so there isn't any validation related to the
* email address existence or validity.
* @param string | $email | emailAddress that will be examined to determine if it is hosted in Gmail
* @return boolean | $result | true if the emailAddress domain is hosted in gmail, false otherwise
* */
function isEmailAddressHostedInGmail($email) {
$g = new G();
if ($g->emailAddress($email) === false) {
throw new Exception ('the passed email address is not valid.');
}
$result = FALSE;
//the accepted domains for a gemail server are:
$gmailDomainsRegExp = "/gmail\.com|googlemail\.com/";
if (preg_match($gmailDomainsRegExp, $email) == 1) {
$result = TRUE;
} else {
$domainName = preg_split('/@/', $email)[1];
foreach(getNamedServerMXRecord($domainName) as $emailServer) {
if (preg_match($gmailDomainsRegExp, $emailServer) == 1) {
$result = TRUE;
}
}
}
return $result;
}
/**
* @method
* Returns an array with the Mail Exchanger info of a Named Domain
* a gmail server.
* This function test just the domain, so there isn't any validation related to the
* email address existence or validity.
* @param string | $domainName | Domain Name e.g. processmaker.com
* @return array | $result | array
* */
function getNamedServerMXRecord($domainName) {
//in some windows distributions getmxxr does not exist, so if this happens, a wrapper function
//is created.
if (!function_exists('getmxrr')) {
function getmxrr($hostname, &$mxhosts, &$mxweight=false) {
return win_getmxrr($hostname, $mxhosts, $mxweight);
}
}
$mailExchangerHosts = array();
getmxrr($domainName, $mailExchangerHosts);
return $mailExchangerHosts;
}

View File

@@ -0,0 +1,332 @@
<?php
/**
* class.pmGoogleApi.php
*
*/
require_once PATH_TRUNK . 'vendor' . PATH_SEP . 'google' . PATH_SEP . 'apiclient' . PATH_SEP . 'src' . PATH_SEP . 'Google' . PATH_SEP . 'autoload.php';
class PMGoogleApi
{
private $scope = array();
private $serviceAccountEmail;
private $serviceAccountP12;
private $statusService;
private $domain;
private $user;
private $typeAuthentication;
private $accountJson;
public function __construct()
{
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
}
$this->loadSettings();
}
public function setScope($scope)
{
$this->scope[] = $scope;
}
public function getScope()
{
return $this->scope;
}
public function setUser($user)
{
$this->user = $user;
}
public function getUser()
{
return $this->user;
}
public function setStatusService($status)
{
$conf = $this->getConfigGmail();
$conf->aConfig['statusService'] = $status;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->statusService = $status;
}
public function getStatusService()
{
return $this->statusService;
}
public function getConfigGmail()
{
$conf = new Configurations();
$conf->loadConfig($gmail, 'GOOGLE_API_SETTINGS', '');
return $conf;
}
public function setServiceAccountEmail($serviceAccountEmail)
{
$conf = $this->getConfigGmail();
$conf->aConfig['serviceAccountEmail'] = $serviceAccountEmail;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->serviceAccountEmail = $serviceAccountEmail;
}
public function getServiceAccountEmail()
{
return $this->serviceAccountEmail;
}
public function setServiceAccountP12($serviceAccountP12)
{
$conf = $this->getConfigGmail();
$conf->aConfig['serviceAccountP12'] = $serviceAccountP12;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->serviceAccountP12 = $serviceAccountP12;
}
public function getServiceAccountP12()
{
return $this->serviceAccountP12;
}
public function setDomain($domain)
{
$conf = $this->getConfigGmail();
$conf->aConfig['domain'] = $domain;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->domain = $domain;
}
public function getDomain()
{
return $this->domain;
}
public function setTypeAuthentication($type)
{
$conf = $this->getConfigGmail();
$conf->aConfig['typeAuthentication'] = $type;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->typeAuthentication = $type;
}
public function getTypeAuthentication()
{
return $this->typeAuthentication;
}
public function setAccountJson($accountJson)
{
$conf = $this->getConfigGmail();
$conf->aConfig['accountJson'] = $accountJson;
$conf->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
$this->accountJson = $accountJson;
}
public function getAccountJson()
{
return $this->accountJson;
}
/**
* load configuration gmail service account
*
*/
public function loadSettings()
{
$conf = $this->getConfigGmail();
$typeAuthentication = empty($conf->aConfig['typeAuthentication']) ? '' : $conf->aConfig['typeAuthentication'];
$accountJson = empty($conf->aConfig['accountJson']) ? '' : $conf->aConfig['accountJson'];
$serviceAccountP12 = empty($conf->aConfig['serviceAccountP12']) ? '' : $conf->aConfig['serviceAccountP12'];
$serviceAccountEmail = empty($conf->aConfig['serviceAccountEmail']) ? '' : $conf->aConfig['serviceAccountEmail'];
$statusService = empty($conf->aConfig['statusService']) ? '' : $conf->aConfig['statusService'];
$this->scope = array();
$this->setTypeAuthentication($typeAuthentication);
$this->setAccountJson($accountJson);
$this->setServiceAccountEmail($serviceAccountEmail);
$this->setServiceAccountP12($serviceAccountP12);
$this->setStatusService($statusService);
}
/**
* New service client - Authentication google Api
*
* @return Google_Service_Client $service API service instance.
*/
public function serviceClient()
{
$client = null;
if ($this->typeAuthentication == 'webApplication') {
if (file_exists(PATH_DATA_SITE . $this->accountJson)) {
$credential = file_get_contents(PATH_DATA_SITE . $this->accountJson);
} else {
throw new Exception(G::LoadTranslation('ID_GOOGLE_FILE_JSON_ERROR'));
}
$client = new Google_Client();
$client->setAuthConfig($credential);
$client->addScope($this->scope);
if (!empty($_SESSION['google_token'])) {
$client->setAccessToken($_SESSION['google_token']);
if ($client->isAccessTokenExpired()) {
$client->getRefreshToken();
unset($_SESSION['google_token']);
$_SESSION['google_token'] = $client->getAccessToken();
}
} else if (!empty($_SESSION['CODE_GMAIL'])) {
$token = $client->authenticate($_SESSION['CODE_GMAIL']);
$_SESSION['google_token'] = $client->getAccessToken();
} else {
$authUrl = $client->createAuthUrl();
echo '<script type="text/javascript">
var opciones = "width=450,height=480,scrollbars=NO, locatin=NO,toolbar=NO, status=NO, menumbar=NO, top=10%, left=25%";
window.open("' . $authUrl . '","Gmail", opciones);
</script>';
die;
}
} else if ($this->typeAuthentication == 'serviceAccount') {
if (file_exists(PATH_DATA_SITE . $this->serviceAccountP12)) {
$key = file_get_contents(PATH_DATA_SITE . $this->serviceAccountP12);
} else {
throw new Exception(G::LoadTranslation('ID_GOOGLE_FILE_P12_ERROR'));
}
$assertionCredentials = new Google_Auth_AssertionCredentials(
$this->serviceAccountEmail,
$this->scope,
$key
);
$assertionCredentials->sub = $this->user;
$client = new Google_Client();
$client->setApplicationName("PMDrive");
$client->setAssertionCredentials($assertionCredentials);
} else {
throw new Exception(G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR'));
}
return $client;
}
/**
* New service client - Authentication google Api
*
* @return Google_Service_Client $service API service instance.
*/
public function testService($credentials)
{
$scope = array(
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.file',
'https://www.googleapis.com/auth/drive.readonly',
'https://www.googleapis.com/auth/drive.metadata.readonly',
'https://www.googleapis.com/auth/drive.appdata',
'https://www.googleapis.com/auth/drive.metadata',
'https://www.googleapis.com/auth/drive.photos.readonly'
);
if ($credentials->typeAuth == 'webApplication') {
if (file_exists($credentials->pathFileJson)) {
$credential = file_get_contents($credentials->pathFileJson);
} else {
throw new Exception(G::LoadTranslation('ID_GOOGLE_FILE_JSON_ERROR'));
}
$client = new Google_Client();
$client->setAuthConfig($credential);
$client->addScope($scope);
if (!empty($_SESSION['google_token'])) {
$client->setAccessToken($_SESSION['google_token']);
if ($client->isAccessTokenExpired()) {
unset($_SESSION['google_token']);
}
} else if (!empty($_SESSION['CODE_GMAIL'])) {
$token = $client->authenticate($_SESSION['CODE_GMAIL']);
$_SESSION['google_token'] = $client->getAccessToken();
} else {
$authUrl = $client->createAuthUrl();
echo '<script type="text/javascript">
var opciones = "width=450,height=480,scrollbars=NO, locatin=NO,toolbar=NO, status=NO, menumbar=NO, top=10%, left=25%";
window.open("' . $authUrl . '","Gmail", opciones);
</script>';
die;
}
} else {
if (file_exists($credentials->pathServiceAccountP12)) {
$key = file_get_contents($credentials->pathServiceAccountP12);
} else {
throw new Exception(G::LoadTranslation('ID_GOOGLE_FILE_P12_ERROR'));
}
$assertionCredentials = new Google_Auth_AssertionCredentials(
$credentials->emailServiceAccount,
$scope,
$key
);
$assertionCredentials->sub = $this->user;
$client = new Google_Client();
$client->setApplicationName("PMDrive");
$client->setAssertionCredentials($assertionCredentials);
}
$service = new Google_Service_Drive($client);
$result = new StdClass();
$result->success = true;
$result->currentUserName = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
$result->rootFolderId = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
$result->quotaType = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
$result->quotaBytesTotal = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
$result->quotaBytesUsed = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
try {
$about = $service->about->get();
$result->currentUserName = $about->getName();
$result->rootFolderId = $about->getRootFolderId();
$result->quotaType = $about->getQuotaType();
$result->quotaBytesTotal = $about->getQuotaBytesTotal();
$result->quotaBytesUsed = $about->getQuotaBytesUsed();
$result->responseGmailTest = G::LoadTranslation('ID_SUCCESSFUL_CONNECTION');
} catch (Exception $e) {
$result->success = false;
$result->responseGmailTest = G::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR');
}
return $result;
}
}

View File

@@ -914,7 +914,8 @@ class wsBase
$aAttachment = null,
$showMessage = true,
$delIndex = 0,
$config = array()
$config = array(),
$gmail = 0
) {
try {
if (!class_exists('System')) {
@@ -969,8 +970,11 @@ class wsBase
$oCase = new Cases();
$oldFields = $oCase->loadCase( $caseId );
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
if($gmail == 1){
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP;
}else {
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
}
$fileTemplate = $pathEmail . $sTemplate;
G::mk_dir( $pathEmail, 0777, true );

View File

@@ -264,6 +264,7 @@ class AppDelegation extends BaseAppDelegation
$c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE );
$c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE );
$c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
$c->addSelectColumn( AppDelegationPeer::DEL_PREVIOUS );
$c->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
$c->add( AppDelegationPeer::APP_UID, $AppUid );
@@ -287,6 +288,7 @@ class AppDelegation extends BaseAppDelegation
$case['DEL_INIT_DATE'] = $row['DEL_INIT_DATE'];
$case['DEL_TASK_DUE_DATE'] = $row['DEL_TASK_DUE_DATE'];
$case['DEL_FINISH_DATE'] = $row['DEL_FINISH_DATE'];
$case['DEL_PREVIOUS'] = $row['DEL_PREVIOUS'];
$aCases[] = $case;
$rs->next();
$row = $rs->getRow();

View File

@@ -64,6 +64,10 @@ class AppDocument extends BaseAppDocument
*/
protected $app_doc_filename = '';
/*----------------------------------********---------------------------------*/
protected $driveDownload = array();
/*----------------------------------********---------------------------------*/
/*
* Load the application document registry
* @param string $sAppDocUid
@@ -86,6 +90,11 @@ class AppDocument extends BaseAppDocument
$aFields['APP_DOC_FILENAME'] = $aContentFields['APP_DOC_FILENAME'];
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
/*----------------------------------********---------------------------------*/
$driveDownload = @unserialize($aFields['APP_DOC_DRIVE_DOWNLOAD']);
$driveDownload = $driveDownload !== false ? $driveDownload : array();
$oAppDocument->driveDownload = $driveDownload;
/*----------------------------------********---------------------------------*/
return $aFields;
} else {
throw (new Exception( 'Error loading Document ' . $sAppDocUid . '/' . $iVersion . '. This row doesn\'t exist!' ));
@@ -209,6 +218,9 @@ class AppDocument extends BaseAppDocument
$docVersion ++;
}
/*----------------------------------********---------------------------------*/
$aData['APP_DOC_DRIVE_DOWNLOAD'] = serialize($this->driveDownload);
/*----------------------------------********---------------------------------*/
$oAppDocument->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
$oAppDocument->setDocVersion( $docVersion );
@@ -256,6 +268,14 @@ class AppDocument extends BaseAppDocument
try {
$oAppDocument = AppDocumentPeer::retrieveByPK( $aData['APP_DOC_UID'], $aData['DOC_VERSION'] );
if (! is_null( $oAppDocument )) {
/*----------------------------------********---------------------------------*/
$driveDownload = @unserialize($oAppDocument->getAppDocDriveDownload());
if ($driveDownload !== false) {
$aData['APP_DOC_DRIVE_DOWNLOAD'] = serialize(array_merge($driveDownload, $this->driveDownload));
} else {
$aData['APP_DOC_DRIVE_DOWNLOAD'] = serialize($this->driveDownload);
}
/*----------------------------------********---------------------------------*/
$oAppDocument->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($oAppDocument->validate()) {
$oConnection->begin();
@@ -474,6 +494,23 @@ class AppDocument extends BaseAppDocument
return true;
}
/*----------------------------------********---------------------------------*/
public function setDriveDownload($key, $value)
{
$this->driveDownload[$key] = $value;
}
public function getDriveDownload($key)
{
$url = '';
if (array_key_exists($key, $this->driveDownload)) {
$url = $this->driveDownload[$key];
}
return $url;
}
/*----------------------------------********---------------------------------*/
public function updateInsertContent ($content, $field, $value)
{
if (isset( $content[$field]['en'] )) {

View File

@@ -293,6 +293,16 @@ class AppFolder extends BaseAppFolder
//require_once ("classes/model/OutputDocument.php");
//require_once ("classes/model/Users.php");
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
G::LoadClass( 'case' );
$oCase = new Cases();
G::LoadClass( 'process' );
@@ -318,6 +328,11 @@ class AppFolder extends BaseAppFolder
$oCriteria->addSelectColumn( AppDocumentPeer::APP_DOC_STATUS);
$oCriteria->addSelectColumn( AppDocumentPeer::APP_DOC_STATUS_DATE);
$oCriteria->addSelectColumn( AppDocumentPeer::APP_DOC_FIELDNAME);
/*----------------------------------********---------------------------------*/
if ($enablePMGmail) {
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD);
}
/*----------------------------------********---------------------------------*/
if ((is_array( $docIdFilter )) && (count( $docIdFilter ) > 0)) {
//Search by App Doc UID no matter what Folder it is
@@ -418,6 +433,39 @@ class AppFolder extends BaseAppFolder
//$filesResult [] = $completeInfo;
if ($completeInfo['APP_DOC_STATUS'] != "DELETED") {
/*----------------------------------********---------------------------------*/
if ($enablePMGmail) {
$driveDownload = @unserialize($completeInfo['APP_DOC_DRIVE_DOWNLOAD']);
switch ($completeInfo['APP_DOC_TYPE']) {
case 'INPUT':
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('INPUT',
$driveDownload)
) {
$completeInfo['DOWNLOAD_LINK'] = $driveDownload['INPUT'];
}
break;
case 'ATTACHED':
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('ATTACHED',
$driveDownload)
) {
$completeInfo['DOWNLOAD_LINK'] = $driveDownload['ATTACHED'];
}
break;
case 'OUTPUT':
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('OUTPUT_DOC',
$driveDownload)
) {
$completeInfo['DOWNLOAD_LINK1'] = $driveDownload['OUTPUT_DOC'];
}
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('OUTPUT_PDF',
$driveDownload)
) {
$completeInfo['DOWNLOAD_LINK'] = $driveDownload['OUTPUT_PDF'];
}
break;
}
}
/*----------------------------------********---------------------------------*/
if (in_array($row["APP_DOC_UID"], $completeInfo["INPUT_DOCUMENTS"]) || in_array($row["APP_DOC_UID"], $completeInfo["OUTPUT_DOCUMENTS"]) || in_array($completeInfo["USR_UID"], array($_SESSION["USER_LOGGED"], "-1")) || $user == "") {
if (count( $docIdFilter ) > 0) {
if (in_array( $row['APP_DOC_UID'], $docIdFilter )) {

View File

@@ -1,5 +1,28 @@
<?php
class EmailServer extends BaseEmailServer
{
/**
* Get the evn_description column value.
*
* @return string
*/
public function loadDefaultAccount ()
{
$c = new Criteria( 'workflow' );
$del = DBAdapter::getStringDelimiter();
$c->clearSelectColumns();
$c->addSelectColumn( EmailServerPeer::MESS_ACCOUNT );
$c->add( EmailServerPeer::MESS_DEFAULT, 1 );
$rs = EmailServerPeer::doSelectRS( $c, Propel::getDBConnection('workflow_ro') );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();
$response=$row;
return $response;
}
}

View File

@@ -95,6 +95,8 @@ class AppDocumentMapBuilder
$tMap->addColumn('APP_DOC_FIELDNAME', 'AppDocFieldname', 'string', CreoleTypes::VARCHAR, false, 150);
$tMap->addColumn('APP_DOC_DRIVE_DOWNLOAD', 'AppDocDriveDownload', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addValidator('APP_DOC_UID', 'maxLength', 'propel.validator.MaxLengthValidator', '32', 'Application Document UID can be no larger than 32 in size');
$tMap->addValidator('APP_DOC_UID', 'required', 'propel.validator.RequiredValidator', '', 'Application Document UID is required.');

View File

@@ -101,6 +101,8 @@ class ApplicationMapBuilder
$tMap->addColumn('APP_DELAY_DURATION', 'AppDelayDuration', 'double', CreoleTypes::DOUBLE, false, null);
$tMap->addColumn('APP_DRIVE_FOLDER_UID', 'AppDriveFolderUid', 'string', CreoleTypes::VARCHAR, false, 32);
$tMap->addValidator('APP_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'DRAFT|TO_DO|PAUSED|COMPLETED|CANCELLED', 'Please select a valid status.');
} // doBuild()

View File

@@ -135,6 +135,8 @@ class UsersMapBuilder
$tMap->addColumn('USR_UNIT_COST', 'UsrUnitCost', 'string', CreoleTypes::VARCHAR, false, 50);
$tMap->addColumn('USR_PMDRIVE_FOLDER_UID', 'UsrPmdriveFolderUid', 'string', CreoleTypes::VARCHAR, false, 32);
$tMap->addColumn('USR_BOOKMARK_START_CASES', 'UsrBookmarkStartCases', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('USR_TIME_ZONE', 'UsrTimeZone', 'string', CreoleTypes::VARCHAR, false, 100);

View File

@@ -75,6 +75,8 @@ class UsrReportingMapBuilder
$tMap->addPrimaryKey('YEAR', 'Year', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('TOTAL_QUEUE_TIME_BY_TASK', 'TotalQueueTimeByTask', 'double', CreoleTypes::DECIMAL, false, 7,2);
$tMap->addColumn('TOTAL_TIME_BY_TASK', 'TotalTimeByTask', 'double', CreoleTypes::DECIMAL, false, 7,2);
$tMap->addColumn('TOTAL_CASES_IN', 'TotalCasesIn', 'double', CreoleTypes::DECIMAL, false, 7,2);
@@ -93,6 +95,10 @@ class UsrReportingMapBuilder
$tMap->addColumn('TOTAL_CASES_ON_TIME', 'TotalCasesOnTime', 'double', CreoleTypes::DECIMAL, false, 7,2);
$tMap->addColumn('PRO_COST', 'ProCost', 'double', CreoleTypes::DECIMAL, false, 7,2);
$tMap->addColumn('PRO_UNIT_COST', 'ProUnitCost', 'string', CreoleTypes::VARCHAR, false, 50);
} // doBuild()
} // UsrReportingMapBuilder

View File

@@ -117,6 +117,12 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
*/
protected $app_doc_fieldname;
/**
* The value for the app_doc_drive_download field.
* @var string
*/
protected $app_doc_drive_download;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -338,6 +344,17 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
return $this->app_doc_fieldname;
}
/**
* Get the [app_doc_drive_download] column value.
*
* @return string
*/
public function getAppDocDriveDownload()
{
return $this->app_doc_drive_download;
}
/**
* Set the value of [app_doc_uid] column.
*
@@ -682,6 +699,28 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
} // setAppDocFieldname()
/**
* Set the value of [app_doc_drive_download] column.
*
* @param string $v new value
* @return void
*/
public function setAppDocDriveDownload($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->app_doc_drive_download !== $v) {
$this->app_doc_drive_download = $v;
$this->modifiedColumns[] = AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD;
}
} // setAppDocDriveDownload()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -729,12 +768,14 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
$this->app_doc_fieldname = $rs->getString($startcol + 14);
$this->app_doc_drive_download = $rs->getString($startcol + 15);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 15; // 15 = AppDocumentPeer::NUM_COLUMNS - AppDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 16; // 16 = AppDocumentPeer::NUM_COLUMNS - AppDocumentPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating AppDocument object", $e);
@@ -983,6 +1024,9 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
case 14:
return $this->getAppDocFieldname();
break;
case 15:
return $this->getAppDocDriveDownload();
break;
default:
return null;
break;
@@ -1018,6 +1062,7 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
$keys[12] => $this->getAppDocStatus(),
$keys[13] => $this->getAppDocStatusDate(),
$keys[14] => $this->getAppDocFieldname(),
$keys[15] => $this->getAppDocDriveDownload(),
);
return $result;
}
@@ -1094,6 +1139,9 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
case 14:
$this->setAppDocFieldname($value);
break;
case 15:
$this->setAppDocDriveDownload($value);
break;
} // switch()
}
@@ -1177,6 +1225,10 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
$this->setAppDocFieldname($arr[$keys[14]]);
}
if (array_key_exists($keys[15], $arr)) {
$this->setAppDocDriveDownload($arr[$keys[15]]);
}
}
/**
@@ -1248,6 +1300,10 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
$criteria->add(AppDocumentPeer::APP_DOC_FIELDNAME, $this->app_doc_fieldname);
}
if ($this->isColumnModified(AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD)) {
$criteria->add(AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD, $this->app_doc_drive_download);
}
return $criteria;
}
@@ -1340,6 +1396,8 @@ abstract class BaseAppDocument extends BaseObject implements Persistent
$copyObj->setAppDocFieldname($this->app_doc_fieldname);
$copyObj->setAppDocDriveDownload($this->app_doc_drive_download);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseAppDocumentPeer
const CLASS_DEFAULT = 'classes.model.AppDocument';
/** The total number of columns. */
const NUM_COLUMNS = 15;
const NUM_COLUMNS = 16;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -76,6 +76,9 @@ abstract class BaseAppDocumentPeer
/** the column name for the APP_DOC_FIELDNAME field */
const APP_DOC_FIELDNAME = 'APP_DOCUMENT.APP_DOC_FIELDNAME';
/** the column name for the APP_DOC_DRIVE_DOWNLOAD field */
const APP_DOC_DRIVE_DOWNLOAD = 'APP_DOCUMENT.APP_DOC_DRIVE_DOWNLOAD';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -87,10 +90,10 @@ abstract class BaseAppDocumentPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('AppDocUid', 'DocVersion', 'AppUid', 'DelIndex', 'DocUid', 'UsrUid', 'AppDocType', 'AppDocCreateDate', 'AppDocIndex', 'FolderUid', 'AppDocPlugin', 'AppDocTags', 'AppDocStatus', 'AppDocStatusDate', 'AppDocFieldname', ),
BasePeer::TYPE_COLNAME => array (AppDocumentPeer::APP_DOC_UID, AppDocumentPeer::DOC_VERSION, AppDocumentPeer::APP_UID, AppDocumentPeer::DEL_INDEX, AppDocumentPeer::DOC_UID, AppDocumentPeer::USR_UID, AppDocumentPeer::APP_DOC_TYPE, AppDocumentPeer::APP_DOC_CREATE_DATE, AppDocumentPeer::APP_DOC_INDEX, AppDocumentPeer::FOLDER_UID, AppDocumentPeer::APP_DOC_PLUGIN, AppDocumentPeer::APP_DOC_TAGS, AppDocumentPeer::APP_DOC_STATUS, AppDocumentPeer::APP_DOC_STATUS_DATE, AppDocumentPeer::APP_DOC_FIELDNAME, ),
BasePeer::TYPE_FIELDNAME => array ('APP_DOC_UID', 'DOC_VERSION', 'APP_UID', 'DEL_INDEX', 'DOC_UID', 'USR_UID', 'APP_DOC_TYPE', 'APP_DOC_CREATE_DATE', 'APP_DOC_INDEX', 'FOLDER_UID', 'APP_DOC_PLUGIN', 'APP_DOC_TAGS', 'APP_DOC_STATUS', 'APP_DOC_STATUS_DATE', 'APP_DOC_FIELDNAME', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
BasePeer::TYPE_PHPNAME => array ('AppDocUid', 'DocVersion', 'AppUid', 'DelIndex', 'DocUid', 'UsrUid', 'AppDocType', 'AppDocCreateDate', 'AppDocIndex', 'FolderUid', 'AppDocPlugin', 'AppDocTags', 'AppDocStatus', 'AppDocStatusDate', 'AppDocFieldname', 'AppDocDriveDownload', ),
BasePeer::TYPE_COLNAME => array (AppDocumentPeer::APP_DOC_UID, AppDocumentPeer::DOC_VERSION, AppDocumentPeer::APP_UID, AppDocumentPeer::DEL_INDEX, AppDocumentPeer::DOC_UID, AppDocumentPeer::USR_UID, AppDocumentPeer::APP_DOC_TYPE, AppDocumentPeer::APP_DOC_CREATE_DATE, AppDocumentPeer::APP_DOC_INDEX, AppDocumentPeer::FOLDER_UID, AppDocumentPeer::APP_DOC_PLUGIN, AppDocumentPeer::APP_DOC_TAGS, AppDocumentPeer::APP_DOC_STATUS, AppDocumentPeer::APP_DOC_STATUS_DATE, AppDocumentPeer::APP_DOC_FIELDNAME, AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD, ),
BasePeer::TYPE_FIELDNAME => array ('APP_DOC_UID', 'DOC_VERSION', 'APP_UID', 'DEL_INDEX', 'DOC_UID', 'USR_UID', 'APP_DOC_TYPE', 'APP_DOC_CREATE_DATE', 'APP_DOC_INDEX', 'FOLDER_UID', 'APP_DOC_PLUGIN', 'APP_DOC_TAGS', 'APP_DOC_STATUS', 'APP_DOC_STATUS_DATE', 'APP_DOC_FIELDNAME', 'APP_DOC_DRIVE_DOWNLOAD', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -100,10 +103,10 @@ abstract class BaseAppDocumentPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('AppDocUid' => 0, 'DocVersion' => 1, 'AppUid' => 2, 'DelIndex' => 3, 'DocUid' => 4, 'UsrUid' => 5, 'AppDocType' => 6, 'AppDocCreateDate' => 7, 'AppDocIndex' => 8, 'FolderUid' => 9, 'AppDocPlugin' => 10, 'AppDocTags' => 11, 'AppDocStatus' => 12, 'AppDocStatusDate' => 13, 'AppDocFieldname' => 14, ),
BasePeer::TYPE_COLNAME => array (AppDocumentPeer::APP_DOC_UID => 0, AppDocumentPeer::DOC_VERSION => 1, AppDocumentPeer::APP_UID => 2, AppDocumentPeer::DEL_INDEX => 3, AppDocumentPeer::DOC_UID => 4, AppDocumentPeer::USR_UID => 5, AppDocumentPeer::APP_DOC_TYPE => 6, AppDocumentPeer::APP_DOC_CREATE_DATE => 7, AppDocumentPeer::APP_DOC_INDEX => 8, AppDocumentPeer::FOLDER_UID => 9, AppDocumentPeer::APP_DOC_PLUGIN => 10, AppDocumentPeer::APP_DOC_TAGS => 11, AppDocumentPeer::APP_DOC_STATUS => 12, AppDocumentPeer::APP_DOC_STATUS_DATE => 13, AppDocumentPeer::APP_DOC_FIELDNAME => 14, ),
BasePeer::TYPE_FIELDNAME => array ('APP_DOC_UID' => 0, 'DOC_VERSION' => 1, 'APP_UID' => 2, 'DEL_INDEX' => 3, 'DOC_UID' => 4, 'USR_UID' => 5, 'APP_DOC_TYPE' => 6, 'APP_DOC_CREATE_DATE' => 7, 'APP_DOC_INDEX' => 8, 'FOLDER_UID' => 9, 'APP_DOC_PLUGIN' => 10, 'APP_DOC_TAGS' => 11, 'APP_DOC_STATUS' => 12, 'APP_DOC_STATUS_DATE' => 13, 'APP_DOC_FIELDNAME' => 14, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
BasePeer::TYPE_PHPNAME => array ('AppDocUid' => 0, 'DocVersion' => 1, 'AppUid' => 2, 'DelIndex' => 3, 'DocUid' => 4, 'UsrUid' => 5, 'AppDocType' => 6, 'AppDocCreateDate' => 7, 'AppDocIndex' => 8, 'FolderUid' => 9, 'AppDocPlugin' => 10, 'AppDocTags' => 11, 'AppDocStatus' => 12, 'AppDocStatusDate' => 13, 'AppDocFieldname' => 14, 'AppDocDriveDownload' => 15, ),
BasePeer::TYPE_COLNAME => array (AppDocumentPeer::APP_DOC_UID => 0, AppDocumentPeer::DOC_VERSION => 1, AppDocumentPeer::APP_UID => 2, AppDocumentPeer::DEL_INDEX => 3, AppDocumentPeer::DOC_UID => 4, AppDocumentPeer::USR_UID => 5, AppDocumentPeer::APP_DOC_TYPE => 6, AppDocumentPeer::APP_DOC_CREATE_DATE => 7, AppDocumentPeer::APP_DOC_INDEX => 8, AppDocumentPeer::FOLDER_UID => 9, AppDocumentPeer::APP_DOC_PLUGIN => 10, AppDocumentPeer::APP_DOC_TAGS => 11, AppDocumentPeer::APP_DOC_STATUS => 12, AppDocumentPeer::APP_DOC_STATUS_DATE => 13, AppDocumentPeer::APP_DOC_FIELDNAME => 14, AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD => 15, ),
BasePeer::TYPE_FIELDNAME => array ('APP_DOC_UID' => 0, 'DOC_VERSION' => 1, 'APP_UID' => 2, 'DEL_INDEX' => 3, 'DOC_UID' => 4, 'USR_UID' => 5, 'APP_DOC_TYPE' => 6, 'APP_DOC_CREATE_DATE' => 7, 'APP_DOC_INDEX' => 8, 'FOLDER_UID' => 9, 'APP_DOC_PLUGIN' => 10, 'APP_DOC_TAGS' => 11, 'APP_DOC_STATUS' => 12, 'APP_DOC_STATUS_DATE' => 13, 'APP_DOC_FIELDNAME' => 14, 'APP_DOC_DRIVE_DOWNLOAD' => 15, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -234,6 +237,8 @@ abstract class BaseAppDocumentPeer
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_FIELDNAME);
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_DRIVE_DOWNLOAD);
}
const COUNT = 'COUNT(APP_DOCUMENT.APP_DOC_UID)';

View File

@@ -135,6 +135,12 @@ abstract class BaseApplication extends BaseObject implements Persistent
*/
protected $app_delay_duration = 0;
/**
* The value for the app_drive_folder_uid field.
* @var string
*/
protected $app_drive_folder_uid = '';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -431,6 +437,17 @@ abstract class BaseApplication extends BaseObject implements Persistent
return $this->app_delay_duration;
}
/**
* Get the [app_drive_folder_uid] column value.
*
* @return string
*/
public function getAppDriveFolderUid()
{
return $this->app_drive_folder_uid;
}
/**
* Set the value of [app_uid] column.
*
@@ -843,6 +860,28 @@ abstract class BaseApplication extends BaseObject implements Persistent
} // setAppDelayDuration()
/**
* Set the value of [app_drive_folder_uid] column.
*
* @param string $v new value
* @return void
*/
public function setAppDriveFolderUid($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->app_drive_folder_uid !== $v || $v === '') {
$this->app_drive_folder_uid = $v;
$this->modifiedColumns[] = ApplicationPeer::APP_DRIVE_FOLDER_UID;
}
} // setAppDriveFolderUid()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -896,12 +935,14 @@ abstract class BaseApplication extends BaseObject implements Persistent
$this->app_delay_duration = $rs->getFloat($startcol + 17);
$this->app_drive_folder_uid = $rs->getString($startcol + 18);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 18; // 18 = ApplicationPeer::NUM_COLUMNS - ApplicationPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 19; // 19 = ApplicationPeer::NUM_COLUMNS - ApplicationPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating Application object", $e);
@@ -1159,6 +1200,9 @@ abstract class BaseApplication extends BaseObject implements Persistent
case 17:
return $this->getAppDelayDuration();
break;
case 18:
return $this->getAppDriveFolderUid();
break;
default:
return null;
break;
@@ -1197,6 +1241,7 @@ abstract class BaseApplication extends BaseObject implements Persistent
$keys[15] => $this->getAppPin(),
$keys[16] => $this->getAppDuration(),
$keys[17] => $this->getAppDelayDuration(),
$keys[18] => $this->getAppDriveFolderUid(),
);
return $result;
}
@@ -1282,6 +1327,9 @@ abstract class BaseApplication extends BaseObject implements Persistent
case 17:
$this->setAppDelayDuration($value);
break;
case 18:
$this->setAppDriveFolderUid($value);
break;
} // switch()
}
@@ -1377,6 +1425,10 @@ abstract class BaseApplication extends BaseObject implements Persistent
$this->setAppDelayDuration($arr[$keys[17]]);
}
if (array_key_exists($keys[18], $arr)) {
$this->setAppDriveFolderUid($arr[$keys[18]]);
}
}
/**
@@ -1460,6 +1512,10 @@ abstract class BaseApplication extends BaseObject implements Persistent
$criteria->add(ApplicationPeer::APP_DELAY_DURATION, $this->app_delay_duration);
}
if ($this->isColumnModified(ApplicationPeer::APP_DRIVE_FOLDER_UID)) {
$criteria->add(ApplicationPeer::APP_DRIVE_FOLDER_UID, $this->app_drive_folder_uid);
}
return $criteria;
}
@@ -1548,6 +1604,8 @@ abstract class BaseApplication extends BaseObject implements Persistent
$copyObj->setAppDelayDuration($this->app_delay_duration);
$copyObj->setAppDriveFolderUid($this->app_drive_folder_uid);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseApplicationPeer
const CLASS_DEFAULT = 'classes.model.Application';
/** The total number of columns. */
const NUM_COLUMNS = 18;
const NUM_COLUMNS = 19;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -85,6 +85,9 @@ abstract class BaseApplicationPeer
/** the column name for the APP_DELAY_DURATION field */
const APP_DELAY_DURATION = 'APPLICATION.APP_DELAY_DURATION';
/** the column name for the APP_DRIVE_FOLDER_UID field */
const APP_DRIVE_FOLDER_UID = 'APPLICATION.APP_DRIVE_FOLDER_UID';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -96,10 +99,10 @@ abstract class BaseApplicationPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('AppUid', 'AppNumber', 'AppParent', 'AppStatus', 'ProUid', 'AppProcStatus', 'AppProcCode', 'AppParallel', 'AppInitUser', 'AppCurUser', 'AppCreateDate', 'AppInitDate', 'AppFinishDate', 'AppUpdateDate', 'AppData', 'AppPin', 'AppDuration', 'AppDelayDuration', ),
BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID, ApplicationPeer::APP_NUMBER, ApplicationPeer::APP_PARENT, ApplicationPeer::APP_STATUS, ApplicationPeer::PRO_UID, ApplicationPeer::APP_PROC_STATUS, ApplicationPeer::APP_PROC_CODE, ApplicationPeer::APP_PARALLEL, ApplicationPeer::APP_INIT_USER, ApplicationPeer::APP_CUR_USER, ApplicationPeer::APP_CREATE_DATE, ApplicationPeer::APP_INIT_DATE, ApplicationPeer::APP_FINISH_DATE, ApplicationPeer::APP_UPDATE_DATE, ApplicationPeer::APP_DATA, ApplicationPeer::APP_PIN, ApplicationPeer::APP_DURATION, ApplicationPeer::APP_DELAY_DURATION, ),
BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'APP_NUMBER', 'APP_PARENT', 'APP_STATUS', 'PRO_UID', 'APP_PROC_STATUS', 'APP_PROC_CODE', 'APP_PARALLEL', 'APP_INIT_USER', 'APP_CUR_USER', 'APP_CREATE_DATE', 'APP_INIT_DATE', 'APP_FINISH_DATE', 'APP_UPDATE_DATE', 'APP_DATA', 'APP_PIN', 'APP_DURATION', 'APP_DELAY_DURATION', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
BasePeer::TYPE_PHPNAME => array ('AppUid', 'AppNumber', 'AppParent', 'AppStatus', 'ProUid', 'AppProcStatus', 'AppProcCode', 'AppParallel', 'AppInitUser', 'AppCurUser', 'AppCreateDate', 'AppInitDate', 'AppFinishDate', 'AppUpdateDate', 'AppData', 'AppPin', 'AppDuration', 'AppDelayDuration', 'AppDriveFolderUid', ),
BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID, ApplicationPeer::APP_NUMBER, ApplicationPeer::APP_PARENT, ApplicationPeer::APP_STATUS, ApplicationPeer::PRO_UID, ApplicationPeer::APP_PROC_STATUS, ApplicationPeer::APP_PROC_CODE, ApplicationPeer::APP_PARALLEL, ApplicationPeer::APP_INIT_USER, ApplicationPeer::APP_CUR_USER, ApplicationPeer::APP_CREATE_DATE, ApplicationPeer::APP_INIT_DATE, ApplicationPeer::APP_FINISH_DATE, ApplicationPeer::APP_UPDATE_DATE, ApplicationPeer::APP_DATA, ApplicationPeer::APP_PIN, ApplicationPeer::APP_DURATION, ApplicationPeer::APP_DELAY_DURATION, ApplicationPeer::APP_DRIVE_FOLDER_UID, ),
BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'APP_NUMBER', 'APP_PARENT', 'APP_STATUS', 'PRO_UID', 'APP_PROC_STATUS', 'APP_PROC_CODE', 'APP_PARALLEL', 'APP_INIT_USER', 'APP_CUR_USER', 'APP_CREATE_DATE', 'APP_INIT_DATE', 'APP_FINISH_DATE', 'APP_UPDATE_DATE', 'APP_DATA', 'APP_PIN', 'APP_DURATION', 'APP_DELAY_DURATION', 'APP_DRIVE_FOLDER_UID', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, )
);
/**
@@ -109,10 +112,10 @@ abstract class BaseApplicationPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppNumber' => 1, 'AppParent' => 2, 'AppStatus' => 3, 'ProUid' => 4, 'AppProcStatus' => 5, 'AppProcCode' => 6, 'AppParallel' => 7, 'AppInitUser' => 8, 'AppCurUser' => 9, 'AppCreateDate' => 10, 'AppInitDate' => 11, 'AppFinishDate' => 12, 'AppUpdateDate' => 13, 'AppData' => 14, 'AppPin' => 15, 'AppDuration' => 16, 'AppDelayDuration' => 17, ),
BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID => 0, ApplicationPeer::APP_NUMBER => 1, ApplicationPeer::APP_PARENT => 2, ApplicationPeer::APP_STATUS => 3, ApplicationPeer::PRO_UID => 4, ApplicationPeer::APP_PROC_STATUS => 5, ApplicationPeer::APP_PROC_CODE => 6, ApplicationPeer::APP_PARALLEL => 7, ApplicationPeer::APP_INIT_USER => 8, ApplicationPeer::APP_CUR_USER => 9, ApplicationPeer::APP_CREATE_DATE => 10, ApplicationPeer::APP_INIT_DATE => 11, ApplicationPeer::APP_FINISH_DATE => 12, ApplicationPeer::APP_UPDATE_DATE => 13, ApplicationPeer::APP_DATA => 14, ApplicationPeer::APP_PIN => 15, ApplicationPeer::APP_DURATION => 16, ApplicationPeer::APP_DELAY_DURATION => 17, ),
BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'APP_NUMBER' => 1, 'APP_PARENT' => 2, 'APP_STATUS' => 3, 'PRO_UID' => 4, 'APP_PROC_STATUS' => 5, 'APP_PROC_CODE' => 6, 'APP_PARALLEL' => 7, 'APP_INIT_USER' => 8, 'APP_CUR_USER' => 9, 'APP_CREATE_DATE' => 10, 'APP_INIT_DATE' => 11, 'APP_FINISH_DATE' => 12, 'APP_UPDATE_DATE' => 13, 'APP_DATA' => 14, 'APP_PIN' => 15, 'APP_DURATION' => 16, 'APP_DELAY_DURATION' => 17, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'AppNumber' => 1, 'AppParent' => 2, 'AppStatus' => 3, 'ProUid' => 4, 'AppProcStatus' => 5, 'AppProcCode' => 6, 'AppParallel' => 7, 'AppInitUser' => 8, 'AppCurUser' => 9, 'AppCreateDate' => 10, 'AppInitDate' => 11, 'AppFinishDate' => 12, 'AppUpdateDate' => 13, 'AppData' => 14, 'AppPin' => 15, 'AppDuration' => 16, 'AppDelayDuration' => 17, 'AppDriveFolderUid' => 18, ),
BasePeer::TYPE_COLNAME => array (ApplicationPeer::APP_UID => 0, ApplicationPeer::APP_NUMBER => 1, ApplicationPeer::APP_PARENT => 2, ApplicationPeer::APP_STATUS => 3, ApplicationPeer::PRO_UID => 4, ApplicationPeer::APP_PROC_STATUS => 5, ApplicationPeer::APP_PROC_CODE => 6, ApplicationPeer::APP_PARALLEL => 7, ApplicationPeer::APP_INIT_USER => 8, ApplicationPeer::APP_CUR_USER => 9, ApplicationPeer::APP_CREATE_DATE => 10, ApplicationPeer::APP_INIT_DATE => 11, ApplicationPeer::APP_FINISH_DATE => 12, ApplicationPeer::APP_UPDATE_DATE => 13, ApplicationPeer::APP_DATA => 14, ApplicationPeer::APP_PIN => 15, ApplicationPeer::APP_DURATION => 16, ApplicationPeer::APP_DELAY_DURATION => 17, ApplicationPeer::APP_DRIVE_FOLDER_UID => 18, ),
BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'APP_NUMBER' => 1, 'APP_PARENT' => 2, 'APP_STATUS' => 3, 'PRO_UID' => 4, 'APP_PROC_STATUS' => 5, 'APP_PROC_CODE' => 6, 'APP_PARALLEL' => 7, 'APP_INIT_USER' => 8, 'APP_CUR_USER' => 9, 'APP_CREATE_DATE' => 10, 'APP_INIT_DATE' => 11, 'APP_FINISH_DATE' => 12, 'APP_UPDATE_DATE' => 13, 'APP_DATA' => 14, 'APP_PIN' => 15, 'APP_DURATION' => 16, 'APP_DELAY_DURATION' => 17, 'APP_DRIVE_FOLDER_UID' => 18, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, )
);
/**
@@ -249,6 +252,8 @@ abstract class BaseApplicationPeer
$criteria->addSelectColumn(ApplicationPeer::APP_DELAY_DURATION);
$criteria->addSelectColumn(ApplicationPeer::APP_DRIVE_FOLDER_UID);
}
const COUNT = 'COUNT(APPLICATION.APP_UID)';

View File

@@ -237,6 +237,12 @@ abstract class BaseUsers extends BaseObject implements Persistent
*/
protected $usr_unit_cost = '';
/**
* The value for the usr_pmdrive_folder_uid field.
* @var string
*/
protected $usr_pmdrive_folder_uid = '';
/**
* The value for the usr_bookmark_start_cases field.
* @var string
@@ -738,6 +744,17 @@ abstract class BaseUsers extends BaseObject implements Persistent
return $this->usr_unit_cost;
}
/**
* Get the [usr_pmdrive_folder_uid] column value.
*
* @return string
*/
public function getUsrPmdriveFolderUid()
{
return $this->usr_pmdrive_folder_uid;
}
/**
* Get the [usr_bookmark_start_cases] column value.
*
@@ -1563,6 +1580,28 @@ abstract class BaseUsers extends BaseObject implements Persistent
} // setUsrUnitCost()
/**
* Set the value of [usr_pmdrive_folder_uid] column.
*
* @param string $v new value
* @return void
*/
public function setUsrPmdriveFolderUid($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->usr_pmdrive_folder_uid !== $v || $v === '') {
$this->usr_pmdrive_folder_uid = $v;
$this->modifiedColumns[] = UsersPeer::USR_PMDRIVE_FOLDER_UID;
}
} // setUsrPmdriveFolderUid()
/**
* Set the value of [usr_bookmark_start_cases] column.
*
@@ -1716,7 +1755,9 @@ abstract class BaseUsers extends BaseObject implements Persistent
$this->usr_unit_cost = $rs->getString($startcol + 34);
$this->usr_bookmark_start_cases = $rs->getString($startcol + 35);
$this->usr_pmdrive_folder_uid = $rs->getString($startcol + 35);
$this->usr_bookmark_start_cases = $rs->getString($startcol + 36);
$this->usr_time_zone = $rs->getString($startcol + 36);
@@ -1727,7 +1768,11 @@ abstract class BaseUsers extends BaseObject implements Persistent
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
<<<<<<< HEAD
return $startcol + 38; // 38 = UsersPeer::NUM_COLUMNS - UsersPeer::NUM_LAZY_LOAD_COLUMNS).
=======
return $startcol + 37; // 37 = UsersPeer::NUM_COLUMNS - UsersPeer::NUM_LAZY_LOAD_COLUMNS).
>>>>>>> upstream/3.0.1.6-Gmail
} catch (Exception $e) {
throw new PropelException("Error populating Users object", $e);
@@ -2037,6 +2082,9 @@ abstract class BaseUsers extends BaseObject implements Persistent
return $this->getUsrUnitCost();
break;
case 35:
return $this->getUsrPmdriveFolderUid();
break;
case 36:
return $this->getUsrBookmarkStartCases();
break;
case 36:
@@ -2240,6 +2288,9 @@ abstract class BaseUsers extends BaseObject implements Persistent
$this->setUsrUnitCost($value);
break;
case 35:
$this->setUsrPmdriveFolderUid($value);
break;
case 36:
$this->setUsrBookmarkStartCases($value);
break;
case 36:
@@ -2412,7 +2463,11 @@ abstract class BaseUsers extends BaseObject implements Persistent
}
if (array_key_exists($keys[35], $arr)) {
$this->setUsrBookmarkStartCases($arr[$keys[35]]);
$this->setUsrPmdriveFolderUid($arr[$keys[35]]);
}
if (array_key_exists($keys[36], $arr)) {
$this->setUsrBookmarkStartCases($arr[$keys[36]]);
}
if (array_key_exists($keys[36], $arr)) {
@@ -2574,6 +2629,10 @@ abstract class BaseUsers extends BaseObject implements Persistent
$criteria->add(UsersPeer::USR_UNIT_COST, $this->usr_unit_cost);
}
if ($this->isColumnModified(UsersPeer::USR_PMDRIVE_FOLDER_UID)) {
$criteria->add(UsersPeer::USR_PMDRIVE_FOLDER_UID, $this->usr_pmdrive_folder_uid);
}
if ($this->isColumnModified(UsersPeer::USR_BOOKMARK_START_CASES)) {
$criteria->add(UsersPeer::USR_BOOKMARK_START_CASES, $this->usr_bookmark_start_cases);
}
@@ -2708,6 +2767,8 @@ abstract class BaseUsers extends BaseObject implements Persistent
$copyObj->setUsrUnitCost($this->usr_unit_cost);
$copyObj->setUsrPmdriveFolderUid($this->usr_pmdrive_folder_uid);
$copyObj->setUsrBookmarkStartCases($this->usr_bookmark_start_cases);
$copyObj->setUsrTimeZone($this->usr_time_zone);

View File

@@ -136,6 +136,9 @@ abstract class BaseUsersPeer
/** the column name for the USR_UNIT_COST field */
const USR_UNIT_COST = 'USERS.USR_UNIT_COST';
/** the column name for the USR_PMDRIVE_FOLDER_UID field */
const USR_PMDRIVE_FOLDER_UID = 'USERS.USR_PMDRIVE_FOLDER_UID';
/** the column name for the USR_BOOKMARK_START_CASES field */
const USR_BOOKMARK_START_CASES = 'USERS.USR_BOOKMARK_START_CASES';
@@ -169,10 +172,17 @@ abstract class BaseUsersPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
<<<<<<< HEAD
BasePeer::TYPE_PHPNAME => array ('UsrUid' => 0, 'UsrUsername' => 1, 'UsrPassword' => 2, 'UsrFirstname' => 3, 'UsrLastname' => 4, 'UsrEmail' => 5, 'UsrDueDate' => 6, 'UsrCreateDate' => 7, 'UsrUpdateDate' => 8, 'UsrStatus' => 9, 'UsrCountry' => 10, 'UsrCity' => 11, 'UsrLocation' => 12, 'UsrAddress' => 13, 'UsrPhone' => 14, 'UsrFax' => 15, 'UsrCellular' => 16, 'UsrZipCode' => 17, 'DepUid' => 18, 'UsrPosition' => 19, 'UsrResume' => 20, 'UsrBirthday' => 21, 'UsrRole' => 22, 'UsrReportsTo' => 23, 'UsrReplacedBy' => 24, 'UsrUx' => 25, 'UsrTotalInbox' => 26, 'UsrTotalDraft' => 27, 'UsrTotalCancelled' => 28, 'UsrTotalParticipated' => 29, 'UsrTotalPaused' => 30, 'UsrTotalCompleted' => 31, 'UsrTotalUnassigned' => 32, 'UsrCostByHour' => 33, 'UsrUnitCost' => 34, 'UsrBookmarkStartCases' => 35, 'UsrTimeZone' => 36, 'UsrDefaultLang' => 37, ),
BasePeer::TYPE_COLNAME => array (UsersPeer::USR_UID => 0, UsersPeer::USR_USERNAME => 1, UsersPeer::USR_PASSWORD => 2, UsersPeer::USR_FIRSTNAME => 3, UsersPeer::USR_LASTNAME => 4, UsersPeer::USR_EMAIL => 5, UsersPeer::USR_DUE_DATE => 6, UsersPeer::USR_CREATE_DATE => 7, UsersPeer::USR_UPDATE_DATE => 8, UsersPeer::USR_STATUS => 9, UsersPeer::USR_COUNTRY => 10, UsersPeer::USR_CITY => 11, UsersPeer::USR_LOCATION => 12, UsersPeer::USR_ADDRESS => 13, UsersPeer::USR_PHONE => 14, UsersPeer::USR_FAX => 15, UsersPeer::USR_CELLULAR => 16, UsersPeer::USR_ZIP_CODE => 17, UsersPeer::DEP_UID => 18, UsersPeer::USR_POSITION => 19, UsersPeer::USR_RESUME => 20, UsersPeer::USR_BIRTHDAY => 21, UsersPeer::USR_ROLE => 22, UsersPeer::USR_REPORTS_TO => 23, UsersPeer::USR_REPLACED_BY => 24, UsersPeer::USR_UX => 25, UsersPeer::USR_TOTAL_INBOX => 26, UsersPeer::USR_TOTAL_DRAFT => 27, UsersPeer::USR_TOTAL_CANCELLED => 28, UsersPeer::USR_TOTAL_PARTICIPATED => 29, UsersPeer::USR_TOTAL_PAUSED => 30, UsersPeer::USR_TOTAL_COMPLETED => 31, UsersPeer::USR_TOTAL_UNASSIGNED => 32, UsersPeer::USR_COST_BY_HOUR => 33, UsersPeer::USR_UNIT_COST => 34, UsersPeer::USR_BOOKMARK_START_CASES => 35, UsersPeer::USR_TIME_ZONE => 36, UsersPeer::USR_DEFAULT_LANG => 37, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID' => 0, 'USR_USERNAME' => 1, 'USR_PASSWORD' => 2, 'USR_FIRSTNAME' => 3, 'USR_LASTNAME' => 4, 'USR_EMAIL' => 5, 'USR_DUE_DATE' => 6, 'USR_CREATE_DATE' => 7, 'USR_UPDATE_DATE' => 8, 'USR_STATUS' => 9, 'USR_COUNTRY' => 10, 'USR_CITY' => 11, 'USR_LOCATION' => 12, 'USR_ADDRESS' => 13, 'USR_PHONE' => 14, 'USR_FAX' => 15, 'USR_CELLULAR' => 16, 'USR_ZIP_CODE' => 17, 'DEP_UID' => 18, 'USR_POSITION' => 19, 'USR_RESUME' => 20, 'USR_BIRTHDAY' => 21, 'USR_ROLE' => 22, 'USR_REPORTS_TO' => 23, 'USR_REPLACED_BY' => 24, 'USR_UX' => 25, 'USR_TOTAL_INBOX' => 26, 'USR_TOTAL_DRAFT' => 27, 'USR_TOTAL_CANCELLED' => 28, 'USR_TOTAL_PARTICIPATED' => 29, 'USR_TOTAL_PAUSED' => 30, 'USR_TOTAL_COMPLETED' => 31, 'USR_TOTAL_UNASSIGNED' => 32, 'USR_COST_BY_HOUR' => 33, 'USR_UNIT_COST' => 34, 'USR_BOOKMARK_START_CASES' => 35, 'USR_TIME_ZONE' => 36, 'USR_DEFAULT_LANG' => 37, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, )
=======
BasePeer::TYPE_PHPNAME => array ('UsrUid' => 0, 'UsrUsername' => 1, 'UsrPassword' => 2, 'UsrFirstname' => 3, 'UsrLastname' => 4, 'UsrEmail' => 5, 'UsrDueDate' => 6, 'UsrCreateDate' => 7, 'UsrUpdateDate' => 8, 'UsrStatus' => 9, 'UsrCountry' => 10, 'UsrCity' => 11, 'UsrLocation' => 12, 'UsrAddress' => 13, 'UsrPhone' => 14, 'UsrFax' => 15, 'UsrCellular' => 16, 'UsrZipCode' => 17, 'DepUid' => 18, 'UsrPosition' => 19, 'UsrResume' => 20, 'UsrBirthday' => 21, 'UsrRole' => 22, 'UsrReportsTo' => 23, 'UsrReplacedBy' => 24, 'UsrUx' => 25, 'UsrTotalInbox' => 26, 'UsrTotalDraft' => 27, 'UsrTotalCancelled' => 28, 'UsrTotalParticipated' => 29, 'UsrTotalPaused' => 30, 'UsrTotalCompleted' => 31, 'UsrTotalUnassigned' => 32, 'UsrCostByHour' => 33, 'UsrUnitCost' => 34, 'UsrPmdriveFolderUid' => 35, 'UsrBookmarkStartCases' => 36, ),
BasePeer::TYPE_COLNAME => array (UsersPeer::USR_UID => 0, UsersPeer::USR_USERNAME => 1, UsersPeer::USR_PASSWORD => 2, UsersPeer::USR_FIRSTNAME => 3, UsersPeer::USR_LASTNAME => 4, UsersPeer::USR_EMAIL => 5, UsersPeer::USR_DUE_DATE => 6, UsersPeer::USR_CREATE_DATE => 7, UsersPeer::USR_UPDATE_DATE => 8, UsersPeer::USR_STATUS => 9, UsersPeer::USR_COUNTRY => 10, UsersPeer::USR_CITY => 11, UsersPeer::USR_LOCATION => 12, UsersPeer::USR_ADDRESS => 13, UsersPeer::USR_PHONE => 14, UsersPeer::USR_FAX => 15, UsersPeer::USR_CELLULAR => 16, UsersPeer::USR_ZIP_CODE => 17, UsersPeer::DEP_UID => 18, UsersPeer::USR_POSITION => 19, UsersPeer::USR_RESUME => 20, UsersPeer::USR_BIRTHDAY => 21, UsersPeer::USR_ROLE => 22, UsersPeer::USR_REPORTS_TO => 23, UsersPeer::USR_REPLACED_BY => 24, UsersPeer::USR_UX => 25, UsersPeer::USR_TOTAL_INBOX => 26, UsersPeer::USR_TOTAL_DRAFT => 27, UsersPeer::USR_TOTAL_CANCELLED => 28, UsersPeer::USR_TOTAL_PARTICIPATED => 29, UsersPeer::USR_TOTAL_PAUSED => 30, UsersPeer::USR_TOTAL_COMPLETED => 31, UsersPeer::USR_TOTAL_UNASSIGNED => 32, UsersPeer::USR_COST_BY_HOUR => 33, UsersPeer::USR_UNIT_COST => 34, UsersPeer::USR_PMDRIVE_FOLDER_UID => 35, UsersPeer::USR_BOOKMARK_START_CASES => 36, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID' => 0, 'USR_USERNAME' => 1, 'USR_PASSWORD' => 2, 'USR_FIRSTNAME' => 3, 'USR_LASTNAME' => 4, 'USR_EMAIL' => 5, 'USR_DUE_DATE' => 6, 'USR_CREATE_DATE' => 7, 'USR_UPDATE_DATE' => 8, 'USR_STATUS' => 9, 'USR_COUNTRY' => 10, 'USR_CITY' => 11, 'USR_LOCATION' => 12, 'USR_ADDRESS' => 13, 'USR_PHONE' => 14, 'USR_FAX' => 15, 'USR_CELLULAR' => 16, 'USR_ZIP_CODE' => 17, 'DEP_UID' => 18, 'USR_POSITION' => 19, 'USR_RESUME' => 20, 'USR_BIRTHDAY' => 21, 'USR_ROLE' => 22, 'USR_REPORTS_TO' => 23, 'USR_REPLACED_BY' => 24, 'USR_UX' => 25, 'USR_TOTAL_INBOX' => 26, 'USR_TOTAL_DRAFT' => 27, 'USR_TOTAL_CANCELLED' => 28, 'USR_TOTAL_PARTICIPATED' => 29, 'USR_TOTAL_PAUSED' => 30, 'USR_TOTAL_COMPLETED' => 31, 'USR_TOTAL_UNASSIGNED' => 32, 'USR_COST_BY_HOUR' => 33, 'USR_UNIT_COST' => 34, 'USR_PMDRIVE_FOLDER_UID' => 35, 'USR_BOOKMARK_START_CASES' => 36, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, )
>>>>>>> upstream/3.0.1.6-Gmail
);
/**
@@ -343,6 +353,8 @@ abstract class BaseUsersPeer
$criteria->addSelectColumn(UsersPeer::USR_UNIT_COST);
$criteria->addSelectColumn(UsersPeer::USR_PMDRIVE_FOLDER_UID);
$criteria->addSelectColumn(UsersPeer::USR_BOOKMARK_START_CASES);
$criteria->addSelectColumn(UsersPeer::USR_TIME_ZONE);

View File

@@ -39,6 +39,7 @@
<column name="APP_PIN" type="VARCHAR" size="32" required="true" default=""/>
<column name="APP_DURATION" type="DOUBLE" default="0"/>
<column name="APP_DELAY_DURATION" type="DOUBLE" default="0"/>
<column name="APP_DRIVE_FOLDER_UID" type="VARCHAR" size="32" default="" required="false"/>
<validator column="APP_STATUS">
<rule name="validValues" value="DRAFT|TO_DO|PAUSED|COMPLETED|CANCELLED" message="Please select a valid status." />
</validator>
@@ -180,6 +181,16 @@
<column name="APP_DOC_STATUS" type="VARCHAR" size="32" required="true" default="ACTIVE"/>
<column name="APP_DOC_STATUS_DATE" type="TIMESTAMP"/>
<column name="APP_DOC_FIELDNAME" type="VARCHAR" size="150" />
<column name="APP_DOC_DRIVE_DOWNLOAD" type="LONGVARCHAR" required="false">
<vendor type="mysql">
<parameter name="Field" value="APP_DOC_DRIVE_DOWNLOAD"/>
<parameter name="Type" value="MEDIUMTEXT"/>
<parameter name="Null" value="YES"/>
<parameter name="Key" value=""/>
<parameter name="Default" value=""/>
<parameter name="Extra" value=""/>
</vendor>
</column>
<validator column="APP_DOC_UID">
<rule name="maxLength" value="32" message="Application Document UID can be no larger than ${value} in size"/>
<rule name="required" message="Application Document UID is required."/>
@@ -1483,6 +1494,7 @@
<column name="USR_TOTAL_UNASSIGNED" type="INTEGER" default="0"/>
<column name="USR_COST_BY_HOUR" type="DECIMAL" size="7,2" required="false" default="0"/>
<column name="USR_UNIT_COST" type="VARCHAR" size="50" required="false" default=""/>
<column name="USR_PMDRIVE_FOLDER_UID" type="VARCHAR" size="32" default="" required="false"/>
<column name="USR_BOOKMARK_START_CASES" type="LONGVARCHAR" required="false">
<vendor type="mysql">
<parameter name="Field" value="USR_BOOKMARK_START_CASES"/>

View File

@@ -84,6 +84,12 @@ class Designer extends Controller
$this->setVar('isDebugMode', $debug);
$this->setVar("distribution", $distribution);
/*----------------------------------********---------------------------------*/
$this->setVar("SYS_SYS", SYS_SYS);
$this->setVar("SYS_LANG", SYS_LANG);
$this->setVar("SYS_SKIN", SYS_SKIN);
/*----------------------------------********---------------------------------*/
if ($debug) {
if (! file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) {
throw new RuntimeException("Development JS Files were are not generated!.\nPlease execute: \$>rake pmBuildDebug in pmUI project");

View File

@@ -0,0 +1,143 @@
<?php
/**
* pmGmail controller
* @inherits Controller
*
* @access public
*/
class pmGmail extends Controller
{
public function saveConfigPmGmail($httpData)
{
G::LoadClass( "pmGoogleApi" );
$pmGoogle = new PMGoogleApi();
$result = new StdClass();
$result->success = true;
if (!empty($httpData->status_pmgmail)) {
$httpData->status_pmgmail = $httpData->status_pmgmail == 1 ? true : false;
$pmGoogle->setStatusService($httpData->status_pmgmail);
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->status_pmgmail ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
$pmGoogle->setTypeAuthentication($httpData->typeAuth);
if (!empty($httpData->email_service_account)) {
$pmGoogle->setServiceAccountEmail($httpData->email_service_account);
$message .= ', ' . G::LoadTranslation('ID_PMG_EMAIL') . ': ' . $httpData->email_service_account;
}
if (!empty($_FILES)) {
if ($_FILES['file_p12']['error'] != 1) {
if ($_FILES['file_p12']['tmp_name'] != '') {
G::uploadFile($_FILES['file_p12']['tmp_name'], PATH_DATA_SITE, $_FILES['file_p12']['name']);
$pmGoogle->setServiceAccountP12($_FILES['file_p12']['name']);
$message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_p12']['name'];
}
} if ($_FILES['file_json']['error'] != 1) {
if ($_FILES['file_json']['tmp_name'] != '') {
G::uploadFile($_FILES['file_json']['tmp_name'], PATH_DATA_SITE, $_FILES['file_json']['name']);
$pmGoogle->setAccountJson($_FILES['file_json']['name']);
$message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_json']['name'];
}
} else {
$result->success = false;
$result->fileError = true;
print(G::json_encode($result));
die();
}
}
} else {
$pmGoogle->setStatusService(false);
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . G::LoadTranslation('ID_DISABLE');
}
G::auditLog("Update Settings Gmail", $message);
print(G::json_encode($result));
}
public function formPMGmail()
{
try {
$this->includeExtJS('admin/pmGmail');
if (!empty ($_SESSION['__PMGMAIL_ERROR__'])) {
$this->setJSVar('__PMGMAIL_ERROR__', $_SESSION['__PMGMAIL_ERROR__']);
unset($_SESSION['__PMGMAIL_ERROR__']);
}
G::LoadClass( "pmGoogleApi" );
$pmGoogle = new PMGoogleApi();
$accountEmail = $pmGoogle->getServiceAccountEmail();
$fileP12 = $pmGoogle->getServiceAccountP12();
$fileJson = $pmGoogle->getAccountJson();
$fileJson = $fileJson == null ? '' : $fileJson;
$type = $pmGoogle->getTypeAuthentication();
$enablePMGmail = $pmGoogle->getStatusService();
$this->setJSVar('accountEmail', $accountEmail);
$this->setJSVar('fileP12', $fileP12);
$this->setJSVar('enablePMGmail', $enablePMGmail);
$this->setJSVar('fileJson', $fileJson);
$this->setJSVar('typeAuthentication', $type);
G::RenderPage('publish', 'extJs');
} catch (Exception $error) {
$_SESSION['__PMGMAIL_ERROR__'] = $error->getMessage();
die();
}
}
/**
* @param $httpData
*/
public function testConfigPmGmail($httpData)
{
G::LoadClass( "pmGoogleApi" );
$pmGoogle = new PMGoogleApi();
$result = new stdClass();
$result->typeAuth = empty($httpData->typeAuth) ? $pmGoogle->getTypeAuthentication() : $httpData->typeAuth;
if ($result->typeAuth == 'webApplication') {
$result->redirectUrl = $pmGoogle->getRedirectUrl();
$result->pathFileJson = empty($_FILES['file_json']['tmp_name']) ? PATH_DATA_SITE . $pmGoogle->getAccountJson() : $_FILES['file_json']['tmp_name'];
} else {
$result->emailServiceAccount = empty($httpData->email_service_account) ? $pmGoogle->getServiceAccountEmail() : $httpData->email_service_account;
$result->pathServiceAccountP12 = empty($_FILES['file_p12']['tmp_name']) ? PATH_DATA_SITE . $pmGoogle->getserviceAccountP12() : $_FILES['file_p12']['tmp_name'];
}
print(G::json_encode($pmGoogle->testService($result)));
}
/**
*
*/
public function testUserGmail()
{
$criteria = new Criteria();
$criteria->clearSelectColumns();
$criteria->addSelectColumn('COUNT(*) AS NUM_EMAIL');
$criteria->addSelectColumn(UsersPeer::USR_UID);
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
$criteria->addGroupByColumn(UsersPeer::USR_EMAIL);
$rs = UsersPeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$userRepeat = array();
while ($rs->next()) {
$row = $rs->getRow();
if ($row['NUM_EMAIL'] > 1) {
$userRepeat[] = array(
'USR_UID' => $row['USR_UID'],
'FULL_NAME' => $row['USR_FIRSTNAME'] . ' ' . $row['USR_LASTNAME'],
'EMAIL' => $row['USR_EMAIL']
);
}
}
print(G::json_encode($userRepeat));
}
}

View File

@@ -31,6 +31,7 @@ CREATE TABLE `APPLICATION`
`APP_PIN` VARCHAR(32) default '' NOT NULL,
`APP_DURATION` DOUBLE default 0,
`APP_DELAY_DURATION` DOUBLE default 0,
`APP_DRIVE_FOLDER_UID` VARCHAR(32) DEFAULT '',
PRIMARY KEY (`APP_UID`),
KEY `indexApp`(`PRO_UID`, `APP_STATUS`, `APP_UID`),
KEY `indexAppNumber`(`APP_NUMBER`),
@@ -96,6 +97,7 @@ CREATE TABLE `APP_DOCUMENT`
`APP_DOC_STATUS` VARCHAR(32) default 'ACTIVE' NOT NULL,
`APP_DOC_STATUS_DATE` DATETIME,
`APP_DOC_FIELDNAME` VARCHAR(150),
`APP_DOC_DRIVE_DOWNLOAD` MEDIUMTEXT,
PRIMARY KEY (`APP_DOC_UID`,`DOC_VERSION`),
KEY `indexAppDocument`(`FOLDER_UID`, `APP_DOC_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Documents in an Application';
@@ -716,6 +718,7 @@ CREATE TABLE `USERS`
`USR_TOTAL_UNASSIGNED` INTEGER default 0,
`USR_COST_BY_HOUR` DECIMAL(7,2) default 0,
`USR_UNIT_COST` VARCHAR(50) default '',
`USR_PMDRIVE_FOLDER_UID` VARCHAR(32) DEFAULT '',
`USR_BOOKMARK_START_CASES` MEDIUMTEXT,
`USR_TIME_ZONE` VARCHAR(100) default '',
`USR_DEFAULT_LANG` VARCHAR(10) default '',

View File

@@ -26,6 +26,7 @@ $(window).load(function () {
}
}
var sesi = document.location.href;
function loadAjaxParams () {
var url;
var action;
@@ -46,8 +47,13 @@ $(window).load(function () {
}
method = 'POST';
} else if (app_uid){ //In case the form is in running cases
if(sesi.search("gmail") != -1){
action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid + "&gmail=1";
}else{
action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid;
}
url = location.protocol + '//' + location.host;
action = "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid;
url += '/sys' + workspace + '/en/neoclassic/cases/' + action;
method = 'POST';
}
@@ -86,7 +92,11 @@ $(window).load(function () {
arrayRequired.name = "DynaformRequiredFields";
arrayRequired.value = fieldsRequired;
var form = document.getElementsByTagName("form")[0];
form.action = filePost ? filePost : "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid;
if(sesi.search("gmail") != -1){
form.action = filePost ? filePost : "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid + "&gmail=1";
} else {
form.action = filePost ? filePost : "cases_SaveData?UID=" + dyn_uid + "&APP_UID=" + app_uid;
}
form.method = "post";
form.setAttribute("encType", "multipart/form-data");
form.appendChild(dyn_content_history);

View File

@@ -70,9 +70,12 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1) {
$G_TMP_MENU->AddIdRawOption('DASHBOARD', '../dashboard/dashletsList', ucfirst(G::LoadTranslation('ID_DASHBOARD')), '', '', 'settings');
/*----------------------------------********---------------------------------*/
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
$G_TMP_MENU->AddIdRawOption('STRATEGIC_DASHBOARD', '../strategicDashboard/dashboardList', ucfirst(G::LoadTranslation('ID_STRATEGIC_DASHBOARD')), '', '', 'settings');
}
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
$G_TMP_MENU->AddIdRawOption('PMGMAIL', '../pmGmail/formPMGmail', ucfirst(G::LoadTranslation('ID_PMGMAIL')), '', '', 'settings');
}
/*----------------------------------********---------------------------------*/

View File

@@ -1,6 +1,10 @@
<script>
if (typeof window.parent != 'undefined') {
<?php
$enablePMGmail = false;
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.pmDrive.php");
$pmDrive = new PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
if (isset( $_GET['ux'] )) {
switch ($_GET['ux']) {
case 'SIMPLIFIED':
@@ -11,6 +15,8 @@ if (isset( $_GET['ux'] )) {
default:
$url = 'casesListExtJs';
}
} else if( isset( $_GET['gmail']) && !empty($enablePMGmail) && $enablePMGmail==1 ){
$url = 'derivatedGmail';
} else {
$url = 'casesListExtJs';
}
@@ -19,7 +25,11 @@ if (isset( $_GET['ux'] )) {
}
echo " window.parent.location.href = '$url';";
if (isset( $_GET['ux'] )) {
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';
if(PMLicensedFeatures::getSingleton()->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09') && !empty($enablePMGmail) && $enablePMGmail==1){
echo '} else { window.parent.location.href = \'derivatedGmail\'; }';
} else {
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';
}
}
?>
}

View File

@@ -67,6 +67,16 @@ $aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex );
//if there are no user in the delegation row, this case is still in selfservice
if ($aDelegation['USR_UID'] == "") {
$oCase->setCatchUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'] );
//changing email labels if the claim comes from gmail
if(array_key_exists('gmail',$_SESSION) && $_SESSION['gmail'] == 1){
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.labelsGmail.php");
$labGmail = new labelsGmail();
$oResponse = $labGmail->setLabels($sAppUid, $iDelIndex, -1, true);
die( '<script type="text/javascript">
parent.document.getElementById("iframePM").setAttribute("src", "'.$_SESSION["server"].'cases/cases_Open?APP_UID=' . $_SESSION["APPLICATION"] . '&DEL_INDEX=' . $_SESSION["INDEX"] . '&action=unassigned");
</script>' );
}
} else {
G::SendMessageText( G::LoadTranslation( 'ID_CASE_ALREADY_DERIVATED' ), 'error' );
}

View File

@@ -21,11 +21,34 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
parent.location = "../cases/casesStartPage?action=startCase";
</script>');
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
var olink = document.location.href;
olink = ( olink.search("gmail") == -1 ) ? parent.document.location.href : olink;
if(olink.search("gmail") == -1){
parent.location = "../cases/casesStartPage?action=startCase";
} else {
var data = olink.split("?");
var odata = data[1].split("&");
var appUid = odata[0].split("=");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
""
],
"expectReturn": false
};
var x = parent.postMessage(JSON.stringify(dataToSend), "*");
if (x == undefined){
x = parent.parent.postMessage(JSON.stringify(dataToSend), "*");
}
}
</script>');
}
/* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) {
@@ -176,6 +199,8 @@ try {
if (isset( $_SESSION['user_experience'] )) {
$aNextStep['PAGE'] = 'casesListExtJsRedirector?ux=' . $_SESSION['user_experience'];
$debuggerAvailable = false;
} else if( isset( $_SESSION['gmail'] ) ){
$aNextStep['PAGE'] = 'casesListExtJsRedirector?gmail='.$_SESSION['gmail'];
} else {
$aNextStep['PAGE'] = 'casesListExtJsRedirector';
}

View File

@@ -22,6 +22,10 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){
$_SESSION['gmail'] = 1;
}
/* Permissions */
if ($RBAC->userCanAccess( 'PM_CASES' ) != 1) {
switch ($RBAC->userCanAccess( 'PM_CASES' )) {

View File

@@ -27,15 +27,39 @@ if (!isset($_SESSION['USER_LOGGED'])) {
die( '<script type="text/javascript">
try
{
prnt = parent.parent;
top.location = top.location;
var olink = document.location.href;
if(olink.search("gmail") != -1){
var data = olink.split("?");
var odata = data[1].split("&");
var appUid = odata[1].split("=");
var proUid = odata[0].split("=");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
proUid[1]
],
"expectReturn": false
};
var x = parent.postMessage(JSON.stringify(dataToSend), "*");
if (x == undefined){
x = parent.parent.postMessage(JSON.stringify(dataToSend), "*");
}
}else{
prnt = parent.parent;
top.location = top.location;
}
}
catch (err)
catch (err)
{
parent.location = parent.location;
}
</script>');
}
try {
if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) {
throw new Exception( G::LoadTranslation( 'ID_INVALID_APPLICATION_ID_MSG', array ('<a href=\'' . $_SERVER['HTTP_REFERER'] . '\'>{1}</a>',G::LoadTranslation( 'ID_REOPEN' ) ) ) );
@@ -335,6 +359,92 @@ try {
$pathUID = G::getPathFromUID($_SESSION["APPLICATION"]);
$sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP;
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension;
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
if ($pmDrive->getStatusService()) {
$app = new Application();
$user = new Users();
$dataUser = $user->load($_SESSION['USER_LOGGED']);
$pmDrive->setDriveUser($dataUser['USR_EMAIL']);
$appData = $app->Load($_SESSION['APPLICATION']);
if ($appData['APP_DRIVE_FOLDER_UID'] == null) {
$process = new Process();
$process->setProUid($appData['PRO_UID']);
$result = $pmDrive->createFolder($process->getProTitle() . ' - ' . G::LoadTranslation("ID_CASE") . ' #' . $appData['APP_NUMBER'],
$pmDrive->getFolderIdPMDrive($_SESSION['USER_LOGGED']));
$appData['APP_DRIVE_FOLDER_UID'] = $result->id;
$app->update($appData);
}
$result = $pmDrive->uploadFile('application/' . $sExtension, $arrayFileTmpName[$i],
$arrayFileName[$i], $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('ATTACHED', $result->webContentLink);
$fileIdDrive = $result->id;
$aFields['DOC_VERSION'] = $iDocVersion;
$aFields['APP_DOC_UID'] = $sAppDocUid;
$oAppDocument->update($aFields);
//add permissions
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(ApplicationPeer::PRO_UID);
$criteria->addSelectColumn(TaskUserPeer::TAS_UID);
$criteria->addSelectColumn(TaskUserPeer::USR_UID);
$criteria->addSelectColumn(TaskUserPeer::TU_RELATION);
$criteria->add(ApplicationPeer::APP_UID, $_SESSION['APPLICATION']);
$criteria->addJoin(ApplicationPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN);
$dataset = TaskUserPeer::doSelectRs($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$userPermission = array();
$case = new Cases();
while ($dataset->next()) {
$row = $dataset->getRow();
if ($row['TU_RELATION'] == 1) {
//users
$dataUser = $user->load($row['USR_UID']);
if (array_search($dataUser['USR_EMAIL'], $userPermission) === false) {
$userPermission[] = $dataUser['USR_EMAIL'];
}
} else {
//Groups
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
$criteria->addSelectColumn(UsersPeer::USR_UID);
$criteria->add(GroupUserPeer::GRP_UID, $row['USR_UID']);
$criteria->addJoin(GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$oDataset = AppDelegationPeer::doSelectRs($criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dataset->next()) {
$aRow = $oDataset->getRow();
if (array_search($aRow['USR_EMAIL'], $userPermission) === false) {
$userPermission[] = $aRow['USR_EMAIL'];
}
}
}
}
$userPermission = array_unique($userPermission);
foreach ($userPermission as $key => $value) {
$pmDrive->setPermission($appData['APP_DRIVE_FOLDER_UID'], $value, 'user', 'writer');
$pmDrive->setPermission($fileIdDrive, $value);
}
}
}
/*----------------------------------********---------------------------------*/
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document

View File

@@ -1,24 +1,50 @@
<?php
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
try
{
var olink = document.location.href;
if(olink.search("gmail") == -1){
prnt = parent.parent;
top.location = top.location;
} else {
var data = olink.split("?");
var odata = data[1].split("&");
var appUid = odata[1].split("=");
var proUid = odata[0].split("=");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
proUid[1]
],
};
var x = parent.postMessage(JSON.stringify(dataToSend), "*");
if (x == undefined){
x = parent.parent.postMessage(JSON.stringify(dataToSend), "*");
}
}
}catch (err)
{
parent.location = parent.location;
}
</script>');
}
require_once 'classes/model/AppDelegation.php';
$delegation = new AppDelegation();
if( $delegation->alreadyRouted($_SESSION['APPLICATION'],$_SESSION['INDEX']) ) {
G::header('location: ../cases/casesListExtJs');
die();
}
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
{
parent.location = parent.location;
}
</script>');
if(array_key_exists('gmail',$_SESSION) && $_SESSION['gmail'] == 1){
$mUrl = '../cases/cases_Open?APP_UID='.$_SESSION['APPLICATION'].'&DEL_INDEX='.$_SESSION['INDEX'].'&action=sent';
header( 'location:' . $mUrl );
die();
}
G::header('location: ../cases/casesListExtJs');
die();
}
/**
* cases_Step.php
@@ -57,6 +83,10 @@ switch ($RBAC->userCanAccess( 'PM_CASES' )) {
break;
}
if(array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1){
$_SESSION['gmail'] = 1;
}
if ((int) $_SESSION['INDEX'] < 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );
@@ -288,7 +318,11 @@ try {
if ($a->isResponsive()) {
$a->printEdit();
} else {
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', \ProcessMaker\Util\DateTime::convertUtcToTimeZone($Fields['APP_DATA']), 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', ((strtolower($oStep->getStepMode()) != 'edit')? strtolower($oStep->getStepMode()) : ''));
if(array_key_exists('gmail',$_GET) && $_GET['gmail'] == 1){
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', \ProcessMaker\Util\DateTime::convertUtcToTimeZone($Fields['APP_DATA']), 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&gmail=1', '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));
}else{
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', \ProcessMaker\Util\DateTime::convertUtcToTimeZone($Fields['APP_DATA']), 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));
}
}
break;
case 'INPUT_DOCUMENT':
@@ -591,6 +625,130 @@ try {
$oCase->updateCase( $_SESSION['APPLICATION'], $Fields );
//Save data - End
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
if ($pmDrive->getStatusService()) {
$app = new Application();
$user = new Users();
$dataUser = $user->load($_SESSION['USER_LOGGED']);
$pmDrive->setDriveUser($dataUser['USR_EMAIL']);
$applicationUid = $_SESSION['APPLICATION'];
$appData = $app->Load($applicationUid);
if ($appData['APP_DRIVE_FOLDER_UID'] == null) {
$process = new Process();
$process->setProUid($appData['PRO_UID']);
$result = $pmDrive->createFolder($process->getProTitle() . ' - ' . G::LoadTranslation("ID_CASE") . ' #' . $appData['APP_NUMBER'],
$pmDrive->getFolderIdPMDrive($_SESSION['USER_LOGGED']));
$appData['APP_DRIVE_FOLDER_UID'] = $result->id;
$app->update($appData);
}
$fileIdDriveDoc = '';
$fileIdDrivePdf = '';
switch ($aOD['OUT_DOC_GENERATE']) {
case "BOTH":
$result = $pmDrive->uploadFile('application/pdf', $pathOutput . $sFilename . '.pdf',
$sFilenameOriginal . '.pdf', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_PDF', $result->webContentLink);
$fileIdDrivePdf = $result->id;
$result = $pmDrive->uploadFile('application/doc', $pathOutput . $sFilename . '.doc',
$sFilenameOriginal . '.doc', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_DOC', $result->webContentLink);
$fileIdDriveDoc = $result->id;
break;
case "PDF":
$result = $pmDrive->uploadFile('application/pdf', $pathOutput . $sFilename . '.pdf',
$sFilenameOriginal . '.pdf', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_PDF', $result->webContentLink);
$fileIdDrivePdf = $result->id;
break;
case "DOC":
$result = $pmDrive->uploadFile('application/doc', $pathOutput . $sFilename . '.doc',
$sFilenameOriginal . '.doc', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_DOC', $result->webContentLink);
$fileIdDriveDoc = $result->id;
break;
}
$aFields['DOC_VERSION'] = $oAppDocument->getDocVersion();// $docVersion;
$aFields['APP_DOC_UID'] = $oAppDocument->getAppDocUid();//$appDocUid;
$appDocUid = $aFields['APP_DOC_UID'];
$oAppDocument->update($aFields);
//$option = 'pmDrive';
//add permissions
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(ApplicationPeer::PRO_UID);
$criteria->addSelectColumn(TaskUserPeer::TAS_UID);
$criteria->addSelectColumn(TaskUserPeer::USR_UID);
$criteria->addSelectColumn(TaskUserPeer::TU_RELATION);
$criteria->add(ApplicationPeer::APP_UID, $applicationUid);
$criteria->addJoin(ApplicationPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN);
$dataset = ApplicationPeer::doSelectRs($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$userPermission = array();
$case = new Cases();
while ($dataset->next()) {
$row = $dataset->getRow();
if ($row['TU_RELATION'] == 1) {
//users
$dataUser = $user->load($row['USR_UID']);
if (array_search($dataUser['USR_EMAIL'], $userPermission) === false) {
$objectPermissions = $case->getAllObjects($row['PRO_UID'], $applicationUid,
$row['TAS_UID'], $row['USR_UID']);
if (array_search($appDocUid, $objectPermissions['OUTPUT_DOCUMENTS']) !== false) {
$userPermission[] = $dataUser['USR_EMAIL'];
}
}
} else {
//Groups
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
$criteria->addSelectColumn(UsersPeer::USR_UID);
$criteria->add(GroupUserPeer::GRP_UID, $row['USR_UID']);
$criteria->addJoin(GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$oDataset = AppDelegationPeer::doSelectRs($criteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($oDataset->next()) {
$aRow = $oDataset->getRow();
if (array_search($aRow['USR_EMAIL'], $userPermission) === false) {
$objectPermissions = $case->getAllObjects($row['PRO_UID'], $applicationUid,
$row['TAS_UID'], $aRow['USR_UID']);
if (array_search($appDocUid,
$objectPermissions['OUTPUT_DOCUMENTS']) !== false
) {
$userPermission[] = $aRow['USR_EMAIL'];
}
}
}
}
}
$userPermission = array_unique($userPermission);
foreach ($userPermission as $key => $val) {
$pmDrive->setPermission($appData['APP_DRIVE_FOLDER_UID'], $val, 'user', 'writer');
$pmDrive->setPermission($fileIdDrivePdf, $val);
$pmDrive->setPermission($fileIdDriveDoc, $val);
}
}
}
/*----------------------------------********---------------------------------*/
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = & PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
@@ -706,6 +864,29 @@ try {
}
}
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
if ($pmDrive->getStatusService()) {
//change donwload link - drive
$driveDownload = @unserialize($aFields['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('OUTPUT_DOC',
$driveDownload)
) {
$aFields['FILE1'] = $driveDownload['OUTPUT_DOC'];
}
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('OUTPUT_PDF',
$driveDownload)
) {
$aFields['FILE2'] = $driveDownload['OUTPUT_PDF'];
}
}
}
/*----------------------------------********---------------------------------*/
if (($aGields['OUT_DOC_GENERATE'] == 'BOTH') || ($aGields['OUT_DOC_GENERATE'] == '')) {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_ViewOutputDocument1', '', G::array_merges( $aOD, $aFields ), '' );
}

View File

@@ -0,0 +1,49 @@
<?php
$licensedFeatures = & PMLicensedFeatures::getSingleton();
if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
}
$caseId = $_SESSION['APPLICATION'];
$usrUid = $_SESSION['USER_LOGGED'];
$usrName = $_SESSION['USR_FULLNAME'];
$actualIndex = $_SESSION['INDEX'];
$cont = 0;
use \ProcessMaker\Services\Api;
$appDel = new AppDelegation();
$actualThread = $appDel->Load($caseId, $actualIndex);
$actualLastIndex = $actualThread['DEL_PREVIOUS'];
$appDelPrev = $appDel->LoadParallel($caseId);
if($appDelPrev == array()){
$appDelPrev['0'] = $actualThread;
}
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
foreach ($appDelPrev as $app){
if( ($app['DEL_INDEX'] != $actualIndex) && ($app['DEL_PREVIOUS'] != $actualLastIndex) ){ //Sending the email to all threads of the case except the actual thread
$response = $Pmgmail->sendEmail($caseId, "", $app['DEL_INDEX']);
}
}
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.labelsGmail.php");
$oLabels = new labelsGmail();
$oResponse = $oLabels->setLabels($caseId, $actualIndex, $actualLastIndex, false);
$enablePMGmail = false;
G::LoadClass( "pmDrive" );
$pmDrive = new PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
if( $_SESSION['gmail'] === 1 && !empty($enablePMGmail) && $enablePMGmail==1 ){
//$_SESSION['gmail'] = 0;
$mUrl = '/sys'. $_SESSION['WORKSPACE'] .'/en/neoclassic/cases/cases_Open?APP_UID='.$caseId.'&DEL_INDEX='.$actualIndex.'&action=sent';
} else{
$mUrl = 'casesListExtJs';
}
header( 'location:' . $mUrl );

View File

@@ -28,6 +28,12 @@
* @date Jan 3th, 2010
*/
$tBarGmail = false;
if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){
$_SESSION['gmail'] = 1;
$tBarGmail = true;
}
if (! isset( $_GET['APP_UID'] ) || ! isset( $_GET['DEL_INDEX'] )) {
if (isset( $_GET['APP_NUMBER'] )) {
G::LoadClass( 'case' );
@@ -102,6 +108,7 @@ $oHeadPublisher->assign( '_ENV_CURRENT_DATE', $conf->getSystemDate( date( 'Y-m-d
$oHeadPublisher->assign( '_ENV_CURRENT_DATE_NO_FORMAT', date( 'Y-m-d-h-i-A' ) );
$oHeadPublisher->assign( 'idfirstform', is_null( $oStep ) ? '' : $oStep->getStepUidObj() );
$oHeadPublisher->assign( 'appStatus', $case['APP_STATUS'] );
$oHeadPublisher->assign( 'tbarGmail', $tBarGmail);
if(!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) {
$_SESSION['APPLICATION'] = $case['APP_UID'];

View File

@@ -1042,6 +1042,15 @@ class Cases
//$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
/*----------------------------------********---------------------------------*/
$licensedFeatures = &\PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new \PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
$aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);
if (!is_array($aObjectPermissions)) {
$aObjectPermissions = array(
@@ -1147,7 +1156,7 @@ class Cases
$aFields['ID_DELETE'] = \G::LoadTranslation('ID_DELETE');
}
$aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_DOWNLOAD');
$aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION'];
$aFields['DOWNLOAD_LINK'] = "cases/cases_ShowDocument?a=" . $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION'];
$aFields['DOC_VERSION'] = $aRow['DOC_VERSION'];
if (is_array($listing)) {
foreach ($listing as $folderitem) {
@@ -1158,6 +1167,15 @@ class Cases
}
}
}
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aRow['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('INPUT',
$driveDownload) && $enablePMGmail
) {
$aFields['DOWNLOAD_LINK'] = $driveDownload['INPUT'];
}
/*----------------------------------********---------------------------------*/
if ($lastVersion == $aRow['DOC_VERSION']) {
//Show only last version
$aInputDocuments[] = $aFields;
@@ -1228,7 +1246,16 @@ class Cases
$aFields['ID_DELETE'] = G::LoadTranslation('ID_DELETE');
}
$aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_DOWNLOAD');
$aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . $aRow['APP_DOC_UID'];
$aFields['DOWNLOAD_LINK'] = "cases/cases_ShowDocument?a=" . $aRow['APP_DOC_UID'];
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aRow['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('ATTACHED',
$driveDownload) && $enablePMGmail
) {
$aFields['DOWNLOAD_LINK'] = $driveDownload['ATTACHED'];
}
/*----------------------------------********---------------------------------*/
if ($lastVersion == $aRow['DOC_VERSION']) {
//Show only last version
$aInputDocuments[] = $aFields;
@@ -1292,6 +1319,15 @@ class Cases
}
}
}
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aRow['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('INPUT',
$driveDownload) && $enablePMGmail
) {
$aFields['DOWNLOAD_LINK'] = $driveDownload['INPUT'];
}
/*----------------------------------********---------------------------------*/
if ($lastVersion == $aRow['DOC_VERSION']) {
//Show only last version
$aInputDocuments[] = $aFields;
@@ -1335,6 +1371,15 @@ class Cases
//$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
/*----------------------------------********---------------------------------*/
$licensedFeatures = &\PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::LoadClass( "pmDrive" );
$pmDrive = new \PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
$aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);
if (!is_array($aObjectPermissions)) {
$aObjectPermissions = array('DYNAFORMS' => array(-1),'INPUT_DOCUMENTS' => array(-1),'OUTPUT_DOCUMENTS' => array(-1));
@@ -1417,7 +1462,7 @@ class Cases
case "PDF":
$fileDoc = 'javascript:alert("NO DOC")';
$fileDocLabel = " ";
$filePdf = 'cases_ShowOutputDocument?a=' .
$filePdf = 'cases/cases_ShowOutputDocument?a=' .
$aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=pdf&random=' . rand();
$filePdfLabel = ".pdf";
if (is_array($listing)) {
@@ -1431,7 +1476,7 @@ class Cases
}
break;
case "DOC":
$fileDoc = 'cases_ShowOutputDocument?a=' .
$fileDoc = 'cases/cases_ShowOutputDocument?a=' .
$aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=doc&random=' . rand();
$fileDocLabel = ".doc";
$filePdf = 'javascript:alert("NO PDF")';
@@ -1447,7 +1492,7 @@ class Cases
}
break;
case "BOTH":
$fileDoc = 'cases_ShowOutputDocument?a=' .
$fileDoc = 'cases/cases_ShowOutputDocument?a=' .
$aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=doc&random=' . rand();
$fileDocLabel = ".doc";
if (is_array($listing)) {
@@ -1459,7 +1504,7 @@ class Cases
}
}
}
$filePdf = 'cases_ShowOutputDocument?a=' .
$filePdf = 'cases/cases_ShowOutputDocument?a=' .
$aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=pdf&random=' . rand();
$filePdfLabel = ".pdf";
@@ -1480,6 +1525,20 @@ class Cases
} catch (\Exception $oException) {
$sUser = '(USER DELETED)';
}
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($aRow['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('OUTPUT_DOC',
$driveDownload) && $enablePMGmail
) {
$fileDoc = $driveDownload['OUTPUT_DOC'];
}
if ($driveDownload !== false && is_array($driveDownload) && array_key_exists('OUTPUT_PDF',
$driveDownload) && $enablePMGmail
) {
$filePdf = $driveDownload['OUTPUT_PDF'];
}
/*----------------------------------********---------------------------------*/
//if both documents were generated, we choose the pdf one, only if doc was
//generate then choose the doc file.
$firstDocLink = $filePdf;
@@ -2384,7 +2443,7 @@ class Cases
$aConditions[] = array('PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID');
$c->addJoinMC( $aConditions, \Criteria::LEFT_JOIN );
}
$c->setDistinct();
$rs = \TaskPeer::doSelectRS($c);
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);

View File

@@ -260,10 +260,11 @@ class InputDocument
$flagSupervisor = 0;
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$arraySupervisor = $supervisor->getProcessSupervisors($application->getProUid());
$processSupervisor = $supervisor->getProcessSupervisors($application->getProUid(), "ASSIGNED");
$arraySupervisor = $processSupervisor["data"];
foreach ($arraySupervisor as $value) {
if($value["usr_uid"] == $userUid) {
if(!empty($value["usr_uid"]) && $value["usr_uid"] == $userUid) {
$flagSupervisor = 1;
break;
}
@@ -283,6 +284,16 @@ class InputDocument
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
/*----------------------------------********---------------------------------*/
$licensedFeatures = &\PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
\G::LoadClass( "pmDrive" );
$pmDrive = new \PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
@@ -293,6 +304,19 @@ class InputDocument
$row["APP_DOC_FILENAME"] = $arrayAppDocument["APP_DOC_FILENAME"];
$row["APP_DOC_CREATE_USER"] = $configuraction->usersNameFormatBySetParameters($confEnvSetting["format"], $arrayUserData["USR_USERNAME"], $arrayUserData["USR_FIRSTNAME"], $arrayUserData["USR_LASTNAME"]);
$row["APP_DOC_LINK"] = "cases/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"];
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($arrayAppDocument['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && $enablePMGmail
) {
if (array_key_exists('INPUT', $driveDownload)) {
$row['APP_DOC_LINK'] = $driveDownload['INPUT'];
} else if (array_key_exists('ATTACHED', $driveDownload)) {
$row['APP_DOC_LINK'] = $driveDownload['ATTACHED'];
}
}
/*----------------------------------********---------------------------------*/
$arrayInputDocument[] = $this->getAppDocumentDataFromRecord($row);
}
@@ -347,6 +371,15 @@ class InputDocument
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
/*----------------------------------********---------------------------------*/
$licensedFeatures = &\PMLicensedFeatures::getSingleton();
$enablePMGmail = false;
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
\G::LoadClass( "pmDrive" );
$pmDrive = new \PMDrive();
$enablePMGmail = $pmDrive->getStatusService();
}
/*----------------------------------********---------------------------------*/
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
@@ -354,9 +387,23 @@ class InputDocument
$arrayAppDocument = $appDocument->load($row["APP_DOC_UID"], $row["DOC_VERSION"]);
$row["APP_DOC_FILENAME"] = $arrayAppDocument["APP_DOC_FILENAME"];
$row["APP_DOC_CREATE_USER"] = $configuraction->usersNameFormatBySetParameters($confEnvSetting["format"], $arrayUserData["USR_USERNAME"], $arrayUserData["USR_FIRSTNAME"], $arrayUserData["USR_LASTNAME"]);
$row["APP_DOC_LINK"] = "cases/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"];
/*----------------------------------********---------------------------------*/
//change donwload link - drive
$driveDownload = @unserialize($arrayAppDocument['APP_DOC_DRIVE_DOWNLOAD']);
if ($driveDownload !== false && is_array($driveDownload) && $enablePMGmail
) {
if (array_key_exists('INPUT', $driveDownload)) {
$row['APP_DOC_LINK'] = $driveDownload['INPUT'];
} else if (array_key_exists('ATTACHED', $driveDownload)) {
$row['APP_DOC_LINK'] = $driveDownload['ATTACHED'];
}
}
/*----------------------------------********---------------------------------*/
$arrayInputDocument[] = $this->getAppDocumentDataFromRecord($row);
}
@@ -404,7 +451,7 @@ class InputDocument
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
$docrow['app_doc_type'] = $row['TYPE'];
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
$docrow['app_doc_link'] = $row['DOWNLOAD_LINK'];
if ($docrow["app_doc_uid"] == $inputDocumentUid) {
$flagInputDocument = true;

View File

@@ -197,7 +197,7 @@ class OutputDocument
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
$docrow['app_doc_type'] = $row['TYPE'];
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
$docrow['app_doc_link'] = $row['DOWNLOAD_LINK'];
$result[] = $docrow;
}
}
@@ -241,7 +241,7 @@ class OutputDocument
$docrow['app_doc_create_user'] = $row['CREATED_BY'];
$docrow['app_doc_type'] = $row['TYPE'];
$docrow['app_doc_index'] = $row['APP_DOC_INDEX'];
$docrow['app_doc_link'] = 'cases/' . $row['DOWNLOAD_LINK'];
$docrow['app_doc_link'] = $row['DOWNLOAD_LINK'];
if ($docrow['app_doc_uid'] == $applicationDocumentUid) {
$oAppDocument = \AppDocumentPeer::retrieveByPK( $applicationDocumentUid, $row['DOC_VERSION'] );
if (is_null( $oAppDocument )) {
@@ -380,6 +380,129 @@ class OutputDocument
$aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR'];
}
$this->generate( $outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties , $applicationUid);
/*----------------------------------********---------------------------------*/
$licensedFeatures = &\PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
\G::LoadClass( "pmDrive" );
$pmDrive = new \PMDrive();
if ($pmDrive->getStatusService()) {
$app = new \Application();
$user = new \Users();
$dataUser = $user->load($userUid);
$pmDrive->setDriveUser($dataUser['USR_EMAIL']);
$appData = $app->Load($applicationUid);
if ($appData['APP_DRIVE_FOLDER_UID'] == null) {
$process = new \Process();
$process->setProUid($appData['PRO_UID']);
$result = $pmDrive->createFolder($process->getProTitle() . ' - ' . G::LoadTranslation("ID_CASE") . ' #' . $appData['APP_NUMBER'],
$pmDrive->getFolderIdPMDrive($userUid));
$appData['APP_DRIVE_FOLDER_UID'] = $result->id;
$app->update($appData);
}
$fileIdDriveDoc = '';
$fileIdDrivePdf = '';
$sFilenameOriginal = preg_replace('[^A-Za-z0-9_]', '_',
\G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
switch ($aOD['OUT_DOC_GENERATE']) {
case "BOTH":
$result = $pmDrive->uploadFile('application/pdf', $pathOutput . $sFilename . '.pdf',
$sFilenameOriginal . '.pdf', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_PDF', $result->webContentLink);
$fileIdDrivePdf = $result->id;
$result = $pmDrive->uploadFile('application/doc', $pathOutput . $sFilename . '.doc',
$sFilenameOriginal . '.doc', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_DOC', $result->webContentLink);
$fileIdDriveDoc = $result->id;
break;
case "PDF":
$result = $pmDrive->uploadFile('application/pdf', $pathOutput . $sFilename . '.pdf',
$sFilenameOriginal . '.pdf', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_PDF', $result->webContentLink);
$fileIdDrivePdf = $result->id;
break;
case "DOC":
$result = $pmDrive->uploadFile('application/doc', $pathOutput . $sFilename . '.doc',
$sFilenameOriginal . '.doc', $appData['APP_DRIVE_FOLDER_UID']);
$oAppDocument->setDriveDownload('OUTPUT_DOC', $result->webContentLink);
$fileIdDriveDoc = $result->id;
break;
}
$aFields['DOC_VERSION'] = $oAppDocument->getDocVersion();// $docVersion;
$aFields['APP_DOC_UID'] = $oAppDocument->getAppDocUid();//$appDocUid;
$appDocUid = $aFields['APP_DOC_UID'];
$oAppDocument->update($aFields);
//$option = 'pmDrive';
//add permissions
$criteria = new \Criteria('workflow');
$criteria->addSelectColumn(\ApplicationPeer::PRO_UID);
$criteria->addSelectColumn(\TaskUserPeer::TAS_UID);
$criteria->addSelectColumn(\TaskUserPeer::USR_UID);
$criteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
$criteria->add(\ApplicationPeer::APP_UID, $applicationUid);
$criteria->addJoin(\ApplicationPeer::PRO_UID, \TaskPeer::PRO_UID, \Criteria::LEFT_JOIN);
$criteria->addJoin(\TaskPeer::TAS_UID, \TaskUserPeer::TAS_UID, \Criteria::LEFT_JOIN);
$dataset = \ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$userPermission = array();
$case = new \Cases();
while ($dataset->next()) {
$row = $dataset->getRow();
if ($row['TU_RELATION'] == 1) {
//users
$dataUser = $user->load($row['USR_UID']);
if (array_search($dataUser['USR_EMAIL'], $userPermission) === false) {
$objectPermissions = $case->getAllObjects($row['PRO_UID'], $applicationUid,
$row['TAS_UID'], $row['USR_UID']);
if (array_search($appDocUid, $objectPermissions['OUTPUT_DOCUMENTS']) !== false) {
$userPermission[] = $dataUser['USR_EMAIL'];
}
}
} else {
//Groups
$criteria = new \Criteria('workflow');
$criteria->addSelectColumn(\UsersPeer::USR_EMAIL);
$criteria->addSelectColumn(\UsersPeer::USR_UID);
$criteria->add(\GroupUserPeer::GRP_UID, $row['USR_UID']);
$criteria->addJoin(\GroupUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
$oDataset = \AppDelegationPeer::doSelectRS($criteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ( $oDataset->next()) {
$aRow = $oDataset->getRow();
if (array_search($aRow['USR_EMAIL'], $userPermission) === false) {
$objectPermissions = $case->getAllObjects($row['PRO_UID'], $applicationUid,
$row['TAS_UID'], $aRow['USR_UID']);
if (array_search($appDocUid, $objectPermissions['OUTPUT_DOCUMENTS']) !== false) {
$userPermission[] = $aRow['USR_EMAIL'];
}
}
}
}
}
$userPermission = array_unique($userPermission);
foreach ($userPermission as $key => $val) {
$pmDrive->setPermission($appData['APP_DRIVE_FOLDER_UID'], $val, 'user', 'writer');
$pmDrive->setPermission($fileIdDrivePdf, $val);
$pmDrive->setPermission($fileIdDriveDoc, $val);
}
}
}
/*----------------------------------********---------------------------------*/
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
//G::LoadClass('plugin');
$oPluginRegistry = & \PMPluginRegistry::getSingleton();

View File

@@ -0,0 +1,267 @@
<?php
namespace ProcessMaker\BusinessModel;
use \G;
/**
* @copyright Colosa - Bolivia
*/
class Pmgmail {
/**
* Get User by usrGmail
*
* @param string $usr_gmail Unique id of User
*
* return uid
*
*/
public function getUserByEmail($usr_gmail)
{
//getting the user data
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
$oUsers = new \Users();
$response['user'] = $oUsers->loadByUserEmailInArray($usr_gmail);
//getting the skin
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php");
$sysConf = new \System();
$responseSysConfig = $sysConf->getSystemConfiguration( PATH_CONFIG . 'env.ini' );
$response['enviroment'] = $responseSysConfig['default_skin'];
return $response;
}
/**
* Get Application data by appUid
*
* @param string $app_uid Unique id of the app
* @param string $index
*
* return row app_cache_view
*
*/
public function getDraftApp($app_uid, $index=1)
{
$c = new \Criteria( 'workflow' );
$c->clearSelectColumns();
$c->addSelectColumn( \AppCacheViewPeer::APP_NUMBER );
$c->addSelectColumn( \AppCacheViewPeer::APP_STATUS );
$c->addSelectColumn( \AppCacheViewPeer::DEL_INDEX );
$c->addSelectColumn( \AppCacheViewPeer::APP_DEL_PREVIOUS_USER );
$c->addSelectColumn( \AppCacheViewPeer::DEL_DELEGATE_DATE );
$c->addSelectColumn( \AppCacheViewPeer::USR_UID );
$c->addSelectColumn( \AppCacheViewPeer::PRO_UID );
$c->addSelectColumn( \AppCacheViewPeer::APP_PRO_TITLE );
$c->addSelectColumn( \AppCacheViewPeer::APP_TAS_TITLE );
$c->addSelectColumn( \AppCacheViewPeer::DEL_THREAD_STATUS );
$c->addSelectColumn( \AppCacheViewPeer::TAS_UID );
$c->addSelectColumn( \AppCacheViewPeer::DEL_LAST_INDEX );
$c->add( \AppCacheViewPeer::APP_UID, $app_uid );
$c->add( \AppCacheViewPeer::DEL_INDEX, $index );
$rs = \AppCacheViewPeer::doSelectRS( $c );
$rs->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
$rows = Array ();
while ($rs->next()) {
$rows[] = $rs->getRow();
}
return $rows;
}
/**
* Send email using appUid and mail
*
* @param string $app_uid Unique id of the app
* @param string $mail
*
* return uid
*
*/
public function sendEmail($app_uid, $mail, $index)
{
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Application.php");
$oApplication = new \Application();
$formData = $oApplication->Load($app_uid);
$frmData = unserialize($formData['APP_DATA']);
$dataFormToShowString = "";
foreach ($frmData as $field=>$value){
if( ($field != 'SYS_LANG') &&
($field != 'SYS_SKIN') &&
($field != 'SYS_SYS') &&
($field != 'APPLICATION') &&
($field != 'PROCESS') &&
($field != 'TASK') &&
($field != 'INDEX') &&
($field != 'USER_LOGGED') &&
($field != 'USR_USERNAME') &&
($field != 'DYN_CONTENT_HISTORY') &&
($field != 'PIN') ){
$dataFormToShowString .= " " . $field . " " . $value;
}
}
$appData = $this->getDraftApp($app_uid, $index);
foreach ($appData as $application){
$appNumber = $application['APP_NUMBER'];
$appStatus = $application['APP_STATUS'];
$index = $application['DEL_INDEX'];
$prvUsr = $application['APP_DEL_PREVIOUS_USER'];
$delegateDate = $application['DEL_DELEGATE_DATE'];
$nextUsr = $application['USR_UID'];
$proUid = $application['PRO_UID'];
$proName = $application['APP_PRO_TITLE'];
$tasName = $application['APP_TAS_TITLE'];
$threadStatus = $application['DEL_THREAD_STATUS'];
$tasUid = $application['TAS_UID'];
$lastIndex = $application['DEL_LAST_INDEX'];
if($appStatus == "DRAFT"){
$labelID = "PMDRFT";
} else {
$labelID = "PMIBX";
}
if($mail == ""){
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
$oUsers = new \Users();
if($nextUsr == ""){
//Unassigned:
$mail = "";
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php");
$oTaskUsers = new \TaskUser();
$taskUsers = $oTaskUsers->getAllUsersTask($tasUid);
foreach ($taskUsers as $user){
$usrData = $oUsers->loadDetails($user['USR_UID']);
$nextMail = $usrData['USR_EMAIL'];
$mail .= ($mail == '') ? $nextMail : ','. $nextMail;
}
$labelID = "PMUASS";
}else {
$usrData = $oUsers->loadDetails($nextUsr);
$mail = $usrData['USR_EMAIL'];
}
}
//first template
$pathTemplate = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . "pmGmail.html";
if (!file_exists($pathTemplate)){
$file = @fopen($pathTemplate, "w");
fwrite($file, '<div>');
fwrite($file, '<span style="display: none !important;">');
fwrite($file, '-**- Process Name: @#proName<br/>');
fwrite($file, '-**- Case Number: @#appNumber<br/>');
fwrite($file, '-**- Case UID: @#caseUid<br/>');
fwrite($file, '-**- Task Name: @#taskName<br/>');
fwrite($file, '-**- Index: @#index<br/>');
fwrite($file, '-**- Action: @#action<br/>');
fwrite($file, '-**- Previous User: @#prevUser<br/>');
fwrite($file, '-**- Delegate Date: @#delDate<br/>');
fwrite($file, '-**- Process Id: @#proUid<br/>');
fwrite($file, '-**- Type: @#type<br/>');
fwrite($file, '-**- FormFields: @@oform<br/>');
fwrite($file, '</span>');
fwrite($file, '</div>');
fclose($file);
}
$change = array('[', ']', '"');
$fdata = str_replace($change, ' ', $dataFormToShowString);
$aFields = array('proName' => $proName,
'appNumber' => $appNumber,
'caseUid' => $app_uid,
'taskName' => $tasName,
'index' => $index,
'action' => $appStatus,
'prevUser' => $prvUsr,
'delDate' => $delegateDate,
'proUid' => $proUid,
'type' => $labelID,
'oform' => $fdata
);
$subject = "[PM] " .$proName. " (" . $index . ") Case: ". $appNumber;
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.wsBase.php");
$ws = new \wsBase();
$resultMail = $ws->sendMessage(
$app_uid,
'inbox.pm@processmaker.com', //From,
$mail,//To,
'',
'',
$subject,
'pmGmail.html',//template
$aFields, //fields
array(),
true,
0,
array(),
1
);
return $resultMail;
}
return 'The appUid cant be founded';
}
/**
* Get if the license has the feature
*
* return uid
*
*/
public function hasGmailFeature()
{
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.licensedFeatures.php");
$licensedFeatures = new \PMLicensedFeatures();
if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
return false;
}else {
return true;
}
}
/**
* Get the default 'email from account' that is used to send emails in the server email in PM
*
* return uid
*
*/
public function emailAccount()
{
$emailServer = new \EmailServer();
$response = $emailServer->loadDefaultAccount();
return $response['MESS_ACCOUNT'];
}
/**
* Business Model to delete all the labels of an acount
*
* @param string $mail
*
* return uid
*
*/
public function deleteLabels($mail)
{
require_once(PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.labelsGmail.php");
$oLabels = new \labelsGmail();
$response = $oLabels->deletePMGmailLabels($mail);
return $response;
}
}

View File

@@ -0,0 +1,137 @@
<?php
namespace ProcessMaker\Services\Api;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* GmailIntegration Api Controller
*
*
* @protected
*/
class GmailIntegration extends Api
{
/**
* Get User by usr_gmail
*
* @param string $usr_gmail {@from path}
*
*
* @url GET /userexist/:usr_gmail
*
*/
public function doGetUserbyEmail($usr_gmail)
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->getUserByEmail($usr_gmail);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get Application by app_uid
*
* @param string $app_uid {@from path}
*
*
* @url GET /application/:app_uid
*
*/
public function doGetApplication($app_uid)
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->getDraftApp($app_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Send Email
*
* @param string $app_uid {@from path}
* @param string $mail {@from path}
* @param string $index {@from path}
*
*
* @url POST /sendEmail/:app_uid/to/:mail/index/:index
*
*/
public function doPostSendMail($app_uid, $mail, $index)
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->sendEmail($app_uid, $mail, $index);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get if the license has the gmail integration feature
*
*
* @url GET /verifyGmailfeature
*
*/
public function doGetVerifyGmailFeature()
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->hasGmailFeature();
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get the default 'email from account' that is used to send emails in the server email in PM
*
*
* @url GET /current-email-account
*
*/
public function doGetEmailAccount()
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->emailAccount();
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* End Point to delete Labels in an uninstalation of the extension
*
* @param string $mail {@from path}
*
*
* @url POST /deleteLabels/:mail
*
*/
public function doPostDeleteLabels($mail)
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->deleteLabels($mail);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -117,3 +117,7 @@ debug = 1
[alias: google]
authentication = "ProcessMaker\Services\Api\Google\Authentication"
[alias: gmailIntegration]
gmailIntegration = "ProcessMaker\Services\Api\GmailIntegration"
token = "ProcessMaker\Services\Api\GmailToken"

View File

@@ -0,0 +1,415 @@
var saveButton;
var testButton;
var storeUsers;
Ext.onReady(function(){
Ext.QuickTips.init();
testButton = new Ext.Action({
text : _('ID_TEST_CONNECTION'),
disabled : !enablePMGmail,
handler : testSettings
});
saveButton = new Ext.Action({
text : _('ID_SAVE_SETTINGS'),
disabled : true,
handler : saveSettings
});
var configurationPMGmail = new Ext.form.FieldSet({
title: _('ID_PMGMAIL_SETTINGS'),
items: [
{
xtype: 'checkbox',
id: 'status_pmgmail',
name: 'status_pmgmail',
boxLabel: _('ID_ENABLE_PMGMAIL'),
value: 0,
inputValue: 1,
uncheckedValue: 0,
listeners : {
check : function(that, checked) {
changeSettings();
if (checked) {
Ext.getCmp('email_service_account').enable();
Ext.getCmp('status_pmgmail').enable();
Ext.getCmp('file_p12').enable();
} else {
Ext.MessageBox.confirm(
_('ID_CONFIRM'),
_('ID_PMGMAIL_DISABLE'),
function (btn, text) {
if (btn == "yes") {
Ext.getCmp('email_service_account').disable();
Ext.getCmp('file_p12').disable();
Ext.getCmp('typeAuthentication').disable();
Ext.getCmp('file_json').disable();
Ext.getCmp('fileJson').disable();
Ext.getCmp('listUsers').hide();
testButton.disable();
saveButton.disable();
saveSettings();
} else {
Ext.getCmp('typeAuthentication').enable();
Ext.getCmp('file_json').enable();
Ext.getCmp('fileJson').enable();
Ext.getCmp('status_pmgmail').enable();
Ext.getCmp('email_service_account').enable();
Ext.getCmp('file_p12').enable();
Ext.getCmp('status_pmgmail').setValue(1);
return false;
}
}
);
}
}
}
},
{
xtype : 'combo',
id : 'typeAuthentication',
name : 'typeAuthentication',
xtype : 'combo',
fieldLabel : _('GMAIL_TYPE_AUTH'),
hiddenName: 'typeAuth',
mode : 'local',
triggerAction : 'all',
forceSelection: true,
store: new Ext.data.SimpleStore({
fields: ['value','type'],
data: [['webApplication','Web Application'],['serviceAccount', 'Service Account']],
autoLoad: true
}),
submitValue : true,
value: typeAuthentication,
valueField: 'value',
displayField: 'type',
width: 250,
editable: false,
listeners:{
afterRender: function () {
Ext.getCmp('email_service_account').hide();
Ext.getCmp('file_p12').hide();
Ext.getCmp('labelFileP12').hide();
Ext.getCmp('file_json').hide();
Ext.getCmp('fileJson').hide();
if (typeAuthentication == 'webApplication' ) {
Ext.getCmp('file_json').show();
Ext.getCmp('fileJson').show();
} else if (typeAuthentication == 'serviceAccount' ) {
Ext.getCmp('email_service_account').show();
Ext.getCmp('file_p12').show();
Ext.getCmp('labelFileP12').show();
}
},
select: function(combo){
saveButton.disable();
var value = combo.getValue();
if (value == 'webApplication' ) {
Ext.getCmp('email_service_account').hide();
Ext.getCmp('file_p12').hide();
Ext.getCmp('labelFileP12').hide();
Ext.getCmp('file_json').show();
Ext.getCmp('fileJson').show();
} else {
Ext.getCmp('email_service_account').show();
Ext.getCmp('file_p12').show();
Ext.getCmp('labelFileP12').show();
Ext.getCmp('file_json').hide();
Ext.getCmp('fileJson').hide();
}
}
}
},
{
xtype : 'textfield',
id : 'email_service_account',
name : 'email_service_account',
fieldLabel : _('ID_PMG_EMAIL'),
width : 400,
allowBlank : false,
value : accountEmail,
disabled : !enablePMGmail,
listeners : {
change: function(){
changeSettings();
},
focus : function(tb, e) {
Ext.QuickTips.register({
target: tb,
title: _('ID_PMG_EMAIL'),
text: accountEmail
});
}
}
},
{
xtype : 'fileuploadfield',
id : 'file_p12',
emptyText : _('ID_PMG_SELECT_FILE'),
fieldLabel : _('ID_PMG_FILE'),
name : 'file_p12',
buttonText : '',
width : 400,
disabled : !enablePMGmail,
buttonCfg : {
iconCls : 'upload-icon'
},
listeners:{
change : function(){
changeSettings();
},
afterrender:function(cmp){
changeSettings();
cmp.fileInput.set({
accept:'*/p12'
});
}
},
regex : /(.)+((\.p12)(\w)?)$/i,
regexText : _('ID_PMG_TYPE_ACCEPT')
},
{
xtype : 'label',
id : 'labelFileP12',
name : 'labelFileP12',
labelAlign : 'right',
fieldLabel : '',
text : fileP12,
width : 400,
style : "padding-left:180px;"
},
{
xtype : 'fileuploadfield',
id : 'file_json',
emptyText : _('ID_PMG_SELECT_FILE_JSON'),
fieldLabel : _('ID_PMG_FILE_JSON'),
name : 'file_json',
buttonText : '',
width : 400,
disabled : !enablePMGmail,
buttonCfg : {
iconCls : 'upload-icon'
},
listeners:{
change : function(){
changeSettings();
},
afterrender:function(cmp){
changeSettings();
cmp.fileInput.set({
accept:'*/json'
});
}
},
regex : /(.)+((\.json)(\w)?)$/i,
regexText : _('ID_PMG_TYPE_ACCEPT')
},
{
xtype : 'label',
id : 'fileJson',
name : 'fileJson',
labelAlign : 'right',
fieldLabel : '',
text : fileJson,
width : 400,
style : "padding-left:180px;"
}
]
});
var testPMGmail = new Ext.form.FieldSet({
id : 'testPMGmail',
title : _('ID_TEST_CONNECTION'),
hidden : true,
items : [
{
id : 'currentUserName',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_CURRENT_USER'),
text : '',
width : 400
},
{
id : 'rootFolderId',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_ROOT_FOLDER'),
text : '',
width : 400
},
{
id : 'quotaType',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_QUOTA_TYPE'),
text : '',
width : 400
},
{
id : 'quotaBytesTotal',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_QUOTA_TOTAL'),
text : '',
width : 400
},
{
id : 'quotaBytesUsed',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_QUOTA_USED'),
text : '',
width : 400
},
{
id : 'responseGmailTest',
xtype : 'label',
labelAlign : 'right',
labelStyle : 'font-weight:bold;',
fieldLabel : _('SERVER_RESPONSE'),
text : '',
width : 400
}
]
});
storeUsers = new Ext.data.JsonStore({
url: '../pmGmail/testUserGmail',
fields: [
'USR_UID',
'FULL_NAME',
'EMAIL'
]
});
var listViewUsers = new Ext.list.ListView({
store: storeUsers,
singleSelect: true,
emptyText: _('ID_GRID_PAGE_NO_USERS_MESSAGE'),
reserveScrollOffset: true,
columns: [
{
header: _('ID_FULL_NAME'),
width:.4,
dataIndex: 'FULL_NAME'
},{
header: _('ID_EMAIL'),
width:.4,
dataIndex: 'EMAIL'
}]
});
var listUsers = new Ext.form.FieldSet({
id : 'listUsers',
title : _('ID_USERS'),
hidden : true,
items : [
listViewUsers
]
});
var formPMGmail = new Ext.FormPanel({
title : '&nbsp',
id :'formPMGmail',
labelWidth : 170,
labelAlign :'right',
autoScroll : true,
fileUpload : true,
bodyStyle :'padding:5px',
waitMsgTarget : true,
frame : true,
defaults: {
allowBlank: false,
msgTarget: 'side',
align:'center'
},
items:[ configurationPMGmail, testPMGmail, listUsers ],
buttons : [testButton, saveButton]
});
var viewport = new Ext.Viewport({
layout: 'fit',
autoScroll: false,
items: [
formPMGmail
]
});
Ext.getCmp('status_pmgmail').checked = enablePMGmail;
Ext.getCmp('status_pmgmail').setValue(enablePMGmail);
});
var testSettings = function ()
{
storeUsers.reload();
Ext.getCmp('testPMGmail').hide();
Ext.getCmp('listUsers').hide();
Ext.getCmp('currentUserName').setText('');
Ext.getCmp('rootFolderId').setText('');
Ext.getCmp('quotaType').setText('');
Ext.getCmp('quotaBytesTotal').setText('');
Ext.getCmp('quotaBytesUsed').setText('');
Ext.getCmp('responseGmailTest').setText('');
Ext.getCmp('responseGmailTest').container.dom.style.color = 'red';
Ext.getCmp('formPMGmail').getForm().submit( {
url : '../pmGmail/testConfigPmGmail',
waitMsg : _('ID_TEST_CONNECTION'),
waitTitle : "&nbsp;",
timeout : 60000,
success : function(obj, resp) {
Ext.getCmp('testPMGmail').show();
Ext.getCmp('listUsers').show();
var response = Ext.decode(resp.response.responseText);
Ext.getCmp('currentUserName').setText(response.currentUserName);
Ext.getCmp('rootFolderId').setText(response.rootFolderId);
Ext.getCmp('quotaType').setText(response.quotaType);
Ext.getCmp('quotaBytesTotal').setText(response.quotaBytesTotal);
Ext.getCmp('quotaBytesUsed').setText(response.quotaBytesUsed);
Ext.getCmp('responseGmailTest').setText(response.responseGmailTest);
Ext.getCmp('responseGmailTest').container.dom.style.color = 'green';
if (storeUsers.data.length == 0) {
saveButton.enable();
}
},
failure: function(obj, resp) {
Ext.getCmp('testPMGmail').show();
Ext.getCmp('listUsers').hide();
saveButton.disable();
Ext.getCmp('responseGmailTest').setText(resp.result.responseGmailTest);
}
});
};
var saveSettings = function ()
{
Ext.getCmp('formPMGmail').getForm().submit( {
url : '../pmGmail/saveConfigPmGmail',
waitMsg : _('ID_SAVING_PROCESS'),
waitTitle : "&nbsp;",
timeout : 60000,
success : function(obj, resp) {
var response = Ext.decode(resp.response.responseText);
parent.PMExt.notify(_('ID_INFO'),_('ID_SAVED_SUCCESSFULLY'));
location.href = '../pmGmail/formPMGmail';
},
failure: function(obj, resp) {
PMExt.error( _('ID_ERROR'), resp.result.message);
}
});
};
var changeSettings = function()
{
Ext.getCmp('testPMGmail').hide();
Ext.getCmp('listUsers').hide();
if (Ext.getCmp('status_pmgmail').checked) {
testButton.enable();
}
saveButton.disable();
};

View File

@@ -25,6 +25,9 @@
var prj_readonly = "{$prj_readonly}";
var credentials = "{$credentials}";
var distribution = "{$distribution}";
var SYS_SYS = "{$SYS_SYS}";
var SYS_LANG = "{$SYS_LANG}";
var SYS_SKIN = "{$SYS_SKIN}";
</script>
<script type="text/javascript" src="/lib-dev/js/wz_jsgraphics.js"></script>
<script type="text/javascript" src="/lib-dev/js/jquery-1.10.2.min.js"></script>
@@ -75,6 +78,9 @@
var prj_readonly = "{$prj_readonly}";
var credentials = "{$credentials}";
var distribution = "{$distribution}";
var SYS_SYS = "{$SYS_SYS}";
var SYS_LANG = "{$SYS_LANG}";
var SYS_SKIN = "{$SYS_SKIN}";
</script>
<script type="text/javascript" src="/lib/js/mafe-{$buildhash}.js"></script>

View File

@@ -0,0 +1,10 @@
<?php
session_start();
if (isset($_GET['code'])) {
$_SESSION['CODE_GMAIL'] = $_GET['code'];
echo "<SCRIPT language='Javascript' type='text/javascript'>";
echo "window.close()";
echo "</script>";
exit;
}

View File

@@ -0,0 +1,33 @@
<?php
session_start();
if (!isset($_SESSION['USER_LOGGED'])) {
die( '<script type="text/javascript">
try
{
alert("lostSession");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
"",
""
],
"expectReturn": false
};
var x = parent.postMessage(JSON.stringify(dataToSend), "*");
}catch (err)
{
parent.location = parent.location;
}
</script>');
}
if($_GET['form']){
header( 'location:' . $_SESSION['server'] . $_SESSION['PMCase'] );
}else if($_GET['processmap']){
header( 'location:' . $_SESSION['server'] . $_SESSION['PMProcessmap'] );
}else if($_GET['uploaded']){
header( 'location:' . $_SESSION['server'] . $_SESSION['PMUploadedDocuments'] );
} else if($_GET['generated']){
header( 'location:' . $_SESSION['server'] . $_SESSION['PMGeneratedDocuments'] );
}

View File

@@ -0,0 +1,138 @@
<?php
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.bootstrap.php');
$gmailToken = $_GET['gmailToken'];
$gmail = $_GET['gmail'];
$pmtoken = $_GET['pmtoken'];
$pmws = $_GET['pmws'];
$appUid = $_GET['appUid'];
$delIndex = $_GET['delIndex'];
$action = $_GET['action'];
$proUid = $_GET['proUid'];
$server = isset($_GET['server']) ? $_GET['server'] : '';
//We do need the server to continue.
if( !isset($_GET['server']) || $server == "" ){
throw new \Exception(Bootstrap::LoadTranslation( 'ID_GMAIL_NEED_SERVER' ));
}
//First check if the feature is enabled in the license.
$gCurl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/verifyGmailfeature/' );
curl_setopt( $gCurl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
curl_setopt( $gCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $gCurl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $gCurl, CURLOPT_CONNECTTIMEOUT, 0);
$gCurl_response = curl_exec( $gCurl );
curl_close($gCurl);
$gResp = json_decode($gCurl_response);
if($gResp == false){
echo Bootstrap::LoadTranslation( 'ID_NO_LICENSE_FEATURE_ENABLED' );
die;
}
set_time_limit(60);
$curl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/userexist/' . $gmail );
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
$curl_response = curl_exec( $curl );
curl_close($curl);
$decodedResp = json_decode($curl_response);
//getting the enviroment
$enviroment = $decodedResp->enviroment;
if(count($decodedResp->user) > 1){
echo Bootstrap::LoadTranslation( 'ID_EMAIL_MORE_THAN_ONE_USER' );
die;
} else if(count($decodedResp->user) < 1){
echo Bootstrap::LoadTranslation( 'ID_USER_NOT_FOUND' );
die;
}
//validationg if there is an actual PM session
if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp->user['0']->USR_UID){
$url = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='.$gmailToken;
// init curl object
$ch = curl_init();
// define options
$optArray = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false
);
// apply those options
curl_setopt_array($ch, $optArray);
// execute request and get response
$result = curl_exec($ch);
$response = (json_decode($result));
curl_close($ch);
//First validate if this user (mail) corresponds to a PM user
if(isset($response->email) && ($gmail == $response->email)){
//If the email corresponds I get the username and with the gmail user_id the session is created.
if($decodedResp->user['0']->USR_STATUS == "ACTIVE"){
//User Active! lets create the Session
@session_destroy();
session_start();
session_regenerate_id();
if (PHP_VERSION < 5.2) {
setcookie("workspaceSkin", $enviroment, time() + (24 * 60 * 60), "/sys" . $enviroment, "; HttpOnly");
} else {
setcookie("workspaceSkin", $enviroment, time() + (24 * 60 * 60), "/sys" . $enviroment, null, false, true);
}
$_SESSION = array();
$_SESSION['__EE_INSTALLATION__'] = 2;
$_SESSION['__EE_SW_PMLICENSEMANAGER__'] = 1;
$_SESSION['phpLastFileFound'] = '';
$_SESSION['USERNAME_PREVIOUS1'] = $decodedResp->user['0']->USR_USERNAME;
$_SESSION['USERNAME_PREVIOUS2'] = $decodedResp->user['0']->USR_USERNAME;
$_SESSION['WORKSPACE'] = $pmws;
$_SESSION['USER_LOGGED'] = $decodedResp->user['0']->USR_UID;
$_SESSION['USR_USERNAME'] = $decodedResp->user['0']->USR_USERNAME;
$_SESSION['USR_FULLNAME'] = $decodedResp->user['0']->USR_FIRSTNAME. ' ' .$decodedResp->user['0']->USR_LASTNAME;
$_SESSION['__sw__'] = 1;
//session created
} else {
echo Bootstrap::LoadTranslation( 'ID_USER_NOT_ACTIVE' );
die;
}
} else {
echo Bootstrap::LoadTranslation( 'ID_USER_DOES_NOT_CORRESPOND' );
die;
}
}
if ($action == "draft"){
//sending the email
$curlApp = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/sendEmail/' . $appUid . '/to/' . $gmail . '/index/' . $delIndex );
curl_setopt( $curlApp, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
curl_setopt( $curlApp, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $curlApp, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $curlApp, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt( $curlApp, CURLOPT_CONNECTTIMEOUT, 0);
$curl_response_app = curl_exec( $curlApp );
curl_close( $curlApp );
$mainUrl = '/sys'. $pmws .'/en/'. $enviroment .'/cases/open?APP_UID='.$appUid.'&DEL_INDEX='.$delIndex.'&action='.$action.'&gmail=1';
header( 'location:' . $mainUrl );
die;
}
$_SESSION['server'] = 'https://' . $server . '/sys'. $pmws .'/en/'.$enviroment.'/';
$_SESSION['PMCase'] = 'cases/cases_Open?APP_UID='.$appUid.'&DEL_INDEX='.$delIndex.'&action='.$action.'&gmail=1';
$_SESSION['PMProcessmap'] = 'designer?prj_uid=' . $proUid . '&prj_readonly=true&app_uid=' . $appUid;
$_SESSION['PMUploadedDocuments'] = 'cases/ajaxListener?action=uploadedDocuments';
$_SESSION['PMGeneratedDocuments'] = 'cases/casesGenerateDocumentPage_Ajax.php?actionAjax=casesGenerateDocumentPage';
header( 'location:' . 'templateForm.php' );

View File

@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Interface Processmaker</title>
<script type="text/javascript" src="/lib/js/jquery-1.10.2.min.js"></script>
<link rel="stylesheet" href="/lib/pmUI/pmui.min.css">
<script type="text/javascript" >
jQuery(document).ready(function() {
var tid;
var addLoading = function (host, panel, message) {
panel = panel || 'PMContent';
message = message || 'Loading...';
var divLoading = document.createElement('div');
var span = document.createElement('span');
var text = document.createTextNode(message);
divLoading.setAttribute('id', 'PMGmailLoad');
divLoading.setAttribute('style', 'position:absolute; left: 0px;top: 0px;width: 100%;height: 100%;z-index: 9999;background: url('+host+'../../../lib/img/loading.gif) 50% 50% no-repeat #f9f9f9;');
span.setAttribute('style', ' margin-top: 50%; margin-left: 44%; position: absolute; font-weight: bold; font-size: 12px; margin-right: auto;');
span.appendChild(text);
divLoading.appendChild(span);
document.getElementById(panel).appendChild(divLoading);
};
var removeLoading = function () {
document.getElementById('PMGmailLoad').remove();
};
var resizePMDynadorm = function () {
var iframe = document.getElementById('iframePM');
var content = iframe.contentDocument;
if (content != null){
clearInterval(tid);
}
};
jQuery('.pmui-tab-ref').on('click', function(e) {
var currentAttrValue = jQuery(this).attr('href');
jQuery(this).parent('li').addClass('pmui-active').siblings().removeClass('pmui-active');
//url iframe
currentAttrValue = jQuery(this).attr('linkPM');
addLoading(jQuery(this).attr('PMServer'));
$('#iframePM').attr('src', currentAttrValue);
e.preventDefault();
});
$('#iframePM').load( function () {
tid = setInterval(function(){ resizePMDynadorm() }, 500);
removeLoading();
});
var currentAttrValue = jQuery('.pmui-tab-ref');
addLoading(currentAttrValue[0].attributes[3].value);
$('#iframePM').attr('src',currentAttrValue[0].attributes[2].value);
});
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
eventer(messageEvent,function(e) {
parent.parent.postMessage(e.data, 'https://mail.google.com');
},false);
</script>
</head>
<body>
<?php
session_start();
?>
<div class="pmui-tabpanel-tabs_container" style="display: block; height: 40px;">
<ul class="pmui-tabpanel-tabs" style="display:block; float:left;">
<li class="pmui pmui-tabitem pmui-active" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
<i class="pmui-tab-icon"> </i>
<a class="pmui-tab-ref" href="#PMCases" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?form=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
Form
</a>
</li>
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
<i class="pmui-tab-icon"> </i>
<a class="pmui-tab-ref" href="#PMProcessmap" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?processmap=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
Processmap
</a>
</li>
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
<i class="pmui-tab-icon"> </i>
<a class="pmui-tab-ref" href="#PMUploadedDocuments" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?uploaded=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
Uploaded
</a>
</li>
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
<i class="pmui-tab-icon"> </i>
<a class="pmui-tab-ref" href="#PMGeneratedDocuments" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?generated=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
Generated
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab active" id="PMContent">
<iframe id="iframePM" src="" width="100%" height="530" style="overflow:hidden;"></iframe>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html class="js js csstransitions" lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Open Source Workflow Software &amp; Business Process Management BPM</title>
<meta http-equiv="Content-Language" content="en"><meta name="description" content="Open source web based workflow software and Business Process Management software">
<meta name="keywords" content="workflow software"><meta name="googlebot" content="index, follow">
<meta name="robots" content="index, follow">
<meta name="Revisit-After" content="7 days">
<meta name="city" content="Brooklyn">
<meta name="country" content="United States of America (USA)">
<meta name="state" content="NY">
<meta name="zip code" content="11238">
<meta name="geo.region" content="US-NY">
<meta name="geo.placename" content="Brooklyn">
<meta name="DC.title" content="ProcessMaker Inc.">
<meta name="subject" content="Open Source Workflow, Business Process Management (BPM) Soft-ware.">
<meta name="author" content="ProcessMaker Inc.">
<meta name="copyright" content="ProcessMaker Inc."> <link type="text/css" rel="stylesheet" href="index_files/css_xE-rWrJf-fncB6ztZfd2huxqgxu4WO-qwma6Xer30m4.css" media="all">
<link type="text/css" rel="stylesheet" href="../css/general.css" media="all">
<link type="text/css" rel="stylesheet" href="../css/sb-admin-2.css" media="all">
<link rel="shortcut icon" href="http://www.processmaker.com/favicon.ico" type="image/vnd.microsoft.icon">
<link rel="alternate" type="application/rss+xml" title="ProcessMaker RSS" href="http://www.processmaker.com/rss.xml">
<script src="index_files/jsbox.js" class="lazyload" charset="utf-8"></script><script src="index_files/jsglobal.js" class="lazyload" charset="utf-8"></script><script src="index_files/jstrack.js" class="lazyload" charset="utf-8"></script><link type="text/css" rel="stylesheet" href="index_files/style_002.css" class="lazyload" charset="utf-8"><style type="text/css">.lz_chat_mail { color: #000000 !important; }.lz_chat_link { color: #000000 !important; }.lz_chat_file { color: #000000 !important; }.lz_chat_human { color: #000000 !important; }</style><link type="text/css" rel="stylesheet" href="index_files/style.css" class="lazyload" charset="utf-8"><script src="index_files/jsextern.js" class="lazyload" charset="utf-8"></script><style type="text/css">.fancybox-margin{margin-right:16px;}</style></head>
<script>
document.onreadystatechange = function () {
var state = document.readyState
if (state == 'interactive') {
document.getElementById('main-content').style.visibility="hidden";
} else if (state == 'complete') {
document.getElementById('loading').style.visibility="hidden";
document.getElementById('loading').style.display="none";
document.getElementById('main-content').style.visibility="visible";
}
}
</script>
<body class="html front not-logged-in no-sidebars page-node" id="page-top" data-spy="scroll" data-target=".navbar-custom" style="background-color:white;">
<div id="main-content" class="container" style="display:none;">
<div class="row">
<div class="col-lg-12" style="margin: 0 auto;">
<div style="margin: 0 auto; width:600px;padding:25px;">
<div style="margin: 0 auto; text-align:center;margin-top:40px;">
<img src = "../images/logo-processmake-google.png">
</div>
<h2 style="margin: 0 auto; text-align:center; margin-top:40px;">ProcessMaker Google Integration</h2>
<p style="margin: 0 auto; text-align:center; margin-top:10px;">
The ProcessMaker Google Integration extension and components have been uninstalled from your Gmail Acccount.
</p>
</div>
</div>
</div>
</div>
<div id="loading" style="width:120px;margin:0 auto;margin-top:200px;text-align:center;">
<img id="loading-image" src="../images/ext/default/shared/large-loading.gif" alt="Uninstalling..." />
<div>Uninstalling ...</div>
</div>
</body>
</html>
<?php
/*
* Uninstall file to help in the uninstaling process of the PMGmail Extension.
* This deletes the labels created by the Extension in the user email.
*
*/
/**
* Call the end point to delete labels
*
* @param string $server
* @param string $pmws
* @param string $mail
* @param string $pmtoken
*/
function callEndPointDeleteLabels($server, $pmws, $mail, $pmtoken){
set_time_limit(60);
$curl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/deleteLabels/'. $mail );
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
$curl_response = curl_exec( $curl );
curl_close($curl);
}
$server = $_GET['server'];
$pmws = $_GET['pmws'];
$mail = $_GET['mail'];
$pmtoken = $_GET['pmtoken'];
callEndPointDeleteLabels($server, $pmws, $mail, $pmtoken);
?>