Merged 3.0.1.8 into MT-10
This commit is contained in:
@@ -175,6 +175,7 @@ class AppDocumentDrive
|
|||||||
$data = [];
|
$data = [];
|
||||||
while ($rsAppDelegation->next()) {
|
while ($rsAppDelegation->next()) {
|
||||||
$row = $rsAppDelegation->getRow();
|
$row = $rsAppDelegation->getRow();
|
||||||
|
if (!empty($row['USR_UID'])) {
|
||||||
if ($user->userExists($row['USR_UID'])) {
|
if ($user->userExists($row['USR_UID'])) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$data[] = $user->load($row['USR_UID']);
|
$data[] = $user->load($row['USR_UID']);
|
||||||
@@ -186,6 +187,7 @@ class AppDocumentDrive
|
|||||||
$this->addUserEmail($dataUser["USR_EMAIL"]);
|
$this->addUserEmail($dataUser["USR_EMAIL"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
error_log('Error: ' . $exception);
|
error_log('Error: ' . $exception);
|
||||||
}
|
}
|
||||||
@@ -289,7 +291,7 @@ class AppDocumentDrive
|
|||||||
$criteria->addAscendingOrderByColumn('APP_DOC_CREATE_DATE');
|
$criteria->addAscendingOrderByColumn('APP_DOC_CREATE_DATE');
|
||||||
$criteria->addAscendingOrderByColumn('APP_UID');
|
$criteria->addAscendingOrderByColumn('APP_UID');
|
||||||
$rs = AppDocumentPeer::doSelectRS($criteria);
|
$rs = AppDocumentPeer::doSelectRS($criteria);
|
||||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$rs->setFetchMode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
@@ -307,13 +309,13 @@ class AppDocumentDrive
|
|||||||
|
|
||||||
$sw_file_exists_doc = false;
|
$sw_file_exists_doc = false;
|
||||||
$sw_file_exists_pdf = false;
|
$sw_file_exists_pdf = false;
|
||||||
if ($appDoc->getAppDocType() == 'OUTPUT') {
|
$sw_file_exists = false;
|
||||||
//$name = substr($name, 1, -1);
|
$realPath = '';
|
||||||
|
if ($appDoc->getAppDocType() === 'OUTPUT') {
|
||||||
$realPathDoc = PATH_DOCUMENT . $appUid . '/outdocs/' . $appDocUid . '_' . $docVersion . '.' . 'doc';
|
$realPathDoc = PATH_DOCUMENT . $appUid . '/outdocs/' . $appDocUid . '_' . $docVersion . '.' . 'doc';
|
||||||
$realPathDoc1 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '_' . $docVersion . '.' . 'doc';
|
$realPathDoc1 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '_' . $docVersion . '.' . 'doc';
|
||||||
$realPathDoc2 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '.' . 'doc';
|
$realPathDoc2 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '.' . 'doc';
|
||||||
|
|
||||||
$sw_file_exists = false;
|
|
||||||
if (file_exists($realPathDoc)) {
|
if (file_exists($realPathDoc)) {
|
||||||
$sw_file_exists = true;
|
$sw_file_exists = true;
|
||||||
$sw_file_exists_doc = true;
|
$sw_file_exists_doc = true;
|
||||||
@@ -346,7 +348,6 @@ class AppDocumentDrive
|
|||||||
} else {
|
} else {
|
||||||
$realPath = PATH_DOCUMENT . $appUid . '/' . $file[0] . $file[1] . '_' . $docVersion . '.' . $ext;
|
$realPath = PATH_DOCUMENT . $appUid . '/' . $file[0] . $file[1] . '_' . $docVersion . '.' . $ext;
|
||||||
$realPath1 = PATH_DOCUMENT . $appUid . '/' . $file[0] . $file[1] . '.' . $ext;
|
$realPath1 = PATH_DOCUMENT . $appUid . '/' . $file[0] . $file[1] . '.' . $ext;
|
||||||
$sw_file_exists = false;
|
|
||||||
if (file_exists($realPath)) {
|
if (file_exists($realPath)) {
|
||||||
$sw_file_exists = true;
|
$sw_file_exists = true;
|
||||||
} elseif (file_exists($realPath1)) {
|
} elseif (file_exists($realPath1)) {
|
||||||
@@ -370,26 +371,25 @@ class AppDocumentDrive
|
|||||||
eprintln('upload file:' . $name, 'green');
|
eprintln('upload file:' . $name, 'green');
|
||||||
}
|
}
|
||||||
$this->drive->setDriveUser($email);
|
$this->drive->setDriveUser($email);
|
||||||
$info = finfo_open(FILEINFO_MIME_TYPE);
|
|
||||||
$mime = finfo_file($info, $realPath);
|
|
||||||
$type = $appDoc->getAppDocType();
|
|
||||||
|
|
||||||
if ($appDoc->getAppDocType() == 'OUTPUT') {
|
if ($appDoc->getAppDocType() == 'OUTPUT') {
|
||||||
|
|
||||||
if ($sw_file_exists_doc) {
|
if ($sw_file_exists_doc) {
|
||||||
$realPath = $realPathDoc;
|
$result = $this->upload($fields, 'OUTPUT_DOC', 'application/msword', $realPathDoc,
|
||||||
$name = array_pop(explode('/', $realPathDoc));
|
array_pop(explode('/', $realPathDoc)));
|
||||||
$mime = 'application/msword';
|
|
||||||
$type = 'OUTPUT_DOC';
|
|
||||||
}
|
}
|
||||||
if ($sw_file_exists_pdf) {
|
if ($sw_file_exists_pdf) {
|
||||||
$realPath = $realPathPdf;
|
$info = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
$name = array_pop(explode('/', $realPathPdf));
|
$result = $this->upload($fields, 'OUTPUT_PDF', finfo_file($info, $realPathPdf),
|
||||||
$mime = finfo_file($info, $realPathPdf);
|
$realPathPdf, array_pop(explode('/', $realPathPdf)));
|
||||||
$type = 'OUTPUT_PDF';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$info = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
|
$mime = finfo_file($info, $realPath);
|
||||||
|
$type = $appDoc->getAppDocType();
|
||||||
$result = $this->upload($fields, $type, $mime, $realPath, $name);
|
$result = $this->upload($fields, $type, $mime, $realPath, $name);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->drive->setDriveUser($this->user->getUsrEmail());
|
$this->drive->setDriveUser($this->user->getUsrEmail());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5314,8 +5314,6 @@ class Cases
|
|||||||
$oUser = new Users();
|
$oUser = new Users();
|
||||||
|
|
||||||
foreach ($arrayTask as $aTask) {
|
foreach ($arrayTask as $aTask) {
|
||||||
$sTo = null;
|
|
||||||
$sCc = null;
|
|
||||||
|
|
||||||
if (isset($aTask['DEL_INDEX'])) {
|
if (isset($aTask['DEL_INDEX'])) {
|
||||||
$arrayData2 = $arrayData;
|
$arrayData2 = $arrayData;
|
||||||
@@ -5342,8 +5340,11 @@ class Cases
|
|||||||
|
|
||||||
$sBody2 = G::replaceDataGridField($sBody, $arrayData2, false);
|
$sBody2 = G::replaceDataGridField($sBody, $arrayData2, false);
|
||||||
|
|
||||||
switch ($aTask["TAS_ASSIGN_TYPE"]) {
|
$respTo = $this->getTo($aTask["TAS_ASSIGN_TYPE"], $aTask["TAS_UID"], $aTask["USR_UID"], $arrayData);
|
||||||
case "SELF_SERVICE":
|
$sTo = $respTo['to'];
|
||||||
|
$sCc = $respTo['cc'];
|
||||||
|
|
||||||
|
if ($aTask ["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
|
||||||
if ($swtplDefault == 1) {
|
if ($swtplDefault == 1) {
|
||||||
G::verifyPath ( $pathEmail, true ); // Create if it does not exist
|
G::verifyPath ( $pathEmail, true ); // Create if it does not exist
|
||||||
$fileTemplate = $pathEmail . G::LoadTranslation ( 'ID_UNASSIGNED_MESSAGE' );
|
$fileTemplate = $pathEmail . G::LoadTranslation ( 'ID_UNASSIGNED_MESSAGE' );
|
||||||
@@ -5351,123 +5352,8 @@ class Cases
|
|||||||
if ((! file_exists ( $fileTemplate )) && file_exists ( PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation ( 'ID_UNASSIGNED_MESSAGE' ) )) {
|
if ((! file_exists ( $fileTemplate )) && file_exists ( PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation ( 'ID_UNASSIGNED_MESSAGE' ) )) {
|
||||||
@copy ( PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation ( 'ID_UNASSIGNED_MESSAGE' ), $fileTemplate );
|
@copy ( PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation ( 'ID_UNASSIGNED_MESSAGE' ), $fileTemplate );
|
||||||
}
|
}
|
||||||
|
|
||||||
$sBody2 = G::replaceDataField ( file_get_contents ( $fileTemplate ), $arrayData2 );
|
$sBody2 = G::replaceDataField ( file_get_contents ( $fileTemplate ), $arrayData2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aTask["TAS_UID"]) && !empty($aTask["TAS_UID"])) {
|
|
||||||
$arrayTaskUser = array();
|
|
||||||
|
|
||||||
$arrayAux1 = $task->getGroupsOfTask($aTask["TAS_UID"], 1);
|
|
||||||
|
|
||||||
foreach ($arrayAux1 as $arrayGroup) {
|
|
||||||
$arrayAux2 = $group->getUsersOfGroup($arrayGroup["GRP_UID"]);
|
|
||||||
|
|
||||||
foreach ($arrayAux2 as $arrayUser) {
|
|
||||||
$arrayTaskUser[] = $arrayUser["USR_UID"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$arrayAux1 = $task->getUsersOfTask($aTask["TAS_UID"], 1);
|
|
||||||
|
|
||||||
foreach ($arrayAux1 as $arrayUser) {
|
|
||||||
$arrayTaskUser[] = $arrayUser["USR_UID"];
|
|
||||||
}
|
|
||||||
|
|
||||||
$criteria = new Criteria("workflow");
|
|
||||||
|
|
||||||
$criteria->addSelectColumn(UsersPeer::USR_UID);
|
|
||||||
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
|
||||||
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
|
||||||
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
|
||||||
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
|
|
||||||
$criteria->add(UsersPeer::USR_UID, $arrayTaskUser, Criteria::IN);
|
|
||||||
$rsCriteria = UsersPeer::doSelectRs($criteria);
|
|
||||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
$to = null;
|
|
||||||
$cc = null;
|
|
||||||
$sw = 1;
|
|
||||||
|
|
||||||
while ($rsCriteria->next()) {
|
|
||||||
$row = $rsCriteria->getRow();
|
|
||||||
|
|
||||||
$toAux = (
|
|
||||||
(($row["USR_FIRSTNAME"] != "") || ($row["USR_LASTNAME"] != "")) ?
|
|
||||||
$row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : ""
|
|
||||||
) . "<" . $row["USR_EMAIL"] . ">";
|
|
||||||
|
|
||||||
if ($sw == 1) {
|
|
||||||
$to = $toAux;
|
|
||||||
$sw = 0;
|
|
||||||
} else {
|
|
||||||
$cc = $cc . (($cc != null) ? "," : null) . $toAux;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sTo = $to;
|
|
||||||
$sCc = $cc;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "MULTIPLE_INSTANCE":
|
|
||||||
$to = null;
|
|
||||||
$cc = null;
|
|
||||||
$sw = 1;
|
|
||||||
$oDerivation = new Derivation();
|
|
||||||
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($aTask["TAS_UID"]));
|
|
||||||
if(isset($userFields)){
|
|
||||||
foreach($userFields as $row){
|
|
||||||
$toAux = (
|
|
||||||
(($row["USR_FIRSTNAME"] != "") || ($row["USR_LASTNAME"] != "")) ?
|
|
||||||
$row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : ""
|
|
||||||
) . "<" . $row["USR_EMAIL"] . ">";
|
|
||||||
if ($sw == 1) {
|
|
||||||
$to = $toAux;
|
|
||||||
$sw = 0;
|
|
||||||
} else {
|
|
||||||
$cc = $cc . (($cc != null) ? "," : null) . $toAux;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$sTo = $to;
|
|
||||||
$sCc = $cc;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "MULTIPLE_INSTANCE_VALUE_BASED":
|
|
||||||
$aTaskNext = $oTask->load($aTask["TAS_UID"]);
|
|
||||||
if(isset($aTaskNext["TAS_ASSIGN_VARIABLE"]) && !empty($aTaskNext["TAS_ASSIGN_VARIABLE"])){
|
|
||||||
$to = null;
|
|
||||||
$cc = null;
|
|
||||||
$sw = 1;
|
|
||||||
$nextTaskAssignVariable = trim($aTaskNext["TAS_ASSIGN_VARIABLE"], " @#");
|
|
||||||
$arrayUsers = $arrayData[$nextTaskAssignVariable];
|
|
||||||
$oDerivation = new Derivation();
|
|
||||||
$userFields = $oDerivation->getUsersFullNameFromArray($arrayUsers);
|
|
||||||
foreach ($userFields as $row) {
|
|
||||||
$toAux = (
|
|
||||||
(($row["USR_FIRSTNAME"] != "") || ($row["USR_LASTNAME"] != "")) ?
|
|
||||||
$row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : ""
|
|
||||||
) . "<" . $row["USR_EMAIL"] . ">";
|
|
||||||
if ($sw == 1) {
|
|
||||||
$to = $toAux;
|
|
||||||
$sw = 0;
|
|
||||||
} else {
|
|
||||||
$cc = $cc . (($cc != null) ? "," : null) . $toAux;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$sTo = $to;
|
|
||||||
$sCc = $cc;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (isset($aTask["USR_UID"]) && !empty($aTask["USR_UID"])) {
|
|
||||||
$aUser = $oUser->load($aTask["USR_UID"]);
|
|
||||||
|
|
||||||
$sTo = (
|
|
||||||
(($aUser["USR_FIRSTNAME"] != "") || ($aUser["USR_LASTNAME"] != "")) ?
|
|
||||||
$aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . " " : ""
|
|
||||||
) . "<" . $aUser["USR_EMAIL"] . ">";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sTo != null) {
|
if ($sTo != null) {
|
||||||
@@ -5506,6 +5392,124 @@ class Cases
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTo($taskType, $taskUid, $taskUsrUid, $arrayData)
|
||||||
|
{
|
||||||
|
$sTo = null;
|
||||||
|
$sCc = null;
|
||||||
|
$arrayResp = array ();
|
||||||
|
$task = new Tasks ();
|
||||||
|
$group = new Groups ();
|
||||||
|
$oUser = new Users ();
|
||||||
|
|
||||||
|
switch ($taskType) {
|
||||||
|
case "SELF_SERVICE" :
|
||||||
|
if (isset ( $taskUid ) && ! empty ( $taskUid )) {
|
||||||
|
$arrayTaskUser = array ();
|
||||||
|
|
||||||
|
$arrayAux1 = $task->getGroupsOfTask ( $taskUid, 1 );
|
||||||
|
|
||||||
|
foreach ( $arrayAux1 as $arrayGroup ) {
|
||||||
|
$arrayAux2 = $group->getUsersOfGroup ( $arrayGroup ["GRP_UID"] );
|
||||||
|
|
||||||
|
foreach ( $arrayAux2 as $arrayUser ) {
|
||||||
|
$arrayTaskUser [] = $arrayUser ["USR_UID"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayAux1 = $task->getUsersOfTask ( $taskUid, 1 );
|
||||||
|
|
||||||
|
foreach ( $arrayAux1 as $arrayUser ) {
|
||||||
|
$arrayTaskUser [] = $arrayUser ["USR_UID"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = new Criteria ( "workflow" );
|
||||||
|
|
||||||
|
$criteria->addSelectColumn ( UsersPeer::USR_UID );
|
||||||
|
$criteria->addSelectColumn ( UsersPeer::USR_USERNAME );
|
||||||
|
$criteria->addSelectColumn ( UsersPeer::USR_FIRSTNAME );
|
||||||
|
$criteria->addSelectColumn ( UsersPeer::USR_LASTNAME );
|
||||||
|
$criteria->addSelectColumn ( UsersPeer::USR_EMAIL );
|
||||||
|
$criteria->add ( UsersPeer::USR_UID, $arrayTaskUser, Criteria::IN );
|
||||||
|
$rsCriteria = UsersPeer::doSelectRs ( $criteria );
|
||||||
|
$rsCriteria->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|
||||||
|
$to = null;
|
||||||
|
$cc = null;
|
||||||
|
$sw = 1;
|
||||||
|
|
||||||
|
while ( $rsCriteria->next () ) {
|
||||||
|
$row = $rsCriteria->getRow ();
|
||||||
|
|
||||||
|
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
|
||||||
|
|
||||||
|
if ($sw == 1) {
|
||||||
|
$to = $toAux;
|
||||||
|
$sw = 0;
|
||||||
|
} else {
|
||||||
|
$cc = $cc . (($cc != null) ? "," : null) . $toAux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$arrayResp ['to'] = $to;
|
||||||
|
$arrayResp ['cc'] = $cc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "MULTIPLE_INSTANCE" :
|
||||||
|
$to = null;
|
||||||
|
$cc = null;
|
||||||
|
$sw = 1;
|
||||||
|
$oDerivation = new Derivation ();
|
||||||
|
$userFields = $oDerivation->getUsersFullNameFromArray ( $oDerivation->getAllUsersFromAnyTask ( $taskUid ) );
|
||||||
|
if (isset ( $userFields )) {
|
||||||
|
foreach ( $userFields as $row ) {
|
||||||
|
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
|
||||||
|
if ($sw == 1) {
|
||||||
|
$to = $toAux;
|
||||||
|
$sw = 0;
|
||||||
|
} else {
|
||||||
|
$cc = $cc . (($cc != null) ? "," : null) . $toAux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$arrayResp ['to'] = $to;
|
||||||
|
$arrayResp ['cc'] = $cc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "MULTIPLE_INSTANCE_VALUE_BASED" :
|
||||||
|
$oTask = new Task ();
|
||||||
|
$aTaskNext = $oTask->load ( $taskUid );
|
||||||
|
if (isset ( $aTaskNext ["TAS_ASSIGN_VARIABLE"] ) && ! empty ( $aTaskNext ["TAS_ASSIGN_VARIABLE"] )) {
|
||||||
|
$to = null;
|
||||||
|
$cc = null;
|
||||||
|
$sw = 1;
|
||||||
|
$nextTaskAssignVariable = trim ( $aTaskNext ["TAS_ASSIGN_VARIABLE"], " @#" );
|
||||||
|
$arrayUsers = $arrayData [$nextTaskAssignVariable];
|
||||||
|
$oDerivation = new Derivation ();
|
||||||
|
$userFields = $oDerivation->getUsersFullNameFromArray ( $arrayUsers );
|
||||||
|
|
||||||
|
foreach ( $userFields as $row ) {
|
||||||
|
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
|
||||||
|
if ($sw == 1) {
|
||||||
|
$to = $toAux;
|
||||||
|
$sw = 0;
|
||||||
|
} else {
|
||||||
|
$cc = $cc . (($cc != null) ? "," : null) . $toAux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$arrayResp ['to'] = $to;
|
||||||
|
$arrayResp ['cc'] = $cc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
if (isset ( $taskUsrUid ) && ! empty ( $taskUsrUid )) {
|
||||||
|
$aUser = $oUser->load ( $taskUsrUid );
|
||||||
|
$sTo = ((($aUser ["USR_FIRSTNAME"] != "") || ($aUser ["USR_LASTNAME"] != "")) ? $aUser ["USR_FIRSTNAME"] . " " . $aUser ["USR_LASTNAME"] . " " : "") . "<" . $aUser ["USR_EMAIL"] . ">";
|
||||||
|
}
|
||||||
|
$arrayResp ['to'] = $sTo;
|
||||||
|
$arrayResp ['cc'] = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $arrayResp;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain all user permits for Dynaforms, Input and output documents
|
* Obtain all user permits for Dynaforms, Input and output documents
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -91,6 +91,17 @@ class Users extends BaseUsers
|
|||||||
throw (new Exception(G::LoadTranslation("ID_USER_UID_DOESNT_EXIST", SYS_LANG, array("USR_UID" => $UsrUid))));
|
throw (new Exception(G::LoadTranslation("ID_USER_UID_DOESNT_EXIST", SYS_LANG, array("USR_UID" => $UsrUid))));
|
||||||
}
|
}
|
||||||
} catch (PropelException $e) {
|
} catch (PropelException $e) {
|
||||||
|
if(empty($oRow)) {
|
||||||
|
error_log(\G::LoadTranslation('ID_CONTACT_ADMIN'));
|
||||||
|
error_log($e->getTraceAsString());
|
||||||
|
$oError = new \Exception(
|
||||||
|
\G::LoadTranslation('ID_ERROR_IN_SERVER').".\n"
|
||||||
|
.\G::LoadTranslation('ID_CONTACT_ADMIN'),
|
||||||
|
0,
|
||||||
|
$e
|
||||||
|
);
|
||||||
|
throw ($oError);
|
||||||
|
}
|
||||||
//capture invalid birthday date and replace by null
|
//capture invalid birthday date and replace by null
|
||||||
$msg = $e->getMessage();
|
$msg = $e->getMessage();
|
||||||
if (strpos( 'Unable to parse value of [usr_birthday]', $msg ) != - 1) {
|
if (strpos( 'Unable to parse value of [usr_birthday]', $msg ) != - 1) {
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
PM.Sessions = (function () {
|
PM.Sessions = (function () {
|
||||||
var Sessions = function () {
|
var Sessions = function () {
|
||||||
|
if (this.getCookie('singleSignOn') === '1') {
|
||||||
|
this.register();
|
||||||
|
this.eraseCookie('singleSignOn');
|
||||||
|
}
|
||||||
if (window.location.pathname.indexOf("login") === -1 &&
|
if (window.location.pathname.indexOf("login") === -1 &&
|
||||||
window.location.pathname.indexOf("sysLogin") === -1 &&
|
window.location.pathname.indexOf("sysLogin") === -1 &&
|
||||||
|
window.location.pathname.indexOf("authentication") === -1 &&
|
||||||
this.getCookie('PM-TabPrimary') !== '101010010') {
|
this.getCookie('PM-TabPrimary') !== '101010010') {
|
||||||
this.isClose = (this.getLabel('mainWindowClose') === "true");
|
this.isClose = (this.getLabel('mainWindowClose') === "true");
|
||||||
if (this.isClose && parent.parent.parent.window.name === "") {
|
if (this.isClose && parent.parent.parent.window.name === "") {
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ class Ajax
|
|||||||
$options[] = Array('text' => G::LoadTranslation('ID_CASE_HISTORY'), 'fn' => 'caseHistory');
|
$options[] = Array('text' => G::LoadTranslation('ID_CASE_HISTORY'), 'fn' => 'caseHistory');
|
||||||
$options[] = Array('text' => G::LoadTranslation('ID_HISTORY_MESSAGE_CASE'), 'fn' => 'messageHistory');
|
$options[] = Array('text' => G::LoadTranslation('ID_HISTORY_MESSAGE_CASE'), 'fn' => 'messageHistory');
|
||||||
$options[] = Array('text' => G::LoadTranslation('ID_DYNAFORMS'), 'fn' => 'dynaformHistory');
|
$options[] = Array('text' => G::LoadTranslation('ID_DYNAFORMS'), 'fn' => 'dynaformHistory');
|
||||||
|
$options[] = Array('text' => G::LoadTranslation('ID_DYNAFORM_HISTORY'), 'fn' => 'changeLogHistory');
|
||||||
$options[] = Array('text' => G::LoadTranslation('ID_UPLOADED_DOCUMENTS'), 'fn' => 'uploadedDocuments');
|
$options[] = Array('text' => G::LoadTranslation('ID_UPLOADED_DOCUMENTS'), 'fn' => 'uploadedDocuments');
|
||||||
$options[] = Array('text' => G::LoadTranslation('ID_GENERATED_DOCUMENTS'), 'fn' => 'generatedDocuments');
|
$options[] = Array('text' => G::LoadTranslation('ID_GENERATED_DOCUMENTS'), 'fn' => 'generatedDocuments');
|
||||||
|
|
||||||
@@ -407,6 +408,25 @@ class Ajax
|
|||||||
G::RenderPage('publish', 'extJs');
|
G::RenderPage('publish', 'extJs');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changeLogHistory()
|
||||||
|
{
|
||||||
|
global $G_PUBLISH;
|
||||||
|
G::loadClass('configuration');
|
||||||
|
$idHistory = sprintf(
|
||||||
|
'%s_%s_%s',
|
||||||
|
$_SESSION['PROCESS'],
|
||||||
|
$_SESSION['APPLICATION'],
|
||||||
|
$_SESSION['TASK']
|
||||||
|
);
|
||||||
|
|
||||||
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
|
$conf = new Configurations();
|
||||||
|
$oHeadPublisher->addExtJsScript('cases/caseChangeLog', true); //adding a javascript file .js
|
||||||
|
$oHeadPublisher->addContent('cases/caseChangeLog'); //adding a html file .html.
|
||||||
|
$oHeadPublisher->assign('ID_HISTORY', $idHistory);
|
||||||
|
G::RenderPage('publish', 'extJs');
|
||||||
|
}
|
||||||
|
|
||||||
public function uploadedDocuments()
|
public function uploadedDocuments()
|
||||||
{
|
{
|
||||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||||
@@ -687,6 +707,19 @@ class Ajax
|
|||||||
print G::json_encode($result);
|
print G::json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changeLogAjax()
|
||||||
|
{
|
||||||
|
$changeLog = new ProcessMaker\BusinessModel\Cases\ChangeLog();
|
||||||
|
$idHistory = $_REQUEST["idHistory"];
|
||||||
|
$idHistoryArray = explode("_", $idHistory);
|
||||||
|
$proUid = $idHistoryArray[0];
|
||||||
|
$appUid = $idHistoryArray[1];
|
||||||
|
$tasUid = $idHistoryArray[2];
|
||||||
|
$start = isset($_REQUEST['start']) ? (int) $_REQUEST['start']: 0;
|
||||||
|
$limit = isset($_REQUEST['limit']) ? (int) $_REQUEST['limit']: 15;
|
||||||
|
echo G::json_encode($changeLog->getChangeLog($appUid, $proUid, $tasUid, $start, $limit));
|
||||||
|
}
|
||||||
|
|
||||||
public function changeLogTab()
|
public function changeLogTab()
|
||||||
{
|
{
|
||||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
if (typeof window.parent != 'undefined') {
|
if (typeof window.parent != 'undefined') {
|
||||||
<?php
|
<?php
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
$pathDerivateGmail = 'derivatedGmail';
|
||||||
$statusPMGmail = false;
|
$statusPMGmail = false;
|
||||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||||
@@ -20,8 +21,10 @@ if (isset( $_GET['ux'] )) {
|
|||||||
default:
|
default:
|
||||||
$url = 'casesListExtJs';
|
$url = 'casesListExtJs';
|
||||||
}
|
}
|
||||||
} else if( key_exists('gmail', $_SESSION) && $_SESSION['gmail'] == 1 && $statusPMGmail ){
|
/*----------------------------------********---------------------------------*/
|
||||||
$url = 'derivatedGmail';
|
} else if( $statusPMGmail ){
|
||||||
|
$url = $pathDerivateGmail;
|
||||||
|
/*----------------------------------********---------------------------------*/
|
||||||
} else {
|
} else {
|
||||||
$url = 'casesListExtJs';
|
$url = 'casesListExtJs';
|
||||||
}
|
}
|
||||||
@@ -32,7 +35,7 @@ echo " window.parent.location.href = '$url';";
|
|||||||
if (isset( $_GET['ux'] )) {
|
if (isset( $_GET['ux'] )) {
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
if(PMLicensedFeatures::getSingleton()->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09') && $statusPMGmail){
|
if(PMLicensedFeatures::getSingleton()->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09') && $statusPMGmail){
|
||||||
echo '} else { window.parent.location.href = \'derivatedGmail\'; }';
|
echo '} else { window.parent.location.href = \''.$pathDerivateGmail.'\'; }';
|
||||||
} else {
|
} else {
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';
|
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ function startCase ()
|
|||||||
if($pmGoogle->getServiceGmailStatus()){
|
if($pmGoogle->getServiceGmailStatus()){
|
||||||
require_once 'src/ProcessMaker/BusinessModel/Pmgmail.php';
|
require_once 'src/ProcessMaker/BusinessModel/Pmgmail.php';
|
||||||
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
|
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
|
||||||
$response = $Pmgmail->sendEmail($aData['APPLICATION'], "", $aData['INDEX']);
|
$response = $Pmgmail->sendEmail($aData['APPLICATION'], "", $aData['INDEX'], null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|||||||
@@ -164,6 +164,34 @@ try {
|
|||||||
$oUser = new Users();
|
$oUser = new Users();
|
||||||
$aUser = $oUser->load( $_SESSION['USER_LOGGED'] );
|
$aUser = $oUser->load( $_SESSION['USER_LOGGED'] );
|
||||||
$sFromName = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ($aUser['USR_EMAIL'] != '' ? ' <' . $aUser['USR_EMAIL'] . '>' : '');
|
$sFromName = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ($aUser['USR_EMAIL'] != '' ? ' <' . $aUser['USR_EMAIL'] . '>' : '');
|
||||||
|
|
||||||
|
$flagGmail = false;
|
||||||
|
/*----------------------------------********---------------------------------*/
|
||||||
|
$licensedFeatures = &PMLicensedFeatures::getSingleton ();
|
||||||
|
if ($licensedFeatures->verifyfeature ( '7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09' )) {
|
||||||
|
G::LoadClass ( "pmGoogleApi" );
|
||||||
|
$pmGoogle = new PMGoogleApi ();
|
||||||
|
if ($pmGoogle->getServiceGmailStatus ()) {
|
||||||
|
$flagGmail = true;
|
||||||
|
|
||||||
|
$appDel = new AppDelegation ();
|
||||||
|
$actualThread = $appDel->Load ( $_SESSION ['APPLICATION'], $_SESSION ['INDEX'] );
|
||||||
|
|
||||||
|
$appDelPrev = $appDel->LoadParallel ( $_SESSION ['APPLICATION'] );
|
||||||
|
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail ();
|
||||||
|
if (! $appDelPrev) {
|
||||||
|
$Pmgmail->sendEmail ( $_SESSION ['APPLICATION'], "", $_SESSION ['INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
|
||||||
|
} else {
|
||||||
|
foreach ( $appDelPrev as $app ) {
|
||||||
|
if (($app ['DEL_INDEX'] != $_SESSION ['INDEX']) && ($app ['DEL_PREVIOUS'] != $actualThread ['DEL_PREVIOUS'])) {
|
||||||
|
$Pmgmail->sendEmail ( $_SESSION ['APPLICATION'], "", $app ['DEL_INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName );
|
$oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName );
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -225,13 +253,14 @@ try {
|
|||||||
|
|
||||||
$debuggerAvailable = true;
|
$debuggerAvailable = true;
|
||||||
|
|
||||||
if (isset( $_SESSION['user_experience'] )) {
|
$casesRedirector = 'casesListExtJsRedirector';
|
||||||
$aNextStep['PAGE'] = 'casesListExtJsRedirector?ux=' . $_SESSION['user_experience'];
|
if (isset ( $_SESSION ['user_experience'] ) && $flagGmail === false) {
|
||||||
|
$aNextStep ['PAGE'] = $casesRedirector . '?ux=' . $_SESSION ['user_experience'];
|
||||||
$debuggerAvailable = false;
|
$debuggerAvailable = false;
|
||||||
} else if( isset( $_SESSION['gmail'] ) ){
|
} else if ($flagGmail === true) {
|
||||||
$aNextStep['PAGE'] = 'casesListExtJsRedirector?gmail='.$_SESSION['gmail'];
|
$aNextStep ['PAGE'] = $casesRedirector . '?gmail=1';
|
||||||
} else {
|
} else {
|
||||||
$aNextStep['PAGE'] = 'casesListExtJsRedirector';
|
$aNextStep ['PAGE'] = $casesRedirector;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) {
|
if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) {
|
||||||
|
|||||||
@@ -17,19 +17,6 @@ $appDel = new AppDelegation();
|
|||||||
$actualThread = $appDel->Load($caseId, $actualIndex);
|
$actualThread = $appDel->Load($caseId, $actualIndex);
|
||||||
$actualLastIndex = $actualThread['DEL_PREVIOUS'];
|
$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");
|
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.labelsGmail.php");
|
||||||
$oLabels = new labelsGmail();
|
$oLabels = new labelsGmail();
|
||||||
$oLabels->addRelabelingToQueue($caseId, $actualIndex, $actualLastIndex, false);
|
$oLabels->addRelabelingToQueue($caseId, $actualIndex, $actualLastIndex, false);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$RBAC->singleSignOn) {
|
if (!$RBAC->singleSignOn) {
|
||||||
|
setcookie("singleSignOn", '0', time() + (24 * 60 * 60), '/');
|
||||||
if (!isset($_POST['form']) ) {
|
if (!isset($_POST['form']) ) {
|
||||||
G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error');
|
G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error');
|
||||||
G::header('Location: login');
|
G::header('Location: login');
|
||||||
@@ -175,6 +176,7 @@ try {
|
|||||||
$_SESSION['USER_LOGGED'] = $uid;
|
$_SESSION['USER_LOGGED'] = $uid;
|
||||||
$_SESSION['USR_USERNAME'] = $usr;
|
$_SESSION['USR_USERNAME'] = $usr;
|
||||||
} else {
|
} else {
|
||||||
|
setcookie("singleSignOn", '1', time() + (24 * 60 * 60), '/');
|
||||||
$uid = $RBAC->userObj->fields['USR_UID'];
|
$uid = $RBAC->userObj->fields['USR_UID'];
|
||||||
$usr = $RBAC->userObj->fields['USR_USERNAME'];
|
$usr = $RBAC->userObj->fields['USR_USERNAME'];
|
||||||
$_SESSION['USER_LOGGED'] = $uid;
|
$_SESSION['USER_LOGGED'] = $uid;
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\BusinessModel\Cases;
|
||||||
|
|
||||||
|
use Propel;
|
||||||
|
use StdClass;
|
||||||
|
use G;
|
||||||
|
use Cases;
|
||||||
|
use AppDocument;
|
||||||
|
use Dynaform;
|
||||||
|
use Exception;
|
||||||
|
use Task;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ChangeLog of a Dynaform
|
||||||
|
*/
|
||||||
|
class ChangeLog
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* List of variables that should not be considered
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
private $reserved = [
|
||||||
|
'TASK',
|
||||||
|
'INDEX',
|
||||||
|
'DYN_CONTENT_HISTORY'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map of variables and its values
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
|
private $values = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of variables changes
|
||||||
|
* @var object[]
|
||||||
|
*/
|
||||||
|
private $tree;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of assigned permissions
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
private $permissions = [];
|
||||||
|
|
||||||
|
public function getChangeLog($appUid, $proUid, $tasUid, $start, $limit)
|
||||||
|
{
|
||||||
|
$this->loadPermissions($appUid, $proUid, $tasUid);
|
||||||
|
$result = $this->getResultSet($appUid);
|
||||||
|
$totalCount = $this->readRecords($result, $start, $limit);
|
||||||
|
return ['data' => $this->tree, 'totalCount' => $totalCount];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getResultSet($appUid)
|
||||||
|
{
|
||||||
|
$conn = Propel::getConnection('workflow');
|
||||||
|
$sql = 'SELECT APP_HISTORY.*, USERS.USR_USERNAME FROM APP_HISTORY'
|
||||||
|
.' LEFT JOIN USERS ON(APP_HISTORY.USR_UID=USERS.USR_UID)'
|
||||||
|
.' WHERE APP_UID=? ORDER BY HISTORY_DATE ASC';
|
||||||
|
$stmt = $conn->prepareStatement($sql);
|
||||||
|
$stmt->set(1, $appUid);
|
||||||
|
if (!$stmt->executeQuery()) {
|
||||||
|
throw Exception(G::LoadTranslation('ID_MSG_AJAX_FAILURE'));
|
||||||
|
}
|
||||||
|
return $stmt->getResultSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function readRecords($result, $start = 0, $limit = 15)
|
||||||
|
{
|
||||||
|
$index = 0;
|
||||||
|
while ($result->next()) {
|
||||||
|
$row = $result->getRow();
|
||||||
|
$data = unserialize($row['HISTORY_DATA']);
|
||||||
|
if ($this->isEmpty($data)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($index < $start) {
|
||||||
|
$index += $this->updateData(
|
||||||
|
$data, $row, $this->hasPermission($row['DYN_UID']), false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$a = $this->updateData($data, $row,
|
||||||
|
$this->hasPermission($row['DYN_UID']), true);
|
||||||
|
$limit-= $a;
|
||||||
|
$index+= $a;
|
||||||
|
}
|
||||||
|
return $index;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function isEmpty($data)
|
||||||
|
{
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if (array_search($key, $this->reserved) !== false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function updateData($data, $row, $hasPermission, $addToTree = false)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if (array_search($key, $this->reserved) !== false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($hasPermission && (!isset($this->values[$key]) || $this->values[$key]
|
||||||
|
!== $value)) {
|
||||||
|
if ($addToTree) {
|
||||||
|
$node = new StdClass();
|
||||||
|
$node->field = $key;
|
||||||
|
$previousValue = !isset($this->values[$key]) ? null : $this->values[$key];
|
||||||
|
$node->previousValue = (string) $previousValue;
|
||||||
|
$node->currentValue = (string) $value;
|
||||||
|
$node->previousValueType = gettype($previousValue);
|
||||||
|
$node->currentValueType = gettype($value);
|
||||||
|
$node->record = $this->getHistoryTitle($row);
|
||||||
|
$this->tree[] = $node;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$this->values[$key] = $value;
|
||||||
|
}
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getHistoryTitle($row)
|
||||||
|
{
|
||||||
|
return $this->getObjectTitle($row['TAS_UID'], 'TASK')
|
||||||
|
.' / '.$this->getObjectTitle($row['DYN_UID'], $row['OBJ_TYPE'])
|
||||||
|
.' / '.G::LoadTranslation('ID_LAN_UPDATE_DATE').': '.$row['HISTORY_DATE']
|
||||||
|
.' / '.G::LoadTranslation('ID_USER').': '.$row['USR_USERNAME'];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getObjectTitle($uid, $objType)
|
||||||
|
{
|
||||||
|
switch ($objType) {
|
||||||
|
case 'DYNAFORM':
|
||||||
|
$obj = new Dynaform();
|
||||||
|
$obj->Load($uid);
|
||||||
|
$title = $obj->getDynTitle();
|
||||||
|
break;
|
||||||
|
case 'OUTPUT_DOCUMENT':
|
||||||
|
case 'INPUT_DOCUMENT':
|
||||||
|
$obj = new AppDocument();
|
||||||
|
$obj->load($uid);
|
||||||
|
$title = $obj->getDynTitle();
|
||||||
|
break;
|
||||||
|
case 'TASK':
|
||||||
|
$obj = new Task();
|
||||||
|
$obj->load($uid);
|
||||||
|
$title = $obj->getTasTitle();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$title = $uid;
|
||||||
|
}
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function loadPermissions($APP_UID, $PRO_UID, $TAS_UID)
|
||||||
|
{
|
||||||
|
G::LoadClass('case');
|
||||||
|
$oCase = new Cases();
|
||||||
|
$oCase->verifyTable();
|
||||||
|
$this->permissions = $oCase->getAllObjects(
|
||||||
|
$PRO_UID, $APP_UID, $TAS_UID, $_SESSION['USER_LOGGED']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function hasPermission($uid)
|
||||||
|
{
|
||||||
|
foreach ($this->permissions as $type => $ids) {
|
||||||
|
if (array_search($uid, $ids) !== false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -80,14 +80,23 @@ class Pmgmail {
|
|||||||
* return uid
|
* return uid
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function sendEmail($app_uid, $mail, $index)
|
public function sendEmail($app_uid, $mailToAddresses, $index, $arrayTask = null, $arrayData = null)
|
||||||
{
|
{
|
||||||
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Application.php");
|
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Application.php");
|
||||||
|
//getting the default email server
|
||||||
|
$defaultEmail = $this->emailAccount();
|
||||||
|
|
||||||
|
if ($defaultEmail === null) {
|
||||||
|
error_log(G::LoadTranslation('ID_EMAIL_ENGINE_IS_NOT_ENABLED'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$mailCcAddresses = "";
|
||||||
$oApplication = new \Application();
|
$oApplication = new \Application();
|
||||||
$formData = $oApplication->Load($app_uid);
|
$formData = $oApplication->Load($app_uid);
|
||||||
|
|
||||||
$frmData = unserialize($formData['APP_DATA']);
|
$frmData = unserialize($formData['APP_DATA']);
|
||||||
$dataFormToShowString = "";
|
$dataFormToShowString = "";
|
||||||
|
|
||||||
foreach ($frmData as $field => $value) {
|
foreach ($frmData as $field => $value) {
|
||||||
if (($field != 'SYS_LANG') &&
|
if (($field != 'SYS_LANG') &&
|
||||||
($field != 'SYS_SKIN') &&
|
($field != 'SYS_SKIN') &&
|
||||||
@@ -99,7 +108,9 @@ class Pmgmail {
|
|||||||
($field != 'USER_LOGGED') &&
|
($field != 'USER_LOGGED') &&
|
||||||
($field != 'USR_USERNAME') &&
|
($field != 'USR_USERNAME') &&
|
||||||
($field != 'DYN_CONTENT_HISTORY') &&
|
($field != 'DYN_CONTENT_HISTORY') &&
|
||||||
($field != 'PIN') ){
|
($field != 'PIN') &&
|
||||||
|
(!is_array($value))
|
||||||
|
) {
|
||||||
$dataFormToShowString .= " " . $field . " " . $value;
|
$dataFormToShowString .= " " . $field . " " . $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,27 +136,57 @@ class Pmgmail {
|
|||||||
$labelID = "PMIBX";
|
$labelID = "PMIBX";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mail == ""){
|
if (( string ) $mailToAddresses === "") {
|
||||||
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
|
if ($arrayTask) {
|
||||||
|
$oCases = new \Cases ();
|
||||||
|
|
||||||
|
foreach ( $arrayTask as $aTask ) {
|
||||||
|
if (! isset ( $aTask ["USR_UID"] )) {
|
||||||
|
$aTask ["USR_UID"] = "";
|
||||||
|
}
|
||||||
|
$respTo = $oCases->getTo ( $aTask ["TAS_ASSIGN_TYPE"], $aTask ["TAS_UID"], $aTask ["USR_UID"], $arrayData );
|
||||||
|
$mailToAddresses = $respTo ['to'];
|
||||||
|
$mailCcAddresses = $respTo ['cc'];
|
||||||
|
|
||||||
|
if ($aTask ["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
|
||||||
|
$labelID = "PMUASS";
|
||||||
|
if (( string ) $mailToAddresses === "") { // Self Service Value Based
|
||||||
|
$criteria = new \Criteria ( "workflow" );
|
||||||
|
$criteria->addSelectColumn ( \AppAssignSelfServiceValuePeer::GRP_UID );
|
||||||
|
$criteria->add ( \AppAssignSelfServiceValuePeer::APP_UID, $app_uid );
|
||||||
|
|
||||||
|
$rsCriteria = \AppAssignSelfServiceValuePeer::doSelectRs ( $criteria );
|
||||||
|
$rsCriteria->setFetchmode ( \ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|
||||||
|
while ( $rsCriteria->next () ) {
|
||||||
|
$row = $rsCriteria->getRow ();
|
||||||
|
}
|
||||||
|
$targetIds = unserialize ( $row ['GRP_UID'] );
|
||||||
$oUsers = new \Users ();
|
$oUsers = new \Users ();
|
||||||
|
|
||||||
if($nextUsr == ""){
|
if (is_array($targetIds)) {
|
||||||
//Unassigned:
|
foreach ( $targetIds as $user ) {
|
||||||
$mail = "";
|
$usrData = $oUsers->loadDetails ( $user );
|
||||||
|
|
||||||
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'];
|
$nextMail = $usrData ['USR_EMAIL'];
|
||||||
$mail .= ($mail == '') ? $nextMail : ','. $nextMail;
|
$mailToAddresses .= ($mailToAddresses == '') ? $nextMail : ',' . $nextMail;
|
||||||
}
|
}
|
||||||
$labelID = "PMUASS";
|
|
||||||
} else {
|
} else {
|
||||||
|
$group = new \Groups();
|
||||||
|
$users = $group->getUsersOfGroup($targetIds);
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$nextMail = $user['USR_EMAIL'];
|
||||||
|
$mailToAddresses .= ($mailToAddresses == '') ? $nextMail : ',' . $nextMail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$oUsers = new \Users ();
|
||||||
|
|
||||||
$usrData = $oUsers->loadDetails ( $nextUsr );
|
$usrData = $oUsers->loadDetails ( $nextUsr );
|
||||||
$mail = $usrData['USR_EMAIL'];
|
$mailToAddresses = $usrData ['USR_EMAIL'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +214,8 @@ class Pmgmail {
|
|||||||
|
|
||||||
$change = array('[', ']', '"');
|
$change = array('[', ']', '"');
|
||||||
$fdata = str_replace($change, ' ', $dataFormToShowString);
|
$fdata = str_replace($change, ' ', $dataFormToShowString);
|
||||||
$aFields = array('proName' => $proName,
|
$aFields = array(
|
||||||
|
'proName' => $proName,
|
||||||
'appNumber' => $appNumber,
|
'appNumber' => $appNumber,
|
||||||
'caseUid' => $app_uid,
|
'caseUid' => $app_uid,
|
||||||
'taskName' => $tasName,
|
'taskName' => $tasName,
|
||||||
@@ -188,16 +230,13 @@ class Pmgmail {
|
|||||||
|
|
||||||
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
|
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
|
||||||
|
|
||||||
//getting the default email server
|
|
||||||
$defaultEmail = $this->emailAccount();
|
|
||||||
|
|
||||||
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.wsBase.php");
|
|
||||||
$ws = new \wsBase();
|
$ws = new \wsBase();
|
||||||
|
|
||||||
$resultMail = $ws->sendMessage(
|
$resultMail = $ws->sendMessage(
|
||||||
$app_uid,
|
$app_uid,
|
||||||
$defaultEmail, //From,
|
$defaultEmail, //From,
|
||||||
$mail,//To,
|
$mailToAddresses,//$To,
|
||||||
'',
|
$mailCcAddresses,//$Cc
|
||||||
'',
|
'',
|
||||||
$subject,
|
$subject,
|
||||||
'pmGmail.html',//template
|
'pmGmail.html',//template
|
||||||
@@ -279,5 +318,3 @@ class Pmgmail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
18
workflow/engine/templates/cases/caseChangeLog.html
Normal file
18
workflow/engine/templates/cases/caseChangeLog.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<link rel="stylesheet" type="text/css" href="/css/classic.css" />
|
||||||
|
<style type="text/css">
|
||||||
|
html{
|
||||||
|
color:black !important;
|
||||||
|
}
|
||||||
|
body{
|
||||||
|
color:black !important;
|
||||||
|
}
|
||||||
|
button.typeButton{
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: white;
|
||||||
|
border: 1px solid rgb(192, 192, 192);
|
||||||
|
font-size: 11px;
|
||||||
|
color: rgb(192, 192, 192);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id="processes-panel" width="80%" />
|
||||||
|
|
||||||
98
workflow/engine/templates/cases/caseChangeLog.js
Normal file
98
workflow/engine/templates/cases/caseChangeLog.js
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
Ext.onReady(function () {
|
||||||
|
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
||||||
|
Ext.QuickTips.init();
|
||||||
|
var store;
|
||||||
|
var viewport = new Ext.Viewport({
|
||||||
|
layout: 'border',
|
||||||
|
items: [
|
||||||
|
new Ext.grid.GridPanel({
|
||||||
|
region: 'center',
|
||||||
|
"width": "100%",
|
||||||
|
"height": 300,
|
||||||
|
"stateful": true,
|
||||||
|
"stateId": "stateGrid",
|
||||||
|
"enableColumnHide": false,
|
||||||
|
"view": new Ext.grid.GroupingView({
|
||||||
|
forceFit: true,
|
||||||
|
enableGroupingMenu: false
|
||||||
|
}),
|
||||||
|
"store": store = new Ext.data.GroupingStore({
|
||||||
|
pageSize: 15,
|
||||||
|
fields: [
|
||||||
|
{name: 'record'},
|
||||||
|
{name: 'field'},
|
||||||
|
{name: 'previousValue'},
|
||||||
|
{name: 'currentValue'},
|
||||||
|
{name: 'previousValueType'},
|
||||||
|
{name: 'currentValueType'},
|
||||||
|
{name: 'task'},
|
||||||
|
{name: 'updateDate'},
|
||||||
|
{name: 'user'}
|
||||||
|
],
|
||||||
|
groupField: 'record',
|
||||||
|
remoteSort: true,
|
||||||
|
proxy: new Ext.data.HttpProxy({
|
||||||
|
url: 'ajaxListener?action=changeLogAjax&idHistory=' + ID_HISTORY,
|
||||||
|
reader: new Ext.data.JsonReader({
|
||||||
|
fields: [
|
||||||
|
{name: 'record'},
|
||||||
|
{name: 'field'},
|
||||||
|
{name: 'previousValue'},
|
||||||
|
{name: 'currentValue'},
|
||||||
|
{name: 'previousValueType'},
|
||||||
|
{name: 'currentValueType'},
|
||||||
|
{name: 'task'},
|
||||||
|
{name: 'updateDate'},
|
||||||
|
{name: 'user'}
|
||||||
|
],
|
||||||
|
root: 'data',
|
||||||
|
totalProperty: 'totalCount'
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
"colModel": new Ext.grid.ColumnModel({
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
header: _('ID_FIELD_NAME'),
|
||||||
|
width: 120,
|
||||||
|
sortable: false,
|
||||||
|
dataIndex: 'field'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: _('ID_PREV_VALUES'),
|
||||||
|
flex: 1,
|
||||||
|
sortable: false,
|
||||||
|
dataIndex: 'previousValue',
|
||||||
|
renderer: function (value, p, record) {
|
||||||
|
return ' <button disabled="disabled" class="typeButton">'
|
||||||
|
+ record.data.previousValueType
|
||||||
|
+ '</button> ' + value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: _('ID_CURRENT_VALUES'),
|
||||||
|
flex: 1,
|
||||||
|
sortable: false,
|
||||||
|
dataIndex: 'currentValue',
|
||||||
|
renderer: function (value, p, record) {
|
||||||
|
return ' <button disabled="disabled" class="typeButton">'
|
||||||
|
+ record.data.currentValueType
|
||||||
|
+ '</button> ' + value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: '',
|
||||||
|
width: 1,
|
||||||
|
sortable: false,
|
||||||
|
hidden: true,
|
||||||
|
hideable: true,
|
||||||
|
dataIndex: 'record'
|
||||||
|
}
|
||||||
|
]})
|
||||||
|
})
|
||||||
|
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
store.load();
|
||||||
|
});
|
||||||
@@ -288,37 +288,6 @@
|
|||||||
}),
|
}),
|
||||||
store: store,
|
store: store,
|
||||||
tbar:[
|
tbar:[
|
||||||
{
|
|
||||||
text:_("ID_DYNAFORM_HISTORY"),
|
|
||||||
id:'changueLogFormRadioId',
|
|
||||||
iconCls: 'button_menu_ext',
|
|
||||||
icon: '/images/ext/gray/shapes/hourglass.png',
|
|
||||||
handler: function(){
|
|
||||||
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
|
||||||
|
|
||||||
if( rowSelected ){
|
|
||||||
window.parent.historyGridListChangeLogGlobal.idHistory = rowSelected.data.ID_HISTORY;
|
|
||||||
window.parent.historyGridListChangeLogGlobal.tasTitle = rowSelected.data.TAS_TITLE;
|
|
||||||
|
|
||||||
var idHistory = window.parent.historyGridListChangeLogGlobal.idHistory;
|
|
||||||
window.parent.Actions.tabFrame('changeLogTab'+idHistory);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Ext.Msg.show({
|
|
||||||
title:'',
|
|
||||||
msg: TRANSLATIONS.ID_NO_SELECTION_WARNING,
|
|
||||||
buttons: Ext.Msg.INFO,
|
|
||||||
fn: function(){},
|
|
||||||
animEl: 'elId',
|
|
||||||
icon: Ext.MessageBox.INFO,
|
|
||||||
buttons: Ext.MessageBox.OK
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
disabled:false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
xtype: 'tbfill'
|
xtype: 'tbfill'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -403,52 +403,6 @@
|
|||||||
}),
|
}),
|
||||||
store: store,
|
store: store,
|
||||||
tbar:[
|
tbar:[
|
||||||
{
|
|
||||||
|
|
||||||
text:_("ID_DYNAFORM_HISTORY"),
|
|
||||||
id:'sendMailMessageFormRadioId',
|
|
||||||
iconCls: 'button_menu_ext',
|
|
||||||
icon: '/images/ext/gray/shapes/hourglass.png',
|
|
||||||
handler: function(){
|
|
||||||
|
|
||||||
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
|
||||||
|
|
||||||
if( rowSelected ){
|
|
||||||
//!dataGrid
|
|
||||||
|
|
||||||
//historyDynaformGridGlobal construct
|
|
||||||
historyDynaformGridHistoryGlobal.PRO_UID = rowSelected.data.PRO_UID;
|
|
||||||
historyDynaformGridHistoryGlobal.APP_UID = rowSelected.data.APP_UID;
|
|
||||||
historyDynaformGridHistoryGlobal.TAS_UID = rowSelected.data.TAS_UID;
|
|
||||||
historyDynaformGridHistoryGlobal.DYN_UID = rowSelected.data.DYN_UID;
|
|
||||||
historyDynaformGridHistoryGlobal.DYN_TITLE = rowSelected.data.DYN_TITLE;
|
|
||||||
|
|
||||||
var PRO_UID = historyDynaformGridHistoryGlobal.PRO_UID;
|
|
||||||
var APP_UID = historyDynaformGridHistoryGlobal.APP_UID;
|
|
||||||
var TAS_UID = historyDynaformGridHistoryGlobal.TAS_UID;
|
|
||||||
var DYN_UID = historyDynaformGridHistoryGlobal.DYN_UID;
|
|
||||||
var DYN_TITLE = historyDynaformGridHistoryGlobal.DYN_TITLE;
|
|
||||||
|
|
||||||
historyDynaformGridHistory();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Ext.Msg.show({
|
|
||||||
title:'',
|
|
||||||
msg: TRANSLATIONS.ID_NO_SELECTION_WARNING,
|
|
||||||
buttons: Ext.Msg.INFO,
|
|
||||||
fn: function(){},
|
|
||||||
animEl: 'elId',
|
|
||||||
icon: Ext.MessageBox.INFO,
|
|
||||||
buttons: Ext.MessageBox.OK
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
disabled:false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
xtype: 'tbseparator'
|
xtype: 'tbseparator'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -780,6 +780,43 @@ Ext.onReady(function(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Actions.changeLogHistory = function ()
|
||||||
|
{
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: 'ajaxListener',
|
||||||
|
params: {action: 'verifySession'},
|
||||||
|
success: function (result, request) {
|
||||||
|
var data = Ext.util.JSON.decode(result.responseText);
|
||||||
|
if (data.lostSession) {
|
||||||
|
Ext.Msg.show({
|
||||||
|
title: _('ID_ERROR'),
|
||||||
|
msg: data.message,
|
||||||
|
animEl: 'elId',
|
||||||
|
icon: Ext.MessageBox.ERROR,
|
||||||
|
buttons: Ext.MessageBox.OK,
|
||||||
|
fn: function (btn) {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
prnt = parent.parent;
|
||||||
|
top.location = top.location;
|
||||||
|
} catch (err)
|
||||||
|
{
|
||||||
|
parent.location = parent.location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Actions.tabFrame('changeLogHistory');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: function (result, request) {
|
||||||
|
if (typeof (result.responseText) != 'undefined') {
|
||||||
|
Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Actions.uploadedDocuments = function()
|
Actions.uploadedDocuments = function()
|
||||||
{
|
{
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.bootstrap.php');
|
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.bootstrap.php');
|
||||||
|
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.g.php');
|
||||||
|
|
||||||
$gmailToken = $_GET['gmailToken'];
|
$gmailToken = $_GET['gmailToken'];
|
||||||
$gmail = $_GET['gmail'];
|
$gmail = $_GET['gmail'];
|
||||||
@@ -23,27 +24,33 @@ curl_setopt( $gCurl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmto
|
|||||||
curl_setopt( $gCurl, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt( $gCurl, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt( $gCurl, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt( $gCurl, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt( $gCurl, CURLOPT_CONNECTTIMEOUT, 0);
|
curl_setopt( $gCurl, CURLOPT_CONNECTTIMEOUT, 0);
|
||||||
|
curl_setopt($gCurl, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
|
||||||
|
if (curl_exec ( $gCurl ) === false) {
|
||||||
|
echo 'Curl error: ' . curl_error ( $gCurl );
|
||||||
|
error_log(Bootstrap::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR'));
|
||||||
|
die ();
|
||||||
|
} else {
|
||||||
$gCurl_response = curl_exec ( $gCurl );
|
$gCurl_response = curl_exec ( $gCurl );
|
||||||
curl_close ( $gCurl );
|
curl_close ( $gCurl );
|
||||||
$gResp = json_decode($gCurl_response);
|
$gResp = G::json_decode ( $gCurl_response );
|
||||||
|
if ($gResp === false) {
|
||||||
if($gResp == false){
|
|
||||||
echo Bootstrap::LoadTranslation ( 'ID_NO_LICENSE_FEATURE_ENABLED' );
|
echo Bootstrap::LoadTranslation ( 'ID_NO_LICENSE_FEATURE_ENABLED' );
|
||||||
die;
|
die ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_time_limit(60);
|
set_time_limit(60);
|
||||||
|
|
||||||
$curl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/userexist/' . $gmail );
|
$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_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
|
||||||
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER,false);
|
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER,false);
|
||||||
|
curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
|
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
|
||||||
|
|
||||||
$curl_response = curl_exec( $curl );
|
$curl_response = curl_exec( $curl );
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
$decodedResp = json_decode($curl_response);
|
$decodedResp = G::json_decode($curl_response);
|
||||||
|
|
||||||
if(!is_object($decodedResp) || property_exists($decodedResp,'error')) {
|
if(!is_object($decodedResp) || property_exists($decodedResp,'error')) {
|
||||||
die($decodedResp->error->message);
|
die($decodedResp->error->message);
|
||||||
@@ -70,13 +77,14 @@ if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp
|
|||||||
$optArray = array(
|
$optArray = array(
|
||||||
CURLOPT_URL => $url,
|
CURLOPT_URL => $url,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_SSL_VERIFYPEER => false
|
CURLOPT_SSL_VERIFYPEER => false,
|
||||||
|
CURLOPT_SSL_VERIFYHOST => false
|
||||||
);
|
);
|
||||||
// apply those options
|
// apply those options
|
||||||
curl_setopt_array($ch, $optArray);
|
curl_setopt_array($ch, $optArray);
|
||||||
// execute request and get response
|
// execute request and get response
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
$response = (json_decode($result));
|
$response = (G::json_decode($result));
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
//First validate if this user (mail) corresponds to a PM user
|
//First validate if this user (mail) corresponds to a PM user
|
||||||
@@ -119,10 +127,13 @@ if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp
|
|||||||
if ($action == "draft"){
|
if ($action == "draft"){
|
||||||
//sending the email
|
//sending the email
|
||||||
$curlApp = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/sendEmail/' . $appUid . '/to/' . $gmail . '/index/' . $delIndex );
|
$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_HTTPHEADER, array (
|
||||||
|
'Authorization: Bearer ' . $pmtoken
|
||||||
|
) );
|
||||||
curl_setopt ( $curlApp, CURLOPT_CUSTOMREQUEST, "POST" );
|
curl_setopt ( $curlApp, CURLOPT_CUSTOMREQUEST, "POST" );
|
||||||
curl_setopt ( $curlApp, CURLOPT_RETURNTRANSFER, true );
|
curl_setopt ( $curlApp, CURLOPT_RETURNTRANSFER, true );
|
||||||
curl_setopt ( $curlApp, CURLOPT_SSL_VERIFYPEER, false );
|
curl_setopt ( $curlApp, CURLOPT_SSL_VERIFYPEER, false );
|
||||||
|
curl_setopt ( $curlApp, CURLOPT_SSL_VERIFYHOST, false );
|
||||||
curl_setopt ( $curlApp, CURLOPT_CONNECTTIMEOUT, 0 );
|
curl_setopt ( $curlApp, CURLOPT_CONNECTTIMEOUT, 0 );
|
||||||
|
|
||||||
$curl_response_app = curl_exec( $curlApp );
|
$curl_response_app = curl_exec( $curlApp );
|
||||||
|
|||||||
Reference in New Issue
Block a user