diff --git a/gulliver/system/class.inputfilter.php b/gulliver/system/class.inputfilter.php index e4c34b9a2..90c9763b1 100644 --- a/gulliver/system/class.inputfilter.php +++ b/gulliver/system/class.inputfilter.php @@ -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': diff --git a/gulliver/thirdparty/phing/Phing.php b/gulliver/thirdparty/phing/Phing.php index 88fe35eef..00e9dfb12 100644 --- a/gulliver/thirdparty/phing/Phing.php +++ b/gulliver/thirdparty/phing/Phing.php @@ -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))); } } diff --git a/gulliver/thirdparty/propel/Propel.php b/gulliver/thirdparty/propel/Propel.php index a28a85c00..ef2ece638 100755 --- a/gulliver/thirdparty/propel/Propel.php +++ b/gulliver/thirdparty/propel/Propel.php @@ -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(); } diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index d062d39ea..2c16891b0 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -2133,7 +2133,7 @@ function PMFCreateUser ($userId, $password, $firstname, $lastname, $email, $role * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFUpdateUser.28.29 * * @param string(32) | $userUid | User UID | The user UID. - * @param string(32) | $userName | User ID | The username for the user. + * @param string(32) | $userName | Username | The username for the user. * @param string(32) | $firstName=null | Firstname of the user | Optional parameter. The first name of the user, which can be up to 50 characters long. * @param string(32) | $lastName=null | Lastname of the user | Optional parameter. The last name of the user, which can be up to 50 characters long. * @param string(32) | $email=null | Email the user | Optional parameter. The email of the user, which can be up to 100 characters long. diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 828c01560..cea83655a 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -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': diff --git a/workflow/engine/classes/model/AppCacheView.php b/workflow/engine/classes/model/AppCacheView.php index 9a2d1a8de..12e6c4d30 100755 --- a/workflow/engine/classes/model/AppCacheView.php +++ b/workflow/engine/classes/model/AppCacheView.php @@ -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"]; } diff --git a/workflow/engine/classes/model/CaseScheduler.php b/workflow/engine/classes/model/CaseScheduler.php index ef148c7b3..e3fa5805a 100755 --- a/workflow/engine/classes/model/CaseScheduler.php +++ b/workflow/engine/classes/model/CaseScheduler.php @@ -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)); } } } diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php index cec41fcb8..947dfea6b 100755 --- a/workflow/engine/classes/model/Content.php +++ b/workflow/engine/classes/model/Content.php @@ -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';" ); diff --git a/workflow/engine/classes/model/InputDocument.php b/workflow/engine/classes/model/InputDocument.php index b19036ad8..d6004dd16 100755 --- a/workflow/engine/classes/model/InputDocument.php +++ b/workflow/engine/classes/model/InputDocument.php @@ -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; diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index d177b31f3..47d48d602 100755 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -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]"; } diff --git a/workflow/engine/controllers/webEntryProxy.php b/workflow/engine/controllers/webEntryProxy.php index 6601dcda1..ff246dc37 100755 --- a/workflow/engine/controllers/webEntryProxy.php +++ b/workflow/engine/controllers/webEntryProxy.php @@ -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 )) { diff --git a/workflow/engine/methods/cases/CaseSchedulerCreateUpdate.php b/workflow/engine/methods/cases/CaseSchedulerCreateUpdate.php new file mode 100644 index 000000000..2a9c9da33 --- /dev/null +++ b/workflow/engine/methods/cases/CaseSchedulerCreateUpdate.php @@ -0,0 +1,20 @@ +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); +} + diff --git a/workflow/engine/methods/cases/cases_Scheduler_Edit.php b/workflow/engine/methods/cases/cases_Scheduler_Edit.php index d54863d45..5acc5a3e5 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Edit.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Edit.php @@ -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' ); diff --git a/workflow/engine/methods/cases/cases_Scheduler_New.php b/workflow/engine/methods/cases/cases_Scheduler_New.php index 02f407815..4b5720d2e 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_New.php +++ b/workflow/engine/methods/cases/cases_Scheduler_New.php @@ -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) { diff --git a/workflow/engine/methods/cases/cases_Scheduler_Save.php b/workflow/engine/methods/cases/cases_Scheduler_Save.php deleted file mode 100755 index 2e0b2afef..000000000 --- a/workflow/engine/methods/cases/cases_Scheduler_Save.php +++ /dev/null @@ -1,265 +0,0 @@ -. - * - * 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() ); -} - diff --git a/workflow/engine/methods/cases/cases_Scheduler_Update.php b/workflow/engine/methods/cases/cases_Scheduler_Update.php deleted file mode 100755 index c21a31a5b..000000000 --- a/workflow/engine/methods/cases/cases_Scheduler_Update.php +++ /dev/null @@ -1,290 +0,0 @@ -. - * - * 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."
"; - $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() ); -} - diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index d7d410777..f6194487d 100755 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -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 $link "; - + } 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'; diff --git a/workflow/engine/skinEngine/neoclassic/css/style.css b/workflow/engine/skinEngine/neoclassic/css/style.css index 54e56e44f..532b5b70e 100644 --- a/workflow/engine/skinEngine/neoclassic/css/style.css +++ b/workflow/engine/skinEngine/neoclassic/css/style.css @@ -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; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/CaseScheduler.php b/workflow/engine/src/ProcessMaker/BusinessModel/CaseScheduler.php index 45cf59f6b..4377d8198 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/CaseScheduler.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/CaseScheduler.php @@ -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; + } + } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php b/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php index c8a8830fe..cdb3a9fc8 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php @@ -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(), diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php index e6100cbda..8e4cadce3 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/OutputDocument.php @@ -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(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php index b643559aa..a1278a5f5 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php @@ -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"; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index 8bb5a2dbd..d83cdbec0 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -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)) { diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity.php index bef609a7f..0d3f8369d 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/Activity.php @@ -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()); } diff --git a/workflow/engine/templates/pmTables/data.js b/workflow/engine/templates/pmTables/data.js index 75aa13b23..2f2b045d4 100755 --- a/workflow/engine/templates/pmTables/data.js +++ b/workflow/engine/templates/pmTables/data.js @@ -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(); diff --git a/workflow/engine/xmlform/cases/cases_Scheduler_New.xml b/workflow/engine/xmlform/cases/cases_Scheduler_New.xml index 6bd2f70f1..2638979fa 100755 --- a/workflow/engine/xmlform/cases/cases_Scheduler_New.xml +++ b/workflow/engine/xmlform/cases/cases_Scheduler_New.xml @@ -9,11 +9,9 @@ - - - - - + + + @@ -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; ivalidateInput(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'; diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index e93105a23..9f693cd98 100755 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -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'];