Merged colosa/processmaker into master
@@ -2634,6 +2634,20 @@ class G
|
||||
$oldumask = umask( 0 );
|
||||
if (! is_dir( $path )) {
|
||||
G::verifyPath( $path, true );
|
||||
}
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$file = str_replace("\\\\","\\",$file,$count);
|
||||
if(!$count) {
|
||||
$winPath = explode("\\",$file);
|
||||
$file = "";
|
||||
foreach($winPath as $k => $v){
|
||||
if($v != "") {
|
||||
$file.= $v."\\";
|
||||
}
|
||||
}
|
||||
$file = substr($file,0,-1);
|
||||
}
|
||||
}
|
||||
|
||||
G::LoadSystem('inputfilter');
|
||||
|
||||
@@ -586,7 +586,9 @@ class InputFilter
|
||||
break;
|
||||
case 'path':
|
||||
if(!file_exists($value)) {
|
||||
$value = '';
|
||||
if(!is_dir($value)) {
|
||||
$value = '';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'nosql':
|
||||
@@ -624,7 +626,9 @@ class InputFilter
|
||||
break;
|
||||
case 'path':
|
||||
if(!file_exists($value)) {
|
||||
throw new Exception('not a valid path');
|
||||
if(!is_dir($value)) {
|
||||
throw new Exception('not a valid path');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'nosql':
|
||||
|
||||
3
gulliver/thirdparty/phing/Phing.php
vendored
@@ -856,7 +856,8 @@ class Phing {
|
||||
if (self::getMsgOutputLevel() === PROJECT_MSG_DEBUG) {
|
||||
print("Phing::import() prepending new include_path components: " . implode(PATH_SEPARATOR, $new_parts) . "\n");
|
||||
}
|
||||
if (is_dir(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)))) {
|
||||
$firstPath = explode(":", implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
|
||||
if (is_dir($firstPath[0])) {
|
||||
ini_set('include_path', implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
|
||||
}
|
||||
}
|
||||
|
||||
2
gulliver/thirdparty/propel/Propel.php
vendored
@@ -601,7 +601,7 @@ class Propel {
|
||||
$lastQuery = "";
|
||||
|
||||
foreach (self::$connectionMap as $cnn) {
|
||||
if (!($cnn instanceof DBArrayConnection)) {
|
||||
if (get_class($cnn) != "DBArrayConnection") {
|
||||
if (gettype($cnn->getResource()) == "resource" && $cnn->isConnected() && $cnn->lastQuery != $lastQuery) {
|
||||
$cnn->close();
|
||||
}
|
||||
|
||||
@@ -2868,4 +2868,30 @@ function PMFRemoveMask ($field, $separator = '.', $currency = '')
|
||||
$field = floatval(trim($field));
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
*@method
|
||||
*
|
||||
* Sends an array of case variables to a specified case.
|
||||
*
|
||||
* @name PMFSaveCurrentData
|
||||
* @label PMF Save Current Data
|
||||
*
|
||||
* @return int | $result | Result of send variables | Returns 1 if the variables were sent successfully to the case; otherwise, returns 0 if an error occurred.
|
||||
*
|
||||
*/
|
||||
|
||||
function PMFSaveCurrentData ()
|
||||
{
|
||||
global $oPMScript;
|
||||
$result = 0;
|
||||
|
||||
if (isset($_SESSION['APPLICATION']) && isset($oPMScript->aFields)) {
|
||||
G::LoadClass( 'wsBase' );
|
||||
$ws = new wsBase();
|
||||
$result = $ws->sendVariables( $_SESSION['APPLICATION'], $oPMScript->aFields );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1012,9 +1012,11 @@ class wsBase
|
||||
*
|
||||
* @param string $caseId
|
||||
* @param string $iDelIndex
|
||||
* @param bool $flagUseDelIndex
|
||||
*
|
||||
* @return $result will return an object
|
||||
*/
|
||||
public function getCaseInfo ($caseId, $iDelIndex)
|
||||
public function getCaseInfo($caseId, $iDelIndex, $flagUseDelIndex = false)
|
||||
{
|
||||
try {
|
||||
$oCase = new Cases();
|
||||
@@ -1057,8 +1059,15 @@ class wsBase
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD );
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS );
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$oCriteria->add( AppDelegationPeer::APP_UID, $caseId );
|
||||
$oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );
|
||||
|
||||
if ($flagUseDelIndex) {
|
||||
$oCriteria->add(AppDelegationPeer::DEL_INDEX, $iDelIndex, Criteria::EQUAL);
|
||||
} else {
|
||||
$oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
|
||||
}
|
||||
|
||||
$oCriteria->addAscendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
|
||||
@@ -1096,6 +1105,8 @@ class wsBase
|
||||
$currentUser->delIndex = $aAppDel['DEL_INDEX'];
|
||||
$currentUser->delThread = $aAppDel['DEL_THREAD'];
|
||||
$currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS'];
|
||||
$currentUser->delInitDate = $aAppDel["DEL_INIT_DATE"];
|
||||
$currentUser->delTaskDueDate = $aAppDel["DEL_TASK_DUE_DATE"];
|
||||
$aCurrentUsers[] = $currentUser;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,13 @@ class workspaceTools
|
||||
|
||||
CLI::logging("> Updating Files Manager...\n\n");
|
||||
$this->upgradeFilesManager($workSpace);
|
||||
|
||||
$start = microtime(true);
|
||||
CLI::logging("> Migrate new lists...\n");
|
||||
$this->migrateList($workSpace);
|
||||
$stop = microtime(true);
|
||||
$final = $stop - $start;
|
||||
CLI::logging("<*> Migrate new lists Process took $final seconds.\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -634,7 +641,7 @@ class workspaceTools
|
||||
$oStatement_sleep->executeQuery();
|
||||
}
|
||||
|
||||
$sql_query = "SELECT * FROM information_schema.processlist WHERE user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() ORDER BY id;";
|
||||
$sql_query = "SELECT * FROM information_schema.processlist WHERE user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() and time > 0 ORDER BY id;";
|
||||
$stmt_query = $connection->createStatement();
|
||||
$rs_query = $stmt_query->executeQuery( $sql_query, ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
@@ -1853,6 +1860,9 @@ class workspaceTools
|
||||
*/
|
||||
public function migrateList ($workSpace)
|
||||
{
|
||||
if ($this->listFirstExecution('check')) {
|
||||
return 1;
|
||||
}
|
||||
$this->initPropel(true);
|
||||
$appCache = new AppCacheView();
|
||||
G::LoadClass("case");
|
||||
@@ -2034,13 +2044,15 @@ class workspaceTools
|
||||
switch ($action) {
|
||||
case 'insert':
|
||||
$conf = new Configuration();
|
||||
$data["CFG_UID"] ='MIGRATED_LIST';
|
||||
$data["OBJ_UID"] ='list';
|
||||
$data["CFG_VALUE"]='true';
|
||||
$data["PRO_UID"] ='list';
|
||||
$data["USR_UID"] ='list';
|
||||
$data["APP_UID"] ='list';
|
||||
$conf->create($data);
|
||||
if (!($conf->exists('MIGRATED_LIST', 'list', 'list', 'list', 'list'))) {
|
||||
$data["CFG_UID"] ='MIGRATED_LIST';
|
||||
$data["OBJ_UID"] ='list';
|
||||
$data["CFG_VALUE"]='true';
|
||||
$data["PRO_UID"] ='list';
|
||||
$data["USR_UID"] ='list';
|
||||
$data["APP_UID"] ='list';
|
||||
$conf->create($data);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case 'check':
|
||||
|
||||
@@ -1654,18 +1654,23 @@ class AppCacheView extends BaseAppCacheView
|
||||
public function getTotalCasesByAllUsers()
|
||||
{
|
||||
$oCriteria = new Criteria("workflow");
|
||||
|
||||
$oCriteria->addSelectColumn(AppCacheViewPeer::USR_UID);
|
||||
$oCriteria->addAsColumn("CNT", "COUNT(DISTINCT(APP_UID))");
|
||||
$oCriteria->addAsColumn("CNT", "COUNT(DISTINCT(APP_CACHE_VIEW.APP_UID))");
|
||||
|
||||
$oCriteria->addJoin(AppCacheViewPeer::DEL_INDEX , AppDelayPeer::APP_DEL_INDEX, Criteria::LEFT_JOIN);
|
||||
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(AppDelayPeer::APP_TYPE, NULL, Criteria::ISNULL)->addOr(
|
||||
$oCriteria->getNewCriterion(AppDelayPeer::APP_TYPE, 'REASSIGN', Criteria::NOT_EQUAL))
|
||||
);
|
||||
|
||||
$oCriteria->addGroupByColumn(AppCacheViewPeer::USR_UID);
|
||||
$dat = AppCacheViewPeer::doSelectRS($oCriteria);
|
||||
$dat->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$aRows = array();
|
||||
|
||||
while ($dat->next()) {
|
||||
$row = $dat->getRow();
|
||||
|
||||
$aRows[$row["USR_UID"]] = $row["CNT"];
|
||||
}
|
||||
|
||||
|
||||
@@ -666,11 +666,11 @@ class CaseScheduler extends BaseCaseScheduler
|
||||
$this->Update( $Fields );
|
||||
}
|
||||
|
||||
public function updateNextRun ($sOption, $sValue = '', $sActualTime = '', $sDaysPerformTask = '', $sWeeks = '', $sStartDay = '', $sMonths = '', $currentDate = '')
|
||||
public function updateNextRun($sOption, $sValue = "", $sActualTime = "", $sDaysPerformTask = "", $sWeeks = "", $sStartDay = "", $sMonths = "", $currentDate = "", $flagNextRun = true)
|
||||
{
|
||||
$nActualDate = $currentDate . " " . $sActualTime;
|
||||
$dEstimatedDate = '';
|
||||
$sWeeks = trim($sWeeks, "|");
|
||||
$sWeeks = trim($sWeeks, " |");
|
||||
|
||||
switch ($sOption) {
|
||||
case '1':
|
||||
@@ -694,48 +694,47 @@ class CaseScheduler extends BaseCaseScheduler
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if (strlen( $sWeeks ) > 0) {
|
||||
//die($sActualTime);
|
||||
$nDayOfTheWeek = (int)(date("w", strtotime($sActualTime)));
|
||||
//$nDayOfTheWeek = 1;
|
||||
$aWeeks = explode( '|', $sWeeks );
|
||||
$nFirstDay = (int)($aWeeks[0]) - 1;
|
||||
if ($sWeeks != "") {
|
||||
$aDaysWeek = array ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
|
||||
$nDayOfTheWeek = ($nDayOfTheWeek == 0) ? 7 : $nDayOfTheWeek;
|
||||
$day = 0;
|
||||
$nSW = 0;
|
||||
$flagIsTheSameDay = false;
|
||||
|
||||
foreach ($aWeeks as $value) {
|
||||
if ($nDayOfTheWeek <= (int)($value)) {
|
||||
$day = (int)($value) - 1;
|
||||
$nSW = 1;
|
||||
$flagIsTheSameDay = $nDayOfTheWeek == (int)($value);
|
||||
break;
|
||||
$nDayOfTheWeek = (int)(date("w", strtotime($sActualTime)));
|
||||
$nDayOfTheWeek = ($nDayOfTheWeek == 0)? 7 : $nDayOfTheWeek;
|
||||
|
||||
$arrayWeekdays = explode("|", $sWeeks);
|
||||
$firstDay = (int)($arrayWeekdays[0]);
|
||||
|
||||
$flagFound = $nDayOfTheWeek < $firstDay || in_array($nDayOfTheWeek, $arrayWeekdays);
|
||||
|
||||
if ($flagFound) {
|
||||
$typeStatement = "this";
|
||||
$indexDay = (in_array($nDayOfTheWeek, $arrayWeekdays))? $nDayOfTheWeek : $firstDay;
|
||||
|
||||
if ($flagNextRun) {
|
||||
$index = array_search($nDayOfTheWeek, $arrayWeekdays);
|
||||
|
||||
if ($index !== false && isset($arrayWeekdays[$index + 1])) {
|
||||
$indexDay = $arrayWeekdays[$index + 1];
|
||||
} else {
|
||||
$typeStatement = "next";
|
||||
$indexDay = $firstDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($nSW == 1) {
|
||||
$dEstimatedDate = date("Y-m-d", strtotime("$nActualDate " . (($flagIsTheSameDay)? "this" : "next") . " " . $aDaysWeek[$day])) . " " . date("H:i:s", strtotime($sActualTime));
|
||||
$indexDay--;
|
||||
|
||||
$dEstimatedDate = date("Y-m-d", strtotime($nActualDate . " " . $typeStatement . " " . $aDaysWeek[$indexDay])) . " " . date("H:i:s", strtotime($sActualTime));
|
||||
} else {
|
||||
$nEveryDays = $sDaysPerformTask;
|
||||
// $nEveryDays = '1';
|
||||
if ($nFirstDay >= $nDayOfTheWeek || $nEveryDays == 1) {
|
||||
$sTypeOperation = "next";
|
||||
} else {
|
||||
$sTypeOperation = "last";
|
||||
}
|
||||
|
||||
$typeStatement = ($firstDay >= $nDayOfTheWeek || $nEveryDays == 1)? "next" : "last";
|
||||
$indexDay = $firstDay - 1;
|
||||
|
||||
if ($nEveryDays == 1) {
|
||||
//echo "**** $nActualDate *" . $sTypeOperation . "* *" . $aDaysWeek[$nFirstDay] . '*****' . date('H:i:s', strtotime($sActualTime)). "**";
|
||||
$dEstimatedDate = date( 'Y-m-d', strtotime( "$nActualDate " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
|
||||
//echo "(date)*".$dEstimatedDate."*";
|
||||
//die("01");
|
||||
$dEstimatedDate = date("Y-m-d", strtotime($nActualDate . " " . $typeStatement . " " . $aDaysWeek[$indexDay])) . " " . date("H:i:s", strtotime($sActualTime));
|
||||
} else {
|
||||
$nEveryDays = 1;
|
||||
//$nActualDate = date('Y-m-d').' '.$sActualTime;
|
||||
$nDataTmp = date( 'Y-m-d', strtotime( "$nActualDate + " . $nEveryDays . " Week" ) );
|
||||
$dEstimatedDate = date( 'Y-m-d', strtotime( "$nDataTmp " . $sTypeOperation . " " . $aDaysWeek[$nFirstDay] ) ) . ' ' . date( 'H:i:s', strtotime( $sActualTime ) );
|
||||
$dEstimatedDate = date("Y-m-d", strtotime($nDataTmp . " " . $typeStatement . " " . $aDaysWeek[$indexDay])) . " " . date("H:i:s", strtotime($sActualTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ class Content extends BaseContent
|
||||
$workSpace = new workspaceTools( $workSpace );
|
||||
$workSpace->getDBInfo();
|
||||
|
||||
$link = mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass) or die( "Could not connect" );
|
||||
$link = @mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass) or die( "Could not connect" );
|
||||
|
||||
mysql_select_db( $workSpace->dbName, $link );
|
||||
mysql_query( "SET NAMES 'utf8';" );
|
||||
|
||||
@@ -150,8 +150,15 @@ class InputDocument extends BaseInputDocument
|
||||
if(!empty($aData['INP_DOC_DESTINATION_PATH'])){
|
||||
$description .= ", Destination Path: ".$aData['INP_DOC_DESTINATION_PATH'];
|
||||
}
|
||||
$inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
|
||||
$description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'].", Maximum Input Document file size: ".$inputDocMaxFileSize;
|
||||
$inputDocMaxFileSize = "";
|
||||
if(!empty($aData['INP_DOC_MAX_FILESIZE'])){
|
||||
$inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
|
||||
$inputDocMaxFileSize = ", Maximum Input Document file size: ".$inputDocMaxFileSize;
|
||||
}
|
||||
if(!empty($aData['INP_DOC_MAX_FILESIZE'])){
|
||||
$description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'];
|
||||
}
|
||||
$description .= $inputDocMaxFileSize;
|
||||
G::auditLog("CreateInputDocument", $description);
|
||||
|
||||
return $aData['INP_DOC_UID'];
|
||||
@@ -217,8 +224,15 @@ class InputDocument extends BaseInputDocument
|
||||
if(!empty($aData['INP_DOC_DESTINATION_PATH'])){
|
||||
$description .= ", Destination Path: ".$aData['INP_DOC_DESTINATION_PATH'];
|
||||
}
|
||||
$inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
|
||||
$description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'].", Maximum Input Document file size: ".$inputDocMaxFileSize;
|
||||
$inputDocMaxFileSize = "";
|
||||
if(!empty($aData['INP_DOC_MAX_FILESIZE'])){
|
||||
$inputDocMaxFileSize = $aData['INP_DOC_MAX_FILESIZE']? $aData['INP_DOC_MAX_FILESIZE'].' '.$aData['INP_DOC_MAX_FILESIZE_UNIT'] : "256 MB";
|
||||
$inputDocMaxFileSize = ", Maximum Input Document file size: ".$inputDocMaxFileSize;
|
||||
}
|
||||
if(!empty($aData['INP_DOC_MAX_FILESIZE'])){
|
||||
$description .= ", Extensions: ".$aData['INP_DOC_TYPE_FILE'];
|
||||
}
|
||||
$description .= $inputDocMaxFileSize;
|
||||
G::auditLog("UpdateInputDocument", $description);
|
||||
|
||||
return $iResult;
|
||||
|
||||
@@ -178,7 +178,12 @@ class OutputDocument extends BaseOutputDocument
|
||||
if(!empty($aData['OUT_DOC_DESCRIPTION'])){
|
||||
$description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION'];
|
||||
}
|
||||
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_GENERATE'])){
|
||||
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
|
||||
}
|
||||
if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){
|
||||
$pdfSecurity = 'Disabled';
|
||||
}else{
|
||||
@@ -194,12 +199,14 @@ class OutputDocument extends BaseOutputDocument
|
||||
if(!empty($aData['OUT_DOC_TAGS'])){
|
||||
$description .= ", Tags: ".$aData['OUT_DOC_TAGS'];
|
||||
}
|
||||
if($aData['OUT_DOC_OPEN_TYPE']==0){
|
||||
$genLink = 'Open the file';
|
||||
}else{
|
||||
$genLink = 'Download the file';
|
||||
}
|
||||
$description .= ", By clicking on the generated file link: ".$genLink;
|
||||
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
|
||||
if($aData['OUT_DOC_OPEN_TYPE']==0){
|
||||
$genLink = 'Open the file';
|
||||
}else{
|
||||
$genLink = 'Download the file';
|
||||
}
|
||||
$description .= ", By clicking on the generated file link: ".$genLink;
|
||||
}
|
||||
G::auditLog("CreateOutputDocument", $description);
|
||||
|
||||
return $aData['OUT_DOC_UID'];
|
||||
@@ -261,7 +268,12 @@ class OutputDocument extends BaseOutputDocument
|
||||
if(!empty($aData['OUT_DOC_DESCRIPTION'])){
|
||||
$description .= ", Description: ".$aData['OUT_DOC_DESCRIPTION'];
|
||||
}
|
||||
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'].", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Report Generator: ". $aData['OUT_DOC_REPORT_GENERATOR'];
|
||||
}
|
||||
if(!empty($aData['OUT_DOC_REPORT_GENERATOR'])){
|
||||
$description .= ", Output Document to Generate: ".$aData['OUT_DOC_GENERATE'];
|
||||
}
|
||||
if($aData['OUT_DOC_PDF_SECURITY_ENABLED']==0){
|
||||
$pdfSecurity = 'Disabled';
|
||||
}else{
|
||||
@@ -277,12 +289,14 @@ class OutputDocument extends BaseOutputDocument
|
||||
if(!empty($aData['OUT_DOC_TAGS'])){
|
||||
$description .= ", Tags: ".$aData['OUT_DOC_TAGS'];
|
||||
}
|
||||
if($aData['OUT_DOC_OPEN_TYPE']==0){
|
||||
$genLink = 'Open the file';
|
||||
}else{
|
||||
$genLink = 'Download the file';
|
||||
}
|
||||
$description .= ", By clicking on the generated file link: ".$genLink;
|
||||
if(!empty($aData['OUT_DOC_OPEN_TYPE'])){
|
||||
if($aData['OUT_DOC_OPEN_TYPE']==0){
|
||||
$genLink = 'Open the file';
|
||||
}else{
|
||||
$genLink = 'Download the file';
|
||||
}
|
||||
$description .= ", By clicking on the generated file link: ".$genLink;
|
||||
}
|
||||
if (isset($aData['OUT_DOC_TEMPLATE'])) {
|
||||
$description .= ", [EDIT TEMPLATE]";
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ class webEntryProxy extends HttpProxyController
|
||||
file_put_contents( $fileName, $template->getOutputContent() );
|
||||
//creating the third file, only if this wsClient.php file doesn't exists.
|
||||
$fileName = $pathProcess . 'wsClient.php';
|
||||
$pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php';
|
||||
$pluginTpl = PATH_CORE . "templates" . PATH_SEP . "processes" . PATH_SEP . "wsClient.php";
|
||||
|
||||
if (file_exists( $fileName )) {
|
||||
if (filesize( $fileName ) != filesize( $pluginTpl )) {
|
||||
|
||||
20
workflow/engine/methods/cases/CaseSchedulerCreateUpdate.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
try {
|
||||
if (!$_POST || count($_POST) == 0) {
|
||||
throw new Exception("The information sent is empty.");
|
||||
}
|
||||
|
||||
$prossesUid = trim($_POST["form"]["PRO_UID"]);
|
||||
$caseSchedulerUid = trim($_POST["form"]["SCH_UID"]);
|
||||
|
||||
$caseScheduler = new \ProcessMaker\BusinessModel\CaseScheduler();
|
||||
|
||||
$caseScheduler->createUpdate($caseSchedulerUid, $prossesUid, $_SESSION["USER_LOGGED"], $_POST["form"], (isset($_POST["pluginFields"]))? $_POST["pluginFields"] : array());
|
||||
|
||||
G::header("Location: cases_Scheduler_List?PRO_UID=" . $prossesUid);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ try {
|
||||
}
|
||||
|
||||
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_Edit.xml', '', $aFields, 'cases_Scheduler_Update' );
|
||||
$G_PUBLISH->AddContent("xmlform", "xmlform", "cases" . PATH_SEP . "cases_Scheduler_Edit.xml", "", $aFields, "CaseSchedulerCreateUpdate");
|
||||
|
||||
G::RenderPage( 'publishBlank', 'blank' );
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ try {
|
||||
$aFields['SCH_LIST'] .= htmlspecialchars($item['SCH_NAME'], ENT_QUOTES) . '^';
|
||||
}
|
||||
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Scheduler_New.xml', '', $aFields, 'cases_Scheduler_Save' );
|
||||
$G_PUBLISH->AddContent("xmlform", "xmlform", "cases" . PATH_SEP . "cases_Scheduler_New.xml", "", $aFields, "CaseSchedulerCreateUpdate");
|
||||
G::RenderPage( 'publishBlank', 'blank' );
|
||||
|
||||
} catch (Exception $oException) {
|
||||
|
||||
@@ -1,265 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* cases_Scheduler_Save.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2010 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
try {
|
||||
/*
|
||||
global $RBAC;
|
||||
switch ($RBAC->userCanAccess('PM_FACTORY'))
|
||||
{
|
||||
case -2:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
case -1:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
require_once 'classes/model/CaseScheduler.php';
|
||||
$oCaseScheduler = new CaseScheduler();
|
||||
|
||||
if (empty( $_POST )) {
|
||||
die( 'The information sended is empty!' );
|
||||
}
|
||||
|
||||
$aData['SCH_UID'] = G::generateUniqueID();
|
||||
$aData['SCH_NAME'] = $_POST['form']['SCH_NAME'];
|
||||
$aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME'];
|
||||
$aData['SCH_DEL_USER_PASS'] = Bootstrap::hashPassword($_POST['form']['SCH_USER_PASSWORD']);
|
||||
$aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID'];
|
||||
$aData['PRO_UID'] = $_POST['form']['PRO_UID'];
|
||||
$aData['TAS_UID'] = $_POST['form']['TAS_UID'];
|
||||
|
||||
$aData['SCH_STATE'] = 'ACTIVE';
|
||||
$aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE';
|
||||
$aData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
||||
|
||||
$sOption = $_POST['form']['SCH_OPTION'];
|
||||
$aData['SCH_OPTION'] = $sOption;
|
||||
|
||||
if ($_POST['form']['SCH_START_DATE'] != '') {
|
||||
$sDateTmp = $_POST['form']['SCH_START_DATE'];
|
||||
} else {
|
||||
$sDateTmp = date( 'Y-m-d' );
|
||||
}
|
||||
$sTimeTmp = $_POST['form']['SCH_START_TIME'];
|
||||
$aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
|
||||
$aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
|
||||
|
||||
$nActualTime = $_POST['form']['SCH_START_TIME']; // time();
|
||||
// $nActualDate = date("Y-m-d H:i:s", $nActualTime);
|
||||
|
||||
|
||||
$sValue = '';
|
||||
$sDaysPerformTask = '';
|
||||
$sWeeks = '';
|
||||
$sMonths = '';
|
||||
$sMonths = '';
|
||||
$sStartDay = '';
|
||||
$nSW = 0;
|
||||
$aData['SCH_START_DAY'] = '';
|
||||
$aData['SCH_REPEAT_EVERY'] = '';
|
||||
$aData['SCH_REPEAT_UNTIL'] = '';
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = '';
|
||||
switch ($sOption) {
|
||||
case '1': // Option 1
|
||||
$sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK'];
|
||||
switch ($sValue) {
|
||||
case '1':
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1';
|
||||
break;
|
||||
case '2':
|
||||
$aData['SCH_OPTION'] = '2';
|
||||
$aData['SCH_EVERY_DAYS'] = '1';
|
||||
$aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|';
|
||||
break;
|
||||
case '3': // Every [n] Days
|
||||
$sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3'];
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3'];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '2': // If the option is zero, set by default 1
|
||||
if (empty( $_POST['form']['SCH_EVERY_DAYS'] )) {
|
||||
$nEveryDays = 1;
|
||||
} else {
|
||||
$nEveryDays = $_POST['form']['SCH_EVERY_DAYS'];
|
||||
}
|
||||
$aData['SCH_EVERY_DAYS'] = $nEveryDays;
|
||||
$sWeeks = '';
|
||||
if (! empty( $_POST['form']['SCH_WEEK_DAYS'] )) {
|
||||
$aWeekDays = $_POST['form']['SCH_WEEK_DAYS'];
|
||||
foreach ($aWeekDays as $value) {
|
||||
$sWeeks = $sWeeks . $value . '|';
|
||||
}
|
||||
}
|
||||
if (! empty( $_POST['form']['SCH_WEEK_DAYS_2'] )) {
|
||||
$aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2'];
|
||||
foreach ($aWeekDays2 as $value) {
|
||||
$sWeeks = $sWeeks . $value . '|';
|
||||
}
|
||||
}
|
||||
$sStartTime = $_POST['form']['SCH_START_TIME'];
|
||||
$aData['SCH_WEEK_DAYS'] = $sWeeks;
|
||||
break;
|
||||
case '3':
|
||||
$nStartDay = $_POST['form']['SCH_START_DAY'];
|
||||
if ($nStartDay == 1) {
|
||||
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1'];
|
||||
} else {
|
||||
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK'];
|
||||
}
|
||||
|
||||
$sMonths = '';
|
||||
if (! empty( $_POST['form']['SCH_MONTHS'] )) {
|
||||
$aMonths = $_POST['form']['SCH_MONTHS'];
|
||||
foreach ($aMonths as $value) {
|
||||
$sMonths = $sMonths . $value . '|';
|
||||
}
|
||||
}
|
||||
if (! empty( $_POST['form']['SCH_MONTHS_2'] )) {
|
||||
$aMonths2 = $_POST['form']['SCH_MONTHS_2'];
|
||||
foreach ($aMonths2 as $value) {
|
||||
$sMonths = $sMonths . $value . '|';
|
||||
}
|
||||
}
|
||||
if (! empty( $_POST['form']['SCH_MONTHS_3'] )) {
|
||||
$aMonths3 = $_POST['form']['SCH_MONTHS_3'];
|
||||
foreach ($aMonths3 as $value) {
|
||||
$sMonths = $sMonths . $value . '|';
|
||||
}
|
||||
}
|
||||
$aData['SCH_MONTHS'] = $sMonths;
|
||||
$sStartDay = $aData['SCH_START_DAY'];
|
||||
$sValue = $nStartDay;
|
||||
break;
|
||||
}
|
||||
|
||||
if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) {
|
||||
if ($sStartDay == '') {
|
||||
$sStartDay = date( 'Y-m-d' );
|
||||
}
|
||||
|
||||
$dCurrentMonth = (int)(date("m"));
|
||||
$dCurrentDay = (int)(date("d"));
|
||||
$aStartDay = explode( "|", $aData['SCH_START_DAY'] );
|
||||
if ($sOption == '3' && $aStartDay[0] == '1') {
|
||||
$monthsArray = explode( "|", $sMonths );
|
||||
foreach ($monthsArray as $row) {
|
||||
if ((int)($row) == $dCurrentMonth && $dCurrentDay <= (int)($aStartDay[1])) {
|
||||
$startTime = $_POST['form']['SCH_START_TIME'] . ":00";
|
||||
$aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime;
|
||||
break;
|
||||
} else {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp );
|
||||
}
|
||||
} else {
|
||||
if ($sOption == '4') {
|
||||
$aData['SCH_END_DATE'] = $aData['SCH_START_TIME'];
|
||||
}
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME'];
|
||||
if ($sOption == 5) {
|
||||
$aData['SCH_START_TIME'] = time();
|
||||
$aData['SCH_START_DATE'] = $aData['SCH_START_TIME'];
|
||||
$nextRun = $_POST['form']['SCH_REPEAT_EVERY'] * 60 * 60;
|
||||
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
|
||||
$date = $aData['SCH_START_TIME'];
|
||||
$date += $nextRun;
|
||||
$date = date( "Y-m-d H:i", $date );
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $date;
|
||||
}
|
||||
}
|
||||
if (trim( $_POST['form']['SCH_END_DATE'] ) != '') {
|
||||
$aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE'];
|
||||
}
|
||||
|
||||
if (! empty( $_POST['form']['SCH_REPEAT_TASK_CHK'] )) {
|
||||
$nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT'];
|
||||
if ($nOptEvery == 2) {
|
||||
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60;
|
||||
} else {
|
||||
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
|
||||
$aData['CASE_SH_PLUGIN_UID'] = $_POST['form']['CASE_SH_PLUGIN_UID'];
|
||||
}
|
||||
//$aData['SCH_END_DATE'] = "2020-12-30";
|
||||
$oCaseScheduler->create( $aData );
|
||||
$sch_uid = $oCaseScheduler->getSchUid();
|
||||
|
||||
if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
|
||||
$params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] );
|
||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
|
||||
|
||||
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
|
||||
if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
|
||||
$caseSchedulerSelected = $caseSchedulerPluginDetail;
|
||||
}
|
||||
}
|
||||
if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
|
||||
//Save the form
|
||||
$oData = $_POST['pluginFields'];
|
||||
$oData['SCH_UID'] = $aData['SCH_UID'];
|
||||
$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData );
|
||||
}
|
||||
}
|
||||
|
||||
// //Added by Qennix
|
||||
// //Update Start Time Event in BPMN
|
||||
//
|
||||
// echo $_POST['form']['TAS_UID']."<<----";
|
||||
// if (isset($_POST['form']['TAS_UID'])){
|
||||
// require_once 'classes/model/Event.php';
|
||||
// require_once 'classes/model/Task.php';
|
||||
// echo $_POST['form']['TAS_UID']."<<----";
|
||||
//
|
||||
// $oTask = new Task();
|
||||
// $oTask->load($_POST['form']['TAS_UID']);
|
||||
// $evn_uid = $oTask->getStartingEvent();
|
||||
// $event = new Event();
|
||||
// $editEvent = array();
|
||||
// $editEvent['EVN_UID'] = $evn_uid;
|
||||
// $editEvent['EVN_ACTION'] = $sch_uid;
|
||||
// $event->update($editEvent);
|
||||
// //End Adding
|
||||
// }
|
||||
|
||||
|
||||
G::header( 'location: cases_Scheduler_List?PRO_UID=' . $_POST['form']['PRO_UID'] );
|
||||
|
||||
} catch (Exception $oException) {
|
||||
die( $oException->getMessage() );
|
||||
}
|
||||
|
||||
@@ -1,290 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* cases_Scheduler_Save.php
|
||||
*
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2010 Colosa Inc.23
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*/
|
||||
try {
|
||||
/*
|
||||
global $RBAC;
|
||||
switch ($RBAC->userCanAccess('PM_FACTORY'))
|
||||
{
|
||||
case -2:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
case -1:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
require_once 'classes/model/CaseScheduler.php';
|
||||
|
||||
if (empty( $_POST )) {
|
||||
die( 'The information sended is empty!' );
|
||||
}
|
||||
|
||||
foreach ($_POST["form"] as $key => $value) {
|
||||
$_POST["form"][$key] = trim($value);
|
||||
}
|
||||
|
||||
$aData = array();
|
||||
$aData['SCH_UID'] = $_POST['form']['SCH_UID'];
|
||||
$aData['SCH_NAME'] = $_POST['form']['SCH_NAME'];
|
||||
$aData['PRO_UID'] = $_POST['form']['PRO_UID'];
|
||||
$aData['TAS_UID'] = $_POST['form']['TAS_UID'];
|
||||
|
||||
$oCaseScheduler = new CaseScheduler();
|
||||
$oCaseScheduler->Load( $aData['SCH_UID'] );
|
||||
|
||||
$aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME'];
|
||||
if ($_POST['form']['SCH_USER_PASSWORD'] != 'DefaultPM') {
|
||||
$aData['SCH_DEL_USER_PASS'] = Bootstrap::hashPassword($_POST['form']['SCH_USER_PASSWORD']);
|
||||
}
|
||||
$aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID'];
|
||||
|
||||
// $aData['SCH_TIME_NEXT_RUN'] = time();
|
||||
//$aData['SCH_LAST_RUN_TIME'] = time();
|
||||
// $aData['SCH_STATE'] = 'ACTIVE';
|
||||
// $aData['SCH_LAST_STATE'] = 'ACTIVE';
|
||||
$aData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
||||
|
||||
$sOption = $_POST['form']['SCH_OPTION'];
|
||||
$aData['SCH_OPTION'] = $sOption;
|
||||
|
||||
$sDateTmp = $_POST['form']['SCH_START_DATE'];
|
||||
$sTimeTmp = $_POST['form']['SCH_START_TIME'];
|
||||
$aData['SCH_START_TIME'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
|
||||
$aData['SCH_START_DATE'] = date( 'Y-m-d', strtotime( $sDateTmp ) ) . ' ' . date( 'H:i:s', strtotime( $sTimeTmp ) );
|
||||
$previousStartTime = date( 'Y-m-d', strtotime( $_POST['form']['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) );
|
||||
$previousStartDate = date( 'Y-m-d', strtotime( $_POST['form']['PREV_SCH_START_DATE'] ) ) . ' ' . date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) );
|
||||
|
||||
$sValue = '';
|
||||
$sDaysPerformTask = '';
|
||||
$sWeeks = '';
|
||||
$sMonths = '';
|
||||
$sMonths = '';
|
||||
$sStartDay = '';
|
||||
$nSW = 0;
|
||||
|
||||
switch ($sOption) {
|
||||
case '1':
|
||||
// Option 1
|
||||
$sValue = $_POST['form']['SCH_DAYS_PERFORM_TASK'];
|
||||
switch ($sValue) {
|
||||
case '1':
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|1';
|
||||
break;
|
||||
case '2':
|
||||
$aData['SCH_OPTION'] = '2';
|
||||
$aData['SCH_EVERY_DAYS'] = '1';
|
||||
$aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|';
|
||||
break;
|
||||
case '3': // Every [n] Days
|
||||
$sDaysPerformTask = $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3'];
|
||||
$aData['SCH_DAYS_PERFORM_TASK'] = $_POST['form']['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['form']['SCH_DAYS_PERFORM_TASK_OPT_3'];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
// If the option is zero, set by default 1
|
||||
if (empty( $_POST['form']['SCH_EVERY_DAYS'] )) {
|
||||
$nEveryDays = 1;
|
||||
} else {
|
||||
$nEveryDays = $_POST['form']['SCH_EVERY_DAYS'];
|
||||
}
|
||||
$aData['SCH_EVERY_DAYS'] = $nEveryDays;
|
||||
$sWeeks = '';
|
||||
if (! empty( $_POST['form']['SCH_WEEK_DAYS'] )) {
|
||||
$aWeekDays = $_POST['form']['SCH_WEEK_DAYS'];
|
||||
foreach ($aWeekDays as $value) {
|
||||
$sWeeks = $sWeeks . $value . '|';
|
||||
}
|
||||
}
|
||||
if (! empty( $_POST['form']['SCH_WEEK_DAYS_2'] )) {
|
||||
$aWeekDays2 = $_POST['form']['SCH_WEEK_DAYS_2'];
|
||||
foreach ($aWeekDays2 as $value) {
|
||||
$sWeeks = $sWeeks . $value . '|';
|
||||
}
|
||||
}
|
||||
$sStartTime = $_POST['form']['SCH_START_TIME'];
|
||||
$aData['SCH_WEEK_DAYS'] = $sWeeks;
|
||||
break;
|
||||
case '3':
|
||||
$nStartDay = $_POST['form']['SCH_START_DAY'];
|
||||
if ($nStartDay == 1) {
|
||||
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_1'];
|
||||
} else {
|
||||
$aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['form']['SCH_START_DAY_OPT_2_WEEKS'] . '|' . $_POST['form']['SCH_START_DAY_OPT_2_DAYS_WEEK'];
|
||||
}
|
||||
|
||||
$sMonths = '';
|
||||
if (! empty( $_POST['form']['SCH_MONTHS'] )) {
|
||||
$aMonths = $_POST['form']['SCH_MONTHS'];
|
||||
foreach ($aMonths as $value) {
|
||||
$sMonths = $sMonths . $value . '|';
|
||||
}
|
||||
}
|
||||
if (! empty( $_POST['form']['SCH_MONTHS_2'] )) {
|
||||
$aMonths2 = $_POST['form']['SCH_MONTHS_2'];
|
||||
foreach ($aMonths2 as $value) {
|
||||
$sMonths = $sMonths . $value . '|';
|
||||
}
|
||||
}
|
||||
if (! empty( $_POST['form']['SCH_MONTHS_3'] )) {
|
||||
$aMonths3 = $_POST['form']['SCH_MONTHS_3'];
|
||||
foreach ($aMonths3 as $value) {
|
||||
$sMonths = $sMonths . $value . '|';
|
||||
}
|
||||
}
|
||||
$aData['SCH_MONTHS'] = $sMonths;
|
||||
$sStartDay = $aData['SCH_START_DAY'];
|
||||
$sValue = $nStartDay;
|
||||
break;
|
||||
|
||||
}
|
||||
if (trim( $_POST['form']['SCH_END_DATE'] ) != '') {
|
||||
$aData['SCH_END_DATE'] = $_POST['form']['SCH_END_DATE'];
|
||||
}
|
||||
// if the start date has changed then recalculate the next run time
|
||||
if ($_POST['form']['SCH_START_DATE'] == $_POST['form']['PREV_SCH_START_DATE']) {
|
||||
$recalculateDate = false;
|
||||
} else {
|
||||
$recalculateDate = true;
|
||||
}
|
||||
if (date( 'H:i:s', strtotime( $_POST['form']['SCH_START_TIME'] ) ) == date( 'H:i:s', strtotime( $_POST['form']['PREV_SCH_START_TIME'] ) )) {
|
||||
$recalculateTime = false;
|
||||
} else {
|
||||
$recalculateTime = true;
|
||||
}
|
||||
// if the start date has changed then recalculate the next run time
|
||||
|
||||
|
||||
// var_dump($recalculateTime);
|
||||
// die();
|
||||
$nActualTime = $_POST['form']['SCH_START_TIME'];
|
||||
if (($sOption != '1') && ($sOption != '4') && ($sOption != '5')) {
|
||||
if ($sStartDay == '') {
|
||||
$sStartDay = date( 'Y-m-d' );
|
||||
}
|
||||
// echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."<br>";
|
||||
$dCurrentDay = date( "d" );
|
||||
$dCurrentMonth = date( "m" );
|
||||
$aStartDay = explode( "|", $aData['SCH_START_DAY'] );
|
||||
if ($sOption == '3' && $aStartDay[0] == '1') {
|
||||
$monthsArray = explode( "|", $sMonths );
|
||||
foreach ($monthsArray as $row) {
|
||||
if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) {
|
||||
$startTime = $_POST['form']['SCH_START_TIME'] . ":00";
|
||||
if ($recalculateDate) {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = date( 'Y' ) . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime;
|
||||
} elseif ($recalculateTime) {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00";
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if ($recalculateDate) {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp );
|
||||
} elseif ($recalculateTime) {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($recalculateDate) {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun( $sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp );
|
||||
} elseif ($recalculateTime) {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00";
|
||||
}
|
||||
}
|
||||
// print_r ($aData['SCH_TIME_NEXT_RUN']);
|
||||
// die;
|
||||
} else {
|
||||
if ($sOption == '4') {
|
||||
$aData['SCH_END_DATE'] = $aData['SCH_START_TIME'];
|
||||
}
|
||||
if ($recalculateDate) {
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME'];
|
||||
} elseif ($recalculateTime) {
|
||||
|
||||
// $Fields = $oCaseScheduler->Load($aData['SCH_UID']);
|
||||
// $Fields['SCH_LAST_STATE'] = $aRow['SCH_STATE'];
|
||||
// $Fields['SCH_STATE'] = 'PROCESSED';
|
||||
// $this->Update($Fields);
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->getSchTimeNextRun( "Y-m-d" ) . " " . $_POST['form']['SCH_START_TIME'] . ":00";
|
||||
}
|
||||
// var_dump($recalculateTime);
|
||||
// var_dump($aData['SCH_TIME_NEXT_RUN']);
|
||||
// die;
|
||||
if ($sOption == '5') {
|
||||
$date = $oCaseScheduler->getSchLastRunTime();
|
||||
if ($date == null) {
|
||||
$date = $oCaseScheduler->getSchStartTime();
|
||||
}
|
||||
$date = strtotime( $date );
|
||||
$nextRun = $_POST['form']['SCH_REPEAT_EVERY'] * 60 * 60;
|
||||
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
|
||||
$date += $nextRun;
|
||||
$date = date( "Y-m-d H:i", $date );
|
||||
$aData['SCH_TIME_NEXT_RUN'] = $date;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty( $_POST['form']['SCH_REPEAT_TASK_CHK'] )) {
|
||||
$nOptEvery = $_POST['form']['SCH_REPEAT_EVERY_OPT'];
|
||||
if ($nOptEvery == 2) {
|
||||
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'] * 60;
|
||||
} else {
|
||||
$aData['SCH_REPEAT_EVERY'] = $_POST['form']['SCH_REPEAT_EVERY'];
|
||||
}
|
||||
|
||||
}
|
||||
// var_dump ($aData['SCH_TIME_NEXT_RUN']);
|
||||
// die;
|
||||
$oCaseScheduler->Update( $aData );
|
||||
if ((isset( $_POST['form']['CASE_SH_PLUGIN_UID'] )) && ($_POST['form']['CASE_SH_PLUGIN_UID'] != "")) {
|
||||
$params = explode( "--", $_REQUEST['form']['CASE_SH_PLUGIN_UID'] );
|
||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
|
||||
|
||||
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
|
||||
if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
|
||||
$caseSchedulerSelected = $caseSchedulerPluginDetail;
|
||||
|
||||
}
|
||||
}
|
||||
if ((isset( $caseSchedulerSelected )) && (is_object( $caseSchedulerSelected ))) {
|
||||
//Save the form
|
||||
$oData = $_POST['pluginFields'];
|
||||
$oData['SCH_UID'] = $aData['SCH_UID'];
|
||||
$oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData );
|
||||
}
|
||||
}
|
||||
|
||||
G::header( 'location: cases_Scheduler_List?PRO_UID=' . $_POST['form']['PRO_UID'] );
|
||||
|
||||
} catch (Exception $oException) {
|
||||
die( $oException->getMessage() );
|
||||
}
|
||||
|
||||
@@ -32,13 +32,9 @@ try {
|
||||
throw (new Exception( G::LoadTranslation('ID_TASK') . "'" . $TaskFields['TAS_TITLE'] . "'" . G::LoadTranslation('ID_NOT_HAVE_USERS')));
|
||||
}
|
||||
|
||||
if (G::is_https())
|
||||
$http = 'https://';
|
||||
else
|
||||
$http = 'http://';
|
||||
|
||||
$http = (G::is_https())? "https://" : "http://";
|
||||
$sContent = '';
|
||||
|
||||
|
||||
$infoProcess = new Process();
|
||||
$resultProcess = $infoProcess->load($sPRO_UID);
|
||||
|
||||
@@ -76,7 +72,7 @@ try {
|
||||
$template->assign( 'wsUser', $sWS_USER );
|
||||
$template->assign( 'wsPass', Bootstrap::hashPassword($sWS_PASS, '', true) );
|
||||
$template->assign( 'wsRoundRobin', $sWS_ROUNDROBIN );
|
||||
|
||||
|
||||
G::auditLog('WebEntry','Generate web entry with web services ('.$dynTitle.'.php) in process "'.$resultProcess['PRO_TITLE'].'"');
|
||||
|
||||
if ($sWE_USR == "2") {
|
||||
@@ -94,7 +90,7 @@ try {
|
||||
file_put_contents( $fileName, $template->getOutputContent() );
|
||||
//creating the third file, only if this wsClient.php file doesn't exist.
|
||||
$fileName = $pathProcess . 'wsClient.php';
|
||||
$pluginTpl = file_exists(PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php') ? PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php' : PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'wsClient.php';
|
||||
$pluginTpl = PATH_CORE . "templates" . PATH_SEP . "processes" . PATH_SEP . "wsClient.php";
|
||||
if (file_exists( $fileName )) {
|
||||
if (filesize( $fileName ) != filesize( $pluginTpl )) {
|
||||
@copy( $fileName, $pathProcess . 'wsClient.php.bck' );
|
||||
@@ -123,7 +119,7 @@ try {
|
||||
$link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php';
|
||||
print $link;
|
||||
//print "\n<a href='$link' target='_new' > $link </a>";
|
||||
|
||||
|
||||
} else {
|
||||
$G_FORM = new Form( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false );
|
||||
$G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php';
|
||||
|
||||
@@ -787,6 +787,11 @@ form.formDefault .content,
|
||||
background-color: #FFF;
|
||||
border: #dddddd 1px solid;
|
||||
}
|
||||
@media screen\0 {
|
||||
form.formDefault .content, .pagedTableDefault {
|
||||
width:450px;
|
||||
}
|
||||
}
|
||||
.pagedTableDefault {
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
|
||||
@@ -825,5 +825,360 @@ class CaseScheduler
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create/Update CaseScheduler
|
||||
*
|
||||
* @param string $caseSchedulerUid Unique id of CaseScheduler
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param string $userUidCreatorUpdater Unique id of creator/updater User
|
||||
* @param array $arrayData Data
|
||||
* @param array $arrayDataPlugin Data plugin
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function createUpdate($caseSchedulerUid, $projectUid, $userUidCreatorUpdater, array $arrayData, array $arrayDataPlugin = array())
|
||||
{
|
||||
try {
|
||||
//Set variables
|
||||
$flagInsert = ($caseSchedulerUid == "")? true : false;
|
||||
$option = ($flagInsert)? "INS" : "UPD";
|
||||
|
||||
//Set data
|
||||
if ($flagInsert) {
|
||||
$caseSchedulerUid = \ProcessMaker\Util\Common::generateUID();
|
||||
}
|
||||
|
||||
foreach ($arrayData as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $key2 => $value2) {
|
||||
$arrayData[$key][$key2] = trim($value2);
|
||||
}
|
||||
} else {
|
||||
$arrayData[$key] = trim($value);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayCaseSchedulerData = array();
|
||||
$arrayCaseSchedulerData["SCH_UID"] = $caseSchedulerUid;
|
||||
$arrayCaseSchedulerData["SCH_NAME"] = $arrayData["SCH_NAME"];
|
||||
$arrayCaseSchedulerData["PRO_UID"] = $projectUid;
|
||||
$arrayCaseSchedulerData["TAS_UID"] = $arrayData["TAS_UID"];
|
||||
|
||||
$arrayCaseSchedulerData["SCH_DEL_USER_UID"] = $arrayData["SCH_USER_UID"];
|
||||
$arrayCaseSchedulerData["SCH_DEL_USER_NAME"] = $arrayData["SCH_USER_NAME"];
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_DEL_USER_PASS"] = \Bootstrap::hashPassword($arrayData["SCH_USER_PASSWORD"]);
|
||||
|
||||
$arrayCaseSchedulerData["SCH_STATE"] = "ACTIVE";
|
||||
$arrayCaseSchedulerData["SCH_LAST_STATE"] = "CREATED";
|
||||
|
||||
$sDateTmp = ($arrayData["SCH_START_DATE"] != "")? $arrayData["SCH_START_DATE"] : date("Y-m-d");
|
||||
break;
|
||||
case "UPD":
|
||||
if ($arrayData["SCH_USER_PASSWORD"] != "DefaultPM") {
|
||||
$arrayCaseSchedulerData["SCH_DEL_USER_PASS"] = \Bootstrap::hashPassword($arrayData["SCH_USER_PASSWORD"]);
|
||||
}
|
||||
|
||||
$sDateTmp = $arrayData["SCH_START_DATE"];
|
||||
break;
|
||||
}
|
||||
|
||||
$caseSchedulerOption = (int)($arrayData["SCH_OPTION"]);
|
||||
|
||||
$arrayCaseSchedulerData["USR_UID"] = $userUidCreatorUpdater;
|
||||
$arrayCaseSchedulerData["SCH_OPTION"] = $caseSchedulerOption;
|
||||
$arrayCaseSchedulerData["SCH_START_TIME"] = date("Y-m-d", strtotime($sDateTmp)) . " " . date("H:i:s", strtotime($arrayData["SCH_START_TIME"]));
|
||||
$arrayCaseSchedulerData["SCH_START_DATE"] = date("Y-m-d", strtotime($sDateTmp)) . " " . date("H:i:s", strtotime($arrayData["SCH_START_TIME"]));
|
||||
|
||||
$sValue = "";
|
||||
$sDaysPerformTask = "";
|
||||
$sWeeks = "";
|
||||
$sMonths = "";
|
||||
$sStartDay = "";
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_START_DAY"] = "";
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = "";
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_UNTIL"] = "";
|
||||
$arrayCaseSchedulerData["SCH_DAYS_PERFORM_TASK"] = "";
|
||||
break;
|
||||
case "UPD":
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($caseSchedulerOption) {
|
||||
case 1:
|
||||
//Option 1
|
||||
$sValue = $arrayData["SCH_DAYS_PERFORM_TASK"];
|
||||
|
||||
switch ($sValue) {
|
||||
case "1":
|
||||
$arrayCaseSchedulerData["SCH_DAYS_PERFORM_TASK"] = $arrayData["SCH_DAYS_PERFORM_TASK"] . "|1";
|
||||
break;
|
||||
case "2":
|
||||
$arrayCaseSchedulerData["SCH_OPTION"] = "2";
|
||||
$arrayCaseSchedulerData["SCH_EVERY_DAYS"] = "1";
|
||||
$arrayCaseSchedulerData["SCH_WEEK_DAYS"] = "1|2|3|4|5|";
|
||||
break;
|
||||
case "3":
|
||||
//Every [n] Days
|
||||
$sDaysPerformTask = $arrayData["SCH_DAYS_PERFORM_TASK_OPT_3"];
|
||||
$arrayCaseSchedulerData["SCH_DAYS_PERFORM_TASK"] = $arrayData["SCH_DAYS_PERFORM_TASK"] . "|" . $arrayData["SCH_DAYS_PERFORM_TASK_OPT_3"];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//If the option is zero, set by default 1
|
||||
$arrayCaseSchedulerData["SCH_EVERY_DAYS"] = (empty($arrayData["SCH_EVERY_DAYS"]))? 1 : $arrayData["SCH_EVERY_DAYS"];
|
||||
|
||||
$sWeeks = "";
|
||||
|
||||
if (!empty($arrayData["SCH_WEEK_DAYS"])) {
|
||||
$aWeekDays = $arrayData["SCH_WEEK_DAYS"];
|
||||
|
||||
foreach ($aWeekDays as $value) {
|
||||
$sWeeks = $sWeeks . $value . "|";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayData["SCH_WEEK_DAYS_2"])) {
|
||||
$aWeekDays2 = $arrayData["SCH_WEEK_DAYS_2"];
|
||||
|
||||
foreach ($aWeekDays2 as $value) {
|
||||
$sWeeks = $sWeeks . $value . "|";
|
||||
}
|
||||
}
|
||||
|
||||
$sStartTime = $arrayData["SCH_START_TIME"];
|
||||
$arrayCaseSchedulerData["SCH_WEEK_DAYS"] = $sWeeks;
|
||||
break;
|
||||
case 3:
|
||||
$nStartDay = $arrayData["SCH_START_DAY"];
|
||||
|
||||
if ($nStartDay == 1) {
|
||||
$arrayCaseSchedulerData["SCH_START_DAY"] = $nStartDay . "|" . $arrayData["SCH_START_DAY_OPT_1"];
|
||||
} else {
|
||||
$arrayCaseSchedulerData["SCH_START_DAY"] = $nStartDay . "|" . $arrayData["SCH_START_DAY_OPT_2_WEEKS"] . "|" . $arrayData["SCH_START_DAY_OPT_2_DAYS_WEEK"];
|
||||
}
|
||||
|
||||
$sMonths = "";
|
||||
|
||||
if (!empty($arrayData["SCH_MONTHS"])) {
|
||||
$aMonths = $arrayData["SCH_MONTHS"];
|
||||
|
||||
foreach ($aMonths as $value) {
|
||||
$sMonths = $sMonths . $value . "|";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayData["SCH_MONTHS_2"])) {
|
||||
$aMonths2 = $arrayData["SCH_MONTHS_2"];
|
||||
|
||||
foreach ($aMonths2 as $value) {
|
||||
$sMonths = $sMonths . $value . "|";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayData["SCH_MONTHS_3"])) {
|
||||
$aMonths3 = $arrayData["SCH_MONTHS_3"];
|
||||
|
||||
foreach ($aMonths3 as $value) {
|
||||
$sMonths = $sMonths . $value . "|";
|
||||
}
|
||||
}
|
||||
|
||||
$arrayCaseSchedulerData["SCH_MONTHS"] = $sMonths;
|
||||
$sStartDay = $arrayCaseSchedulerData["SCH_START_DAY"];
|
||||
$sValue = $nStartDay;
|
||||
break;
|
||||
}
|
||||
|
||||
$caseScheduler = new \CaseScheduler();
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
break;
|
||||
case "UPD":
|
||||
$arrayDataAux = $caseScheduler->load($caseSchedulerUid);
|
||||
|
||||
if ($arrayData["SCH_END_DATE"] != "") {
|
||||
$arrayCaseSchedulerData["SCH_END_DATE"] = $arrayData["SCH_END_DATE"];
|
||||
}
|
||||
|
||||
//If the start date has changed then recalculate the next run time
|
||||
$recalculateDate = ($arrayData["SCH_START_DATE"] == $arrayData["PREV_SCH_START_DATE"])? false : true;
|
||||
$recalculateTime = (date("H:i:s", strtotime($arrayData["SCH_START_TIME"])) == date("H:i:s", strtotime($arrayData["PREV_SCH_START_TIME"])))? false : true;
|
||||
break;
|
||||
}
|
||||
|
||||
$nActualTime = $arrayData["SCH_START_TIME"];
|
||||
|
||||
if ($caseSchedulerOption != 1 && $caseSchedulerOption != 4 && $caseSchedulerOption != 5) {
|
||||
if ($sStartDay == "") {
|
||||
$sStartDay = date("Y-m-d");
|
||||
}
|
||||
|
||||
$dCurrentDay = (int)(date("d"));
|
||||
$dCurrentMonth = (int)(date("m"));
|
||||
|
||||
$aStartDay = explode("|", $arrayCaseSchedulerData["SCH_START_DAY"]);
|
||||
|
||||
if ($caseSchedulerOption == 3 && $aStartDay[0] == "1") {
|
||||
$monthsArray = explode("|", $sMonths);
|
||||
|
||||
foreach ($monthsArray as $row) {
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
if ((int)($row) == $dCurrentMonth && $dCurrentDay <= (int)($aStartDay[1])) {
|
||||
$startTime = $arrayData["SCH_START_TIME"] . ":00";
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y") . "-" . $row . "-" . $aStartDay[1] . " " . $startTime;
|
||||
break;
|
||||
} else {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->updateNextRun($caseSchedulerOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp, false);
|
||||
}
|
||||
break;
|
||||
case "UPD":
|
||||
if ($dCurrentMonth == $row && $dCurrentDay < $aStartDay[1]) {
|
||||
$startTime = $arrayData["SCH_START_TIME"] . ":00";
|
||||
|
||||
if ($recalculateDate) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y") . "-" . $row . "-" . $aStartDay[1] . " " . $startTime;
|
||||
} else {
|
||||
if ($recalculateTime) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->getSchTimeNextRun("Y-m-d") . " " . $arrayData["SCH_START_TIME"] . ":00";
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if ($recalculateDate) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->updateNextRun($caseSchedulerOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp, false);
|
||||
} else {
|
||||
if ($recalculateTime) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->getSchTimeNextRun("Y-m-d") . " " . $arrayData["SCH_START_TIME"] . ":00";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->updateNextRun($caseSchedulerOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp, false);
|
||||
break;
|
||||
case "UPD":
|
||||
if ($recalculateDate) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->updateNextRun($caseSchedulerOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp, false);
|
||||
} else {
|
||||
if ($recalculateTime) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->getSchTimeNextRun("Y-m-d") . " " . $arrayData["SCH_START_TIME"] . ":00";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($caseSchedulerOption == 4) {
|
||||
$arrayCaseSchedulerData["SCH_END_DATE"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
}
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
break;
|
||||
case "UPD":
|
||||
if ($recalculateDate) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
} else {
|
||||
if ($recalculateTime) {
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = $caseScheduler->getSchTimeNextRun("Y-m-d") . " " . $arrayData["SCH_START_TIME"] . ":00";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($caseSchedulerOption == 5) {
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$arrayCaseSchedulerData["SCH_START_TIME"] = time();
|
||||
$arrayCaseSchedulerData["SCH_START_DATE"] = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
|
||||
$date = $arrayCaseSchedulerData["SCH_START_TIME"];
|
||||
break;
|
||||
case "UPD":
|
||||
$date = $caseScheduler->getSchLastRunTime();
|
||||
|
||||
if (is_null($date)) {
|
||||
$date = $caseScheduler->getSchStartTime();
|
||||
}
|
||||
|
||||
$date = strtotime($date);
|
||||
break;
|
||||
}
|
||||
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = $arrayData["SCH_REPEAT_EVERY"];
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y-m-d H:i", $date + (((int)($arrayData["SCH_REPEAT_EVERY"])) * 60 * 60));
|
||||
}
|
||||
}
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
if ($arrayData["SCH_END_DATE"] != "") {
|
||||
$arrayCaseSchedulerData["SCH_END_DATE"] = $arrayData["SCH_END_DATE"];
|
||||
}
|
||||
break;
|
||||
case "UPD":
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($arrayData["SCH_REPEAT_TASK_CHK"])) {
|
||||
if ($arrayData["SCH_REPEAT_EVERY_OPT"] . "" == "2") {
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = ((int)($arrayData["SCH_REPEAT_EVERY"])) * 60;
|
||||
} else {
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = (int)($arrayData["SCH_REPEAT_EVERY"]);
|
||||
}
|
||||
}
|
||||
|
||||
//Create/Update
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
if (isset($arrayData["CASE_SH_PLUGIN_UID"]) && $arrayData["CASE_SH_PLUGIN_UID"] != "") {
|
||||
$arrayCaseSchedulerData["CASE_SH_PLUGIN_UID"] = $arrayData["CASE_SH_PLUGIN_UID"];
|
||||
}
|
||||
|
||||
$caseScheduler->create($arrayCaseSchedulerData);
|
||||
break;
|
||||
case "UPD":
|
||||
$caseScheduler->update($arrayCaseSchedulerData);
|
||||
break;
|
||||
}
|
||||
|
||||
//Plugin
|
||||
if (isset($arrayData["CASE_SH_PLUGIN_UID"]) && $arrayData["CASE_SH_PLUGIN_UID"] != "") {
|
||||
$oPluginRegistry = &\PMPluginRegistry::getSingleton();
|
||||
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
|
||||
|
||||
$params = explode("--", $arrayData["CASE_SH_PLUGIN_UID"]);
|
||||
|
||||
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
|
||||
if ($caseSchedulerPluginDetail->sNamespace == $params[0] && $caseSchedulerPluginDetail->sActionId == $params[1]) {
|
||||
$caseSchedulerSelected = $caseSchedulerPluginDetail;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($caseSchedulerSelected) && is_object($caseSchedulerSelected)) {
|
||||
//Save the form
|
||||
$arrayDataPlugin["SCH_UID"] = $arrayCaseSchedulerData["SCH_UID"];
|
||||
$oPluginRegistry->executeMethod($caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $arrayDataPlugin);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -431,40 +431,51 @@ class Cases
|
||||
throw (new \Exception($arrayData));
|
||||
}
|
||||
} else {
|
||||
\G::LoadClass("wsBase");
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\AppCacheViewPeer::DEL_INDEX);
|
||||
$criteria->add(\AppCacheViewPeer::USR_UID, $userUid);
|
||||
$criteria->add(\AppCacheViewPeer::APP_UID, $applicationUid);
|
||||
$criteria->add(
|
||||
//ToDo - getToDo()
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "TO_DO", \CRITERIA::EQUAL)->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
|
||||
)->addOr(
|
||||
//Draft - getDraft()
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::APP_STATUS, "DRAFT", \CRITERIA::EQUAL)->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::APP_THREAD_STATUS, "OPEN"))->addAnd(
|
||||
$criteria->getNewCriterion(\AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN"))
|
||||
);
|
||||
$criteria->addDescendingOrderByColumn(\AppCacheViewPeer::APP_NUMBER);
|
||||
$rsCriteria = \AppCacheViewPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$row["DEL_INDEX"] = '';
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::APP_UID);
|
||||
$criteria->add(\AppDelegationPeer::APP_UID, $applicationUid);
|
||||
$criteria->add(\AppDelegationPeer::USR_UID, $userUid);
|
||||
|
||||
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
|
||||
}
|
||||
\G::LoadClass('wsBase');
|
||||
|
||||
//Get data
|
||||
$arrayStatusInfo = $this->getStatusInfo($applicationUid);
|
||||
|
||||
$applicationStatus = "";
|
||||
$delIndex = 0;
|
||||
$flagUseDelIndex = false;
|
||||
|
||||
if (count($arrayStatusInfo) > 0) {
|
||||
$applicationStatus = $arrayStatusInfo["APP_STATUS"];
|
||||
$delIndex = $arrayStatusInfo["DEL_INDEX"];
|
||||
|
||||
if (in_array($applicationStatus, array("DRAFT", "PAUSED", "CANCELLED"))) {
|
||||
$flagUseDelIndex = true;
|
||||
}
|
||||
}
|
||||
|
||||
$ws = new \wsBase();
|
||||
$fields = $ws->getCaseInfo($applicationUid, $row["DEL_INDEX"]);
|
||||
|
||||
$fields = $ws->getCaseInfo($applicationUid, $delIndex, $flagUseDelIndex);
|
||||
$array = json_decode(json_encode($fields), true);
|
||||
|
||||
if ($array ["status_code"] != 0) {
|
||||
throw (new \Exception($array ["message"]));
|
||||
} else {
|
||||
$array['app_uid'] = $array['caseId'];
|
||||
$array['app_number'] = $array['caseNumber'];
|
||||
$array['app_name'] = $array['caseName'];
|
||||
$array['app_status'] = $array['caseStatus'];
|
||||
$array["app_status"] = ($applicationStatus != "")? $applicationStatus : $array["caseStatus"];
|
||||
$array['app_init_usr_uid'] = $array['caseCreatorUser'];
|
||||
$array['app_init_usr_username'] = trim($array['caseCreatorUserName']);
|
||||
$array['pro_uid'] = $array['processId'];
|
||||
@@ -472,6 +483,9 @@ class Cases
|
||||
$array['app_create_date'] = $array['createDate'];
|
||||
$array['app_update_date'] = $array['updateDate'];
|
||||
$array['current_task'] = $array['currentUsers'];
|
||||
|
||||
$aCurrent_task = array();
|
||||
|
||||
for ($i = 0; $i<=count($array['current_task'])-1; $i++) {
|
||||
$current_task = $array['current_task'][$i];
|
||||
$current_task['usr_uid'] = $current_task['userId'];
|
||||
@@ -481,6 +495,8 @@ class Cases
|
||||
$current_task['del_index'] = $current_task['delIndex'];
|
||||
$current_task['del_thread'] = $current_task['delThread'];
|
||||
$current_task['del_thread_status'] = $current_task['delThreadStatus'];
|
||||
$current_task["del_init_date"] = $current_task["delInitDate"] . "";
|
||||
$current_task["del_task_due_date"] = $current_task["delTaskDueDate"];
|
||||
unset($current_task['userId']);
|
||||
unset($current_task['userName']);
|
||||
unset($current_task['taskId']);
|
||||
@@ -551,6 +567,8 @@ class Cases
|
||||
$del = \DBAdapter::getStringDelimiter();
|
||||
$oCriteria->addSelectColumn( \AppDelegationPeer::DEL_INDEX );
|
||||
$oCriteria->addSelectColumn( \AppDelegationPeer::TAS_UID );
|
||||
$oCriteria->addSelectColumn(\AppDelegationPeer::DEL_INIT_DATE);
|
||||
$oCriteria->addSelectColumn(\AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$oCriteria->addAsColumn( 'TAS_TITLE', 'C1.CON_VALUE' );
|
||||
$oCriteria->addAlias( "C1", 'CONTENT' );
|
||||
$tasTitleConds = array ();
|
||||
@@ -568,7 +586,9 @@ class Cases
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$result = array ('tas_uid' => $aRow['TAS_UID'],
|
||||
'tas_title' => $aRow['TAS_TITLE'],
|
||||
'del_index' => $aRow['DEL_INDEX']);
|
||||
'del_index' => $aRow['DEL_INDEX'],
|
||||
"del_init_date" => $aRow["DEL_INIT_DATE"] . "",
|
||||
"del_task_due_date" => $aRow["DEL_TASK_DUE_DATE"]);
|
||||
$oDataset->next();
|
||||
}
|
||||
//Return
|
||||
@@ -2211,5 +2231,108 @@ class Cases
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status info Case
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
*
|
||||
* return array Return an array with status info Case, array empty otherwise
|
||||
*/
|
||||
public function getStatusInfo($applicationUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
|
||||
//Get data
|
||||
//Status is PAUSED
|
||||
$delimiter = \DBAdapter::getStringDelimiter();
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn($delimiter . "PAUSED" . $delimiter . " AS APP_STATUS");
|
||||
$criteria->addSelectColumn(\AppDelayPeer::APP_DEL_INDEX . " AS DEL_INDEX");
|
||||
|
||||
$criteria->add(\AppDelayPeer::APP_UID, $applicationUid, \Criteria::EQUAL);
|
||||
$criteria->add(\AppDelayPeer::APP_TYPE, "PAUSE", \Criteria::EQUAL);
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, null, \Criteria::ISNULL)->addOr(
|
||||
$criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, 0, \Criteria::EQUAL))
|
||||
);
|
||||
|
||||
$rsCriteria = \AppDelayPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]);
|
||||
}
|
||||
|
||||
//Status is TO_DO, DRAFT
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ApplicationPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
|
||||
|
||||
$arrayCondition = array();
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppThreadPeer::APP_UID, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL);
|
||||
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
|
||||
|
||||
$criteria->add(
|
||||
$criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "TO_DO", \Criteria::EQUAL)->addAnd(
|
||||
$criteria->getNewCriterion(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd(
|
||||
$criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd(
|
||||
$criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN"))
|
||||
)->addOr(
|
||||
$criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "DRAFT", \Criteria::EQUAL)->addAnd(
|
||||
$criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd(
|
||||
$criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN"))
|
||||
);
|
||||
|
||||
$rsCriteria = \ApplicationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]);
|
||||
}
|
||||
|
||||
//Status is CANCELLED, COMPLETED
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ApplicationPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
|
||||
|
||||
$arrayCondition = array();
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL);
|
||||
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
|
||||
|
||||
$criteria->add(\ApplicationPeer::APP_STATUS, array("CANCELLED", "COMPLETED"), \Criteria::IN);
|
||||
$criteria->add(\AppDelegationPeer::DEL_LAST_INDEX, 1, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \ApplicationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return array("APP_STATUS" => $row["APP_STATUS"], "DEL_INDEX" => $row["DEL_INDEX"]);
|
||||
}
|
||||
|
||||
//Return
|
||||
return array();
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,8 @@ class FilesManager
|
||||
$oProcessFiles->setPrfCreateDate($sDate);
|
||||
$oProcessFiles->save();
|
||||
$fp = fopen($sDirectory, 'w');
|
||||
$content = $aData['prf_content'];
|
||||
$content = stripslashes($aData['prf_content']);
|
||||
$content = str_replace("@amp@", "&", $content);
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
$oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(),
|
||||
@@ -372,7 +373,8 @@ class FilesManager
|
||||
$oProcessFiles->setPrfUpdateDate($sDate);
|
||||
$oProcessFiles->save();
|
||||
$fp = fopen($path, 'w');
|
||||
$content = $aData['prf_content'];
|
||||
$content = stripslashes($aData['prf_content']);
|
||||
$content = str_replace("@amp@", "&", $content);
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
$oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(),
|
||||
|
||||
@@ -333,6 +333,8 @@ class OutputDocument
|
||||
$oOutputDocument->setOutDocFilename($outputDocumentData['OUT_DOC_FILENAME']);
|
||||
}
|
||||
if (isset($outputDocumentData['OUT_DOC_TEMPLATE'])) {
|
||||
$outputDocumentData['OUT_DOC_TEMPLATE'] = stripslashes($outputDocumentData['OUT_DOC_TEMPLATE']);
|
||||
$outputDocumentData['OUT_DOC_TEMPLATE'] = str_replace("@amp@", "&", $outputDocumentData['OUT_DOC_TEMPLATE']);
|
||||
$oOutputDocument->setOutDocTemplate($outputDocumentData['OUT_DOC_TEMPLATE']);
|
||||
}
|
||||
$oOutputDocument->save();
|
||||
|
||||
@@ -384,18 +384,20 @@ class Task
|
||||
|
||||
$result = $task->update($arrayProperty);
|
||||
if (!empty($arrayProperty['CONSOLIDATE_DATA'])) {
|
||||
G::LoadClass("consolidatedCases");
|
||||
$consolidated = new \ConsolidatedCases();
|
||||
$dataConso = array(
|
||||
'con_status' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_enable'],
|
||||
'tas_uid' => $arrayProperty['TAS_UID'],
|
||||
'dyn_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'],
|
||||
'pro_uid' => $arrayProperty['PRO_UID'],
|
||||
'rep_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_report_table'],
|
||||
'table_name' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_table'],
|
||||
'title' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_title']
|
||||
);
|
||||
$consolidated->saveConsolidated($dataConso);
|
||||
if (isset($arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'])) {
|
||||
G::LoadClass("consolidatedCases");
|
||||
$consolidated = new \ConsolidatedCases();
|
||||
$dataConso = array(
|
||||
'con_status' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_enable'],
|
||||
'tas_uid' => $arrayProperty['TAS_UID'],
|
||||
'dyn_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'],
|
||||
'pro_uid' => $arrayProperty['PRO_UID'],
|
||||
'rep_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_report_table'],
|
||||
'table_name' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_table'],
|
||||
'title' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_title']
|
||||
);
|
||||
$consolidated->saveConsolidated($dataConso);
|
||||
}
|
||||
}
|
||||
$arrayResult["status"] = "OK";
|
||||
|
||||
|
||||
@@ -395,17 +395,16 @@ class WebEntry
|
||||
$fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n";
|
||||
$fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n";
|
||||
$fileContent .= "\$G_PUBLISH = new Publisher();\n";
|
||||
|
||||
|
||||
$fileContent .= "G::LoadClass('pmDynaform');\n";
|
||||
$fileContent .= "\$a = new pmDynaform(array('CURRENT_DYNAFORM'=>'" . $arrayWebEntryData["DYN_UID"] . "'));\n";
|
||||
$fileContent .= "if(\$a->isResponsive()){";
|
||||
$fileContent .= "\$a->printWebEntry('".$fileName."Post.php');";
|
||||
$fileContent .= "}else {";
|
||||
$fileContent .= "\$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . "/" . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n";
|
||||
$fileContent .= "G::RenderPage(\"publish\", \"blank\");";
|
||||
$fileContent .= "}";
|
||||
|
||||
$fileContent .= "G::LoadClass(\"pmDynaform\");\n";
|
||||
$fileContent .= "\$a = new pmDynaform(array(\"CURRENT_DYNAFORM\" => \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n";
|
||||
$fileContent .= "if (\$a->isResponsive()) {";
|
||||
$fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");";
|
||||
$fileContent .= "} else {";
|
||||
$fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n";
|
||||
$fileContent .= " G::RenderPage(\"publish\", \"blank\");";
|
||||
$fileContent .= "}";
|
||||
|
||||
file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent);
|
||||
|
||||
//Creating the second file, the post file who receive the post form.
|
||||
@@ -442,7 +441,7 @@ class WebEntry
|
||||
|
||||
//Creating the third file, only if this wsClient.php file doesn't exist.
|
||||
$fileName = $pathDataPublicProcess . PATH_SEP . "wsClient.php";
|
||||
$pluginTpl = PATH_TEST . "unit" . PATH_SEP . "ws" . PATH_SEP . "wsClient.php";
|
||||
$pluginTpl = PATH_CORE . "templates" . PATH_SEP . "processes" . PATH_SEP . "wsClient.php";
|
||||
|
||||
if (file_exists($fileName)) {
|
||||
if (filesize($fileName) != filesize($pluginTpl)) {
|
||||
|
||||
@@ -599,12 +599,12 @@ class Cases extends Api
|
||||
public function doGetCaseInfo($app_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oData = $cases->getCaseInfo($app_uid, $userUid);
|
||||
return $oData;
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case->setFormatFieldNameInUppercase(false);
|
||||
|
||||
return $case->getCaseInfo($app_uid, $this->getUserId());
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,14 +119,16 @@ class Activity extends Api
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$properties = $task->updateProperties($prj_uid, $act_uid, $request_data);
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (\PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
$actionsByEmailService = new \ProcessMaker\BusinessModel\ActionsByEmail();
|
||||
$actionsByEmailService->saveConfiguration($request_data['properties']['_features']);
|
||||
if (isset($request_data['properties']['_features'])) {
|
||||
$actionsByEmailService = new \ProcessMaker\BusinessModel\ActionsByEmail();
|
||||
$actionsByEmailService->saveConfiguration($request_data['properties']['_features']);
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ class Server implements iAuthenticate
|
||||
$clientId = $_GET['client_id'];
|
||||
$requestedScope = isset($_GET['scope']) ? $_GET['scope'] : '*';
|
||||
$requestedScope = empty($requestedScope) ? array() : explode(' ', $requestedScope);
|
||||
$client = $this->storage->getClientDetails($clientId);;
|
||||
$client = $this->storage->getClientDetails($clientId);
|
||||
|
||||
if (empty($client)) {
|
||||
// throw error, client does not exist.
|
||||
@@ -309,7 +309,17 @@ class Server implements iAuthenticate
|
||||
if ($returnResponse) {
|
||||
return $response;
|
||||
} else {
|
||||
$response->send();
|
||||
if ($response->getStatusCode() == 400) {
|
||||
$msg = $response->getParameter("error_description", "");
|
||||
$msg = ($msg != "")? $msg : $response->getParameter("error", "");
|
||||
|
||||
$rest = new \Maveriks\Extension\Restler();
|
||||
$rest->setMessage(new \Luracast\Restler\RestException(\ProcessMaker\Services\Api::STAT_APP_EXCEPTION, $msg));
|
||||
|
||||
exit(0);
|
||||
} else {
|
||||
$response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -642,9 +642,8 @@ ImportPMTableCSV = function(){
|
||||
waitTitle : " ",
|
||||
success : function(o, resp){
|
||||
w.close();
|
||||
infoGrid.store.reload();
|
||||
|
||||
PMExt.notify('IMPORT RESULT', resp.result.message);
|
||||
setTimeout(function(){location.reload();},1500);
|
||||
},
|
||||
failure: function(o, resp){
|
||||
w.close();
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
<PROPERTIES_INF type="subtitle" enablehtml="1">
|
||||
<en><![CDATA[Enter the username and password of the user who will be assigned to the initial task in the case.]]></en>
|
||||
</PROPERTIES_INF>
|
||||
<SCH_UID type="hidden"><![CDATA[ SELECT count( * )+1 AS UID FROM CASE_SCHEDULER ]]><en/></SCH_UID>
|
||||
<SCH_LIST type="hidden">
|
||||
</SCH_LIST>
|
||||
<PHP_CURRENT_DATE type="hidden">
|
||||
</PHP_CURRENT_DATE>
|
||||
<SCH_UID type="hidden" />
|
||||
<SCH_LIST type="hidden" />
|
||||
<PHP_CURRENT_DATE type="hidden" />
|
||||
<SCH_USER_NAME type="text" maxlength="100" validate="Any" required="1" readonly="0" size="40" mode="edit">
|
||||
<en><![CDATA[User Name]]></en>
|
||||
</SCH_USER_NAME>
|
||||
@@ -552,7 +550,7 @@ function validateSchedulerFields(oForm) {
|
||||
msgBox("@G::LoadTranslation(ID_REQUIRED_NAME_CASE_SCHEDULER)", 'alert');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var listNames = document.getElementById('form[SCH_LIST]').value;
|
||||
listNames = listNames.split("^");
|
||||
for (var i= 1; i<listNames.length; i++) {
|
||||
|
||||
@@ -318,7 +318,8 @@
|
||||
if ( defined('SYS_TEMP') && SYS_TEMP != '') {
|
||||
//this is the default, the workspace db.php file is in /shared/workflow/sites/SYS_SYS
|
||||
if ( file_exists( PATH_DB . SYS_TEMP . '/db.php' ) ) {
|
||||
require_once( PATH_DB . SYS_TEMP . '/db.php' );
|
||||
$pathFile = $filter->validateInput(PATH_DB . SYS_TEMP . '/db.php','path');
|
||||
require_once( $pathFile );
|
||||
define ( 'SYS_SYS' , SYS_TEMP );
|
||||
|
||||
// defining constant for workspace shared directory
|
||||
@@ -348,7 +349,8 @@
|
||||
else{
|
||||
|
||||
if (substr(SYS_SKIN, 0, 2) === 'ux' && SYS_TARGET != 'sysLoginVerify') { // new ux sysLogin - extjs based form
|
||||
require_once PATH_CONTROLLERS . 'main.php';
|
||||
$pathFile = $filter->validateInput(PATH_CONTROLLERS . 'main.php','path');
|
||||
require_once $pathFile;
|
||||
$controllerClass = 'Main';
|
||||
$controllerAction = SYS_TARGET == 'sysLoginVerify' ? SYS_TARGET : 'sysLogin';
|
||||
//if the method exists
|
||||
@@ -552,7 +554,8 @@
|
||||
|
||||
//erik: verify if it is a Controller Class or httpProxyController Class
|
||||
if (is_file(PATH_CONTROLLERS . SYS_COLLECTION . '.php')) {
|
||||
require_once PATH_CONTROLLERS . SYS_COLLECTION . '.php';
|
||||
$pathFile = $filter->validateInput(PATH_CONTROLLERS . SYS_COLLECTION . '.php','path');
|
||||
require_once $pathFile;
|
||||
$controllerClass = SYS_COLLECTION;
|
||||
//if the method name is empty set default to index method
|
||||
$controllerAction = SYS_TARGET != '' ? SYS_TARGET : 'index';
|
||||
|
||||
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 11 KiB |
@@ -340,6 +340,9 @@ Bootstrap::LoadThirdParty("smarty/libs", "Smarty.class");
|
||||
//Loading the autoloader libraries feature
|
||||
Bootstrap::registerSystemClasses();
|
||||
|
||||
//Load filter class
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$skinPathErrors = G::skinGetPathToSrcByVirtualUri("errors", $config);
|
||||
$skinPathUpdate = G::skinGetPathToSrcByVirtualUri("update", $config);
|
||||
|
||||
@@ -373,10 +376,6 @@ $virtualURITable['/skins/(*)'] = PATH_HTML . 'skins/'; //ugly
|
||||
$virtualURITable['/images/(*)'] = PATH_HTML . 'images/'; //ugly
|
||||
$virtualURITable['/[a-zA-Z][a-zA-Z0-9]{0,}/'] = 'errorFile';
|
||||
|
||||
//Load filter class
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
|
||||
// Verify if we need to redirect or stream the file, if G:VirtualURI returns true means we are going to redirect the page
|
||||
if (Bootstrap::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath )) {
|
||||
// review if the file requested belongs to public_html plugin
|
||||
@@ -489,8 +488,9 @@ if (defined( 'PATH_DATA' ) && file_exists( PATH_DATA )) {
|
||||
Bootstrap::LoadClass( 'serverConfiguration' );
|
||||
$oServerConf = & serverConf::getSingleton();
|
||||
}
|
||||
|
||||
require_once PATH_THIRDPARTY . '/pear/PEAR.php';
|
||||
$pathFile = PATH_THIRDPARTY . '/pear/PEAR.php';
|
||||
$pathFile = $filter->validateInput($pathFile,'path');
|
||||
require_once $pathFile;
|
||||
|
||||
//Bootstrap::LoadSystem( 'pmException' );
|
||||
|
||||
@@ -504,7 +504,9 @@ if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) {
|
||||
define( 'PATH_DATA', PATH_C );
|
||||
//NewRelic Snippet - By JHL
|
||||
transactionLog(PATH_CONTROLLERS.'installer.php');
|
||||
require_once (PATH_CONTROLLERS . 'installer.php');
|
||||
$pathFile = PATH_CONTROLLERS . 'installer.php';
|
||||
$pathFile = $filter->validateInput($pathFile,'path');
|
||||
require_once ($pathFile);
|
||||
$controller = 'Installer';
|
||||
|
||||
// if the method name is empty set default to index method
|
||||
@@ -548,8 +550,10 @@ if ($oServerConf->isWSDisabled( SYS_TEMP )) {
|
||||
// if SYS_TEMP exists, the URL has a workspace, now we need to verify if exists their db.php file
|
||||
if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
|
||||
//this is the default, the workspace db.php file is in /shared/workflow/sites/SYS_SYS
|
||||
if (file_exists( PATH_DB . SYS_TEMP . '/db.php' )) {
|
||||
require_once (PATH_DB . SYS_TEMP . '/db.php');
|
||||
$pathFile = PATH_DB . SYS_TEMP . '/db.php';
|
||||
$pathFile = $filter->validateInput($pathFile,'path');
|
||||
if (file_exists( $pathFile )) {
|
||||
require_once ($pathFile);
|
||||
define( 'SYS_SYS', SYS_TEMP );
|
||||
|
||||
// defining constant for workspace shared directory
|
||||
@@ -575,11 +579,14 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
|
||||
die();
|
||||
} else {
|
||||
if (SYS_TARGET == "dbInfo") { //Show dbInfo when no SYS_SYS
|
||||
require_once (PATH_METHODS . "login/dbInfo.php");
|
||||
$pathFile = PATH_METHODS . "login/dbInfo.php";
|
||||
$pathFile = $filter->validateInput($pathFile,'path');
|
||||
require_once ($pathFile);
|
||||
} else {
|
||||
|
||||
if (substr( SYS_SKIN, 0, 2 ) === 'ux' && SYS_TARGET != 'sysLoginVerify') { // new ux sysLogin - extjs based form
|
||||
require_once PATH_CONTROLLERS . 'main.php';
|
||||
$pathFile = $filter->validateInput(PATH_CONTROLLERS . 'main.php','path');
|
||||
require_once $pathFile;
|
||||
$controllerClass = 'Main';
|
||||
$controllerAction = SYS_TARGET == 'sysLoginVerify' ? SYS_TARGET : 'sysLogin';
|
||||
//if the method exists
|
||||
@@ -590,7 +597,8 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
|
||||
$controller->call( $controllerAction );
|
||||
}
|
||||
} else { // classic sysLogin interface
|
||||
require_once (PATH_METHODS . "login/sysLogin.php");
|
||||
$pathFile = $filter->validateInput(PATH_METHODS . "login/sysLogin.php",'path');
|
||||
require_once ($pathFile);
|
||||
die();
|
||||
}
|
||||
}
|
||||
@@ -684,13 +692,15 @@ ob_start();
|
||||
|
||||
// Rebuild the base Workflow translations if not exists
|
||||
if (! is_file( PATH_LANGUAGECONT . 'translation.en' )) {
|
||||
require_once ("classes/model/Translation.php");
|
||||
$pathFile = $filter->validateInput("classes/model/Translation.php",'path');
|
||||
require_once ($pathFile);
|
||||
$fields = Translation::generateFileTranslation( 'en' );
|
||||
}
|
||||
|
||||
// TODO: Verify if the language set into url is defined in translations env.
|
||||
if (SYS_LANG != 'en' && ! is_file( PATH_LANGUAGECONT . 'translation.' . SYS_LANG )) {
|
||||
require_once ("classes/model/Translation.php");
|
||||
$pathFile = $filter->validateInput("classes/model/Translation.php",'path');
|
||||
require_once ($pathFile);
|
||||
$fields = Translation::generateFileTranslation( SYS_LANG );
|
||||
}
|
||||
|
||||
@@ -760,7 +770,8 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
|
||||
//erik: verify if it is a Controller Class or httpProxyController Class
|
||||
if (is_file( PATH_CONTROLLERS . SYS_COLLECTION . '.php' )) {
|
||||
Bootstrap::LoadSystem( 'controller' );
|
||||
require_once PATH_CONTROLLERS . SYS_COLLECTION . '.php';
|
||||
$pathFile = $filter->validateInput(PATH_CONTROLLERS . SYS_COLLECTION . '.php','path');
|
||||
require_once $pathFile;
|
||||
$controllerClass = SYS_COLLECTION;
|
||||
//if the method name is empty set default to index method
|
||||
$controllerAction = SYS_TARGET != '' ? SYS_TARGET : 'index';
|
||||
@@ -913,7 +924,8 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
|
||||
Bootstrap::LoadClass( 'sessions' );
|
||||
$oSessions = new Sessions();
|
||||
if ($aSession = $oSessions->verifySession( $_GET['sid'] )) {
|
||||
require_once 'classes/model/Users.php';
|
||||
$pathFile = $filter->validateInput('classes/model/Users.php','path');
|
||||
require_once $pathFile;
|
||||
$oUser = new Users();
|
||||
$aUser = $oUser->load( $aSession['USR_UID'] );
|
||||
$_SESSION['USER_LOGGED'] = $aUser['USR_UID'];
|
||||
|
||||