Merged 3.0.1.8 into MT-10
This commit is contained in:
@@ -175,6 +175,7 @@ class AppDocumentDrive
|
||||
$data = [];
|
||||
while ($rsAppDelegation->next()) {
|
||||
$row = $rsAppDelegation->getRow();
|
||||
if (!empty($row['USR_UID'])) {
|
||||
if ($user->userExists($row['USR_UID'])) {
|
||||
$data = [];
|
||||
$data[] = $user->load($row['USR_UID']);
|
||||
@@ -186,6 +187,7 @@ class AppDocumentDrive
|
||||
$this->addUserEmail($dataUser["USR_EMAIL"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
error_log('Error: ' . $exception);
|
||||
}
|
||||
@@ -278,18 +280,18 @@ class AppDocumentDrive
|
||||
error_log("It has not enabled Feature Gmail");
|
||||
return;
|
||||
}
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::DOC_VERSION);
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion( AppDocumentPeer::SYNC_WITH_DRIVE, 'UNSYNCHRONIZED', Criteria::EQUAL )->
|
||||
addOr($criteria->getNewCriterion( AppDocumentPeer::SYNC_PERMISSIONS, null, Criteria::NOT_EQUAL ))
|
||||
$criteria->getNewCriterion(AppDocumentPeer::SYNC_WITH_DRIVE, 'UNSYNCHRONIZED', Criteria::EQUAL)->
|
||||
addOr($criteria->getNewCriterion(AppDocumentPeer::SYNC_PERMISSIONS, null, Criteria::NOT_EQUAL))
|
||||
);
|
||||
|
||||
$criteria->addAscendingOrderByColumn( 'APP_DOC_CREATE_DATE' );
|
||||
$criteria->addAscendingOrderByColumn( 'APP_UID' );
|
||||
$rs = AppDocumentPeer::doSelectRS( $criteria );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$criteria->addAscendingOrderByColumn('APP_DOC_CREATE_DATE');
|
||||
$criteria->addAscendingOrderByColumn('APP_UID');
|
||||
$rs = AppDocumentPeer::doSelectRS($criteria);
|
||||
$rs->setFetchMode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
@@ -298,47 +300,47 @@ class AppDocumentDrive
|
||||
|
||||
$appDocUid = $appDoc->getAppDocUid();
|
||||
$docVersion = $appDoc->getDocVersion();
|
||||
$filename = pathinfo( $appDoc->getAppDocFilename() );
|
||||
$name = !empty($filename['basename'])? $filename['basename'] : '';
|
||||
$ext = !empty($filename['extension'])? $filename['extension'] : '';
|
||||
$filename = pathinfo($appDoc->getAppDocFilename());
|
||||
$name = !empty($filename['basename']) ? $filename['basename'] : '';
|
||||
$ext = !empty($filename['extension']) ? $filename['extension'] : '';
|
||||
$appUid = G::getPathFromUID($appDoc->getAppUid());
|
||||
$file = G::getPathFromFileUID($appDoc->getAppUid(), $appDocUid );
|
||||
$file = G::getPathFromFileUID($appDoc->getAppUid(), $appDocUid);
|
||||
|
||||
|
||||
$sw_file_exists_doc = false;
|
||||
$sw_file_exists_pdf = false;
|
||||
if ($appDoc->getAppDocType() == 'OUTPUT') {
|
||||
//$name = substr($name, 1, -1);
|
||||
$sw_file_exists = false;
|
||||
$realPath = '';
|
||||
if ($appDoc->getAppDocType() === 'OUTPUT') {
|
||||
$realPathDoc = PATH_DOCUMENT . $appUid . '/outdocs/' . $appDocUid . '_' . $docVersion . '.' . 'doc';
|
||||
$realPathDoc1 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '_' . $docVersion . '.' . '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_doc = true;
|
||||
} elseif (file_exists( $realPathDoc1 )) {
|
||||
} elseif (file_exists($realPathDoc1)) {
|
||||
$sw_file_exists = true;
|
||||
$sw_file_exists_doc = true;
|
||||
$realPathDoc = $realPathDoc1;
|
||||
} elseif (file_exists( $realPathDoc2 )) {
|
||||
} elseif (file_exists($realPathDoc2)) {
|
||||
$sw_file_exists = true;
|
||||
$sw_file_exists_doc = true;
|
||||
$realPathDoc = $realPathDoc2;
|
||||
}
|
||||
|
||||
$realPathPdf = PATH_DOCUMENT . $appUid . '/outdocs/' . $appDocUid . '_' . $docVersion . '.' . 'pdf';
|
||||
$realPathPdf1 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '_' .$docVersion . '.' . 'pdf';
|
||||
$realPathPdf1 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '_' . $docVersion . '.' . 'pdf';
|
||||
$realPathPdf2 = PATH_DOCUMENT . $appUid . '/outdocs/' . $name . '.' . 'pdf';
|
||||
|
||||
if (file_exists( $realPathPdf )) {
|
||||
if (file_exists($realPathPdf)) {
|
||||
$sw_file_exists = true;
|
||||
$sw_file_exists_pdf = true;
|
||||
} elseif (file_exists( $realPathPdf1 )) {
|
||||
} elseif (file_exists($realPathPdf1)) {
|
||||
$sw_file_exists = true;
|
||||
$sw_file_exists_pdf = true;
|
||||
$realPathPdf = $realPathPdf1;
|
||||
} elseif (file_exists( $realPathPdf2 )) {
|
||||
} elseif (file_exists($realPathPdf2)) {
|
||||
$sw_file_exists = true;
|
||||
$sw_file_exists_pdf = true;
|
||||
$realPathPdf = $realPathPdf2;
|
||||
@@ -346,10 +348,9 @@ class AppDocumentDrive
|
||||
} else {
|
||||
$realPath = PATH_DOCUMENT . $appUid . '/' . $file[0] . $file[1] . '_' . $docVersion . '.' . $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;
|
||||
} elseif (file_exists( $realPath1 )) {
|
||||
} elseif (file_exists($realPath1)) {
|
||||
$sw_file_exists = true;
|
||||
$realPath = $realPath1;
|
||||
}
|
||||
@@ -367,34 +368,33 @@ class AppDocumentDrive
|
||||
|
||||
if ($index == 0 && $fields['SYNC_WITH_DRIVE'] == 'UNSYNCHRONIZED') {
|
||||
if ($log) {
|
||||
eprintln('upload file:' . $name , 'green');
|
||||
eprintln('upload file:' . $name, 'green');
|
||||
}
|
||||
$this->drive->setDriveUser($email);
|
||||
$info = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mime = finfo_file($info, $realPath);
|
||||
$type = $appDoc->getAppDocType();
|
||||
|
||||
if ($appDoc->getAppDocType() == 'OUTPUT') {
|
||||
|
||||
if ($sw_file_exists_doc) {
|
||||
$realPath = $realPathDoc;
|
||||
$name = array_pop(explode('/', $realPathDoc));
|
||||
$mime = 'application/msword';
|
||||
$type = 'OUTPUT_DOC';
|
||||
$result = $this->upload($fields, 'OUTPUT_DOC', 'application/msword', $realPathDoc,
|
||||
array_pop(explode('/', $realPathDoc)));
|
||||
}
|
||||
if ($sw_file_exists_pdf) {
|
||||
$realPath = $realPathPdf;
|
||||
$name = array_pop(explode('/', $realPathPdf));
|
||||
$mime = finfo_file($info, $realPathPdf);
|
||||
$type = 'OUTPUT_PDF';
|
||||
}
|
||||
$info = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$result = $this->upload($fields, 'OUTPUT_PDF', finfo_file($info, $realPathPdf),
|
||||
$realPathPdf, array_pop(explode('/', $realPathPdf)));
|
||||
}
|
||||
} else {
|
||||
$info = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mime = finfo_file($info, $realPath);
|
||||
$type = $appDoc->getAppDocType();
|
||||
$result = $this->upload($fields, $type, $mime, $realPath, $name);
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->drive->setDriveUser($this->user->getUsrEmail());
|
||||
}
|
||||
if ($log) {
|
||||
eprintln('Set Permission:' . $email , 'green');
|
||||
eprintln('Set Permission:' . $email, 'green');
|
||||
}
|
||||
$this->drive->setPermission($this->app->getAppDriveFolderUid(), $email, 'user', 'writer');
|
||||
|
||||
@@ -407,7 +407,7 @@ class AppDocumentDrive
|
||||
} else {
|
||||
$fields['SYNC_WITH_DRIVE'] = 'NO_EXIST_FILE_PM';
|
||||
if ($log) {
|
||||
eprintln('File no exists:' . $name , 'red');
|
||||
eprintln('File no exists:' . $name, 'red');
|
||||
}
|
||||
}
|
||||
$appDoc->update($fields);
|
||||
|
||||
@@ -5314,8 +5314,6 @@ class Cases
|
||||
$oUser = new Users();
|
||||
|
||||
foreach ($arrayTask as $aTask) {
|
||||
$sTo = null;
|
||||
$sCc = null;
|
||||
|
||||
if (isset($aTask['DEL_INDEX'])) {
|
||||
$arrayData2 = $arrayData;
|
||||
@@ -5342,132 +5340,20 @@ class Cases
|
||||
|
||||
$sBody2 = G::replaceDataGridField($sBody, $arrayData2, false);
|
||||
|
||||
switch ($aTask["TAS_ASSIGN_TYPE"]) {
|
||||
case "SELF_SERVICE":
|
||||
$respTo = $this->getTo($aTask["TAS_ASSIGN_TYPE"], $aTask["TAS_UID"], $aTask["USR_UID"], $arrayData);
|
||||
$sTo = $respTo['to'];
|
||||
$sCc = $respTo['cc'];
|
||||
|
||||
if ($aTask ["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
|
||||
if ($swtplDefault == 1) {
|
||||
G::verifyPath($pathEmail, true); //Create if it does not exist
|
||||
$fileTemplate = $pathEmail . G::LoadTranslation('ID_UNASSIGNED_MESSAGE');
|
||||
G::verifyPath ( $pathEmail, true ); // Create if it does not exist
|
||||
$fileTemplate = $pathEmail . 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);
|
||||
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 );
|
||||
}
|
||||
|
||||
$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) {
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -91,6 +91,17 @@ class Users extends BaseUsers
|
||||
throw (new Exception(G::LoadTranslation("ID_USER_UID_DOESNT_EXIST", SYS_LANG, array("USR_UID" => $UsrUid))));
|
||||
}
|
||||
} 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
|
||||
$msg = $e->getMessage();
|
||||
if (strpos( 'Unable to parse value of [usr_birthday]', $msg ) != - 1) {
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
PM.Sessions = (function () {
|
||||
var Sessions = function () {
|
||||
if (this.getCookie('singleSignOn') === '1') {
|
||||
this.register();
|
||||
this.eraseCookie('singleSignOn');
|
||||
}
|
||||
if (window.location.pathname.indexOf("login") === -1 &&
|
||||
window.location.pathname.indexOf("sysLogin") === -1 &&
|
||||
window.location.pathname.indexOf("authentication") === -1 &&
|
||||
this.getCookie('PM-TabPrimary') !== '101010010') {
|
||||
this.isClose = (this.getLabel('mainWindowClose') === "true");
|
||||
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_HISTORY_MESSAGE_CASE'), 'fn' => 'messageHistory');
|
||||
$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_GENERATED_DOCUMENTS'), 'fn' => 'generatedDocuments');
|
||||
|
||||
@@ -407,6 +408,25 @@ class Ajax
|
||||
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()
|
||||
{
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
@@ -687,6 +707,19 @@ class Ajax
|
||||
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()
|
||||
{
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
if (typeof window.parent != 'undefined') {
|
||||
<?php
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$pathDerivateGmail = 'derivatedGmail';
|
||||
$statusPMGmail = false;
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
@@ -20,8 +21,10 @@ if (isset( $_GET['ux'] )) {
|
||||
default:
|
||||
$url = 'casesListExtJs';
|
||||
}
|
||||
} else if( key_exists('gmail', $_SESSION) && $_SESSION['gmail'] == 1 && $statusPMGmail ){
|
||||
$url = 'derivatedGmail';
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} else if( $statusPMGmail ){
|
||||
$url = $pathDerivateGmail;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} else {
|
||||
$url = 'casesListExtJs';
|
||||
}
|
||||
@@ -32,7 +35,7 @@ echo " window.parent.location.href = '$url';";
|
||||
if (isset( $_GET['ux'] )) {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if(PMLicensedFeatures::getSingleton()->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09') && $statusPMGmail){
|
||||
echo '} else { window.parent.location.href = \'derivatedGmail\'; }';
|
||||
echo '} else { window.parent.location.href = \''.$pathDerivateGmail.'\'; }';
|
||||
} else {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';
|
||||
|
||||
@@ -271,7 +271,7 @@ function startCase ()
|
||||
if($pmGoogle->getServiceGmailStatus()){
|
||||
require_once 'src/ProcessMaker/BusinessModel/Pmgmail.php';
|
||||
$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();
|
||||
$aUser = $oUser->load( $_SESSION['USER_LOGGED'] );
|
||||
$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 {
|
||||
$oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName );
|
||||
} catch (Exception $e) {
|
||||
@@ -225,13 +253,14 @@ try {
|
||||
|
||||
$debuggerAvailable = true;
|
||||
|
||||
if (isset( $_SESSION['user_experience'] )) {
|
||||
$aNextStep['PAGE'] = 'casesListExtJsRedirector?ux=' . $_SESSION['user_experience'];
|
||||
$casesRedirector = 'casesListExtJsRedirector';
|
||||
if (isset ( $_SESSION ['user_experience'] ) && $flagGmail === false) {
|
||||
$aNextStep ['PAGE'] = $casesRedirector . '?ux=' . $_SESSION ['user_experience'];
|
||||
$debuggerAvailable = false;
|
||||
} else if( isset( $_SESSION['gmail'] ) ){
|
||||
$aNextStep['PAGE'] = 'casesListExtJsRedirector?gmail='.$_SESSION['gmail'];
|
||||
} else if ($flagGmail === true) {
|
||||
$aNextStep ['PAGE'] = $casesRedirector . '?gmail=1';
|
||||
} else {
|
||||
$aNextStep['PAGE'] = 'casesListExtJsRedirector';
|
||||
$aNextStep ['PAGE'] = $casesRedirector;
|
||||
}
|
||||
|
||||
if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) {
|
||||
|
||||
@@ -17,19 +17,6 @@ $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();
|
||||
$oLabels->addRelabelingToQueue($caseId, $actualIndex, $actualLastIndex, false);
|
||||
|
||||
@@ -34,6 +34,7 @@ try {
|
||||
}
|
||||
|
||||
if (!$RBAC->singleSignOn) {
|
||||
setcookie("singleSignOn", '0', time() + (24 * 60 * 60), '/');
|
||||
if (!isset($_POST['form']) ) {
|
||||
G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error');
|
||||
G::header('Location: login');
|
||||
@@ -175,6 +176,7 @@ try {
|
||||
$_SESSION['USER_LOGGED'] = $uid;
|
||||
$_SESSION['USR_USERNAME'] = $usr;
|
||||
} else {
|
||||
setcookie("singleSignOn", '1', time() + (24 * 60 * 60), '/');
|
||||
$uid = $RBAC->userObj->fields['USR_UID'];
|
||||
$usr = $RBAC->userObj->fields['USR_USERNAME'];
|
||||
$_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,16 +80,25 @@ class Pmgmail {
|
||||
* 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");
|
||||
//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();
|
||||
$formData = $oApplication->Load($app_uid);
|
||||
|
||||
$frmData = unserialize($formData['APP_DATA']);
|
||||
$dataFormToShowString = "";
|
||||
foreach ($frmData as $field=>$value){
|
||||
if( ($field != 'SYS_LANG') &&
|
||||
|
||||
foreach ($frmData as $field => $value) {
|
||||
if (($field != 'SYS_LANG') &&
|
||||
($field != 'SYS_SKIN') &&
|
||||
($field != 'SYS_SYS') &&
|
||||
($field != 'APPLICATION') &&
|
||||
@@ -99,13 +108,15 @@ class Pmgmail {
|
||||
($field != 'USER_LOGGED') &&
|
||||
($field != 'USR_USERNAME') &&
|
||||
($field != 'DYN_CONTENT_HISTORY') &&
|
||||
($field != 'PIN') ){
|
||||
($field != 'PIN') &&
|
||||
(!is_array($value))
|
||||
) {
|
||||
$dataFormToShowString .= " " . $field . " " . $value;
|
||||
}
|
||||
}
|
||||
$appData = $this->getDraftApp($app_uid, $index);
|
||||
|
||||
foreach ($appData as $application){
|
||||
foreach ($appData as $application) {
|
||||
$appNumber = $application['APP_NUMBER'];
|
||||
$appStatus = $application['APP_STATUS'];
|
||||
$index = $application['DEL_INDEX'];
|
||||
@@ -119,39 +130,69 @@ class Pmgmail {
|
||||
$tasUid = $application['TAS_UID'];
|
||||
$lastIndex = $application['DEL_LAST_INDEX'];
|
||||
|
||||
if($appStatus == "DRAFT"){
|
||||
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 (( string ) $mailToAddresses === "") {
|
||||
if ($arrayTask) {
|
||||
$oCases = new \Cases ();
|
||||
|
||||
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;
|
||||
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";
|
||||
}else {
|
||||
$usrData = $oUsers->loadDetails($nextUsr);
|
||||
$mail = $usrData['USR_EMAIL'];
|
||||
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 ();
|
||||
|
||||
if (is_array($targetIds)) {
|
||||
foreach ( $targetIds as $user ) {
|
||||
$usrData = $oUsers->loadDetails ( $user );
|
||||
$nextMail = $usrData ['USR_EMAIL'];
|
||||
$mailToAddresses .= ($mailToAddresses == '') ? $nextMail : ',' . $nextMail;
|
||||
}
|
||||
} 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 );
|
||||
$mailToAddresses = $usrData ['USR_EMAIL'];
|
||||
}
|
||||
}
|
||||
|
||||
//first template
|
||||
$pathTemplate = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . "pmGmail.html";
|
||||
if (!file_exists($pathTemplate)){
|
||||
if (!file_exists($pathTemplate)) {
|
||||
$file = @fopen($pathTemplate, "w");
|
||||
fwrite($file, '<div>');
|
||||
fwrite($file, '<span style="display: none !important;">');
|
||||
@@ -173,7 +214,8 @@ class Pmgmail {
|
||||
|
||||
$change = array('[', ']', '"');
|
||||
$fdata = str_replace($change, ' ', $dataFormToShowString);
|
||||
$aFields = array('proName' => $proName,
|
||||
$aFields = array(
|
||||
'proName' => $proName,
|
||||
'appNumber' => $appNumber,
|
||||
'caseUid' => $app_uid,
|
||||
'taskName' => $tasName,
|
||||
@@ -186,18 +228,15 @@ class Pmgmail {
|
||||
'oform' => $fdata
|
||||
);
|
||||
|
||||
$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();
|
||||
|
||||
$resultMail = $ws->sendMessage(
|
||||
$app_uid,
|
||||
$defaultEmail, //From,
|
||||
$mail,//To,
|
||||
'',
|
||||
$mailToAddresses,//$To,
|
||||
$mailCcAddresses,//$Cc
|
||||
'',
|
||||
$subject,
|
||||
'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,
|
||||
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'
|
||||
}
|
||||
|
||||
@@ -403,52 +403,6 @@
|
||||
}),
|
||||
store: store,
|
||||
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'
|
||||
},
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
Ext.Ajax.request({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.bootstrap.php');
|
||||
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.g.php');
|
||||
|
||||
$gmailToken = $_GET['gmailToken'];
|
||||
$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_SSL_VERIFYPEER, false);
|
||||
curl_setopt( $gCurl, CURLOPT_CONNECTTIMEOUT, 0);
|
||||
curl_setopt($gCurl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
|
||||
$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;
|
||||
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 );
|
||||
curl_close ( $gCurl );
|
||||
$gResp = G::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_SSL_VERIFYHOST, false);
|
||||
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
|
||||
|
||||
$curl_response = curl_exec( $curl );
|
||||
curl_close($curl);
|
||||
$decodedResp = json_decode($curl_response);
|
||||
$decodedResp = G::json_decode($curl_response);
|
||||
|
||||
if(!is_object($decodedResp) || property_exists($decodedResp,'error')) {
|
||||
die($decodedResp->error->message);
|
||||
@@ -70,13 +77,14 @@ if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp
|
||||
$optArray = array(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_SSL_VERIFYPEER => false
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_SSL_VERIFYHOST => false
|
||||
);
|
||||
// apply those options
|
||||
curl_setopt_array($ch, $optArray);
|
||||
// execute request and get response
|
||||
$result = curl_exec($ch);
|
||||
$response = (json_decode($result));
|
||||
$response = (G::json_decode($result));
|
||||
curl_close($ch);
|
||||
|
||||
//First validate if this user (mail) corresponds to a PM user
|
||||
@@ -119,11 +127,14 @@ if( !isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp
|
||||
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_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_SSL_VERIFYHOST, false );
|
||||
curl_setopt ( $curlApp, CURLOPT_CONNECTTIMEOUT, 0 );
|
||||
|
||||
$curl_response_app = curl_exec( $curlApp );
|
||||
curl_close( $curlApp );
|
||||
|
||||
Reference in New Issue
Block a user