diff --git a/workflow/engine/src/BusinessModel/CaseScheduler.php b/workflow/engine/src/BusinessModel/CaseScheduler.php index 3fc6a1c36..895e40f70 100644 --- a/workflow/engine/src/BusinessModel/CaseScheduler.php +++ b/workflow/engine/src/BusinessModel/CaseScheduler.php @@ -346,7 +346,7 @@ class CaseScheduler $nSW = 0; $aData['SCH_DAYS_PERFORM_TASK'] = ''; switch ($sOption) { - case '1': + case '1': // If the option is zero, set by default 1 $aData['SCH_DAYS_PERFORM_TASK'] = '1'; $sValue = $aData['SCH_DAYS_PERFORM_TASK']; switch ($sValue) { @@ -637,7 +637,7 @@ class CaseScheduler $nSW = 0; $aData['SCH_DAYS_PERFORM_TASK'] = ''; switch ($sOption) { - case '1': + case '1': // If the option is zero, set by default 1 $aData['SCH_DAYS_PERFORM_TASK'] = '1'; $sValue = $aData['SCH_DAYS_PERFORM_TASK']; switch ($sValue) { diff --git a/workflow/engine/src/BusinessModel/FilesManager.php b/workflow/engine/src/BusinessModel/FilesManager.php index b62c51461..c21812c25 100644 --- a/workflow/engine/src/BusinessModel/FilesManager.php +++ b/workflow/engine/src/BusinessModel/FilesManager.php @@ -44,6 +44,10 @@ class FilesManager public function getProcessFilesManagerPath($sProcessUID, $path) { try { + $checkPath = substr($path, -1); + if ($checkPath == '/') { + $path = substr($path, 0, -1); + } $sMainDirectory = current(explode("/", $path)); if (strstr($path,'/')) { $sSubDirectory = substr($path, strpos($path, "/")+1). PATH_SEP ; @@ -84,10 +88,10 @@ class FilesManager $arrayFileUid = $this->getFileManagerUid($sDirectory.$aFile['FILE']); $fcontent = file_get_contents($sDirectory.$aFile['FILE']); $fileUid = $arrayFileUid["PRF_UID"]; - if ($fileUid) { + if ($fileUid != null) { $oProcessFiles = \ProcessFilesPeer::retrieveByPK($fileUid); $editable = $oProcessFiles->getPrfEditable(); - if ($editable == 1){ + if ($editable == '1') { $editable = 'true'; } else { $editable = 'false'; @@ -102,11 +106,10 @@ class FilesManager 'prf_create_date' => $oProcessFiles->getPrfCreateDate(), 'prf_update_date' => $oProcessFiles->getPrfUpdateDate(), 'prf_content' => $fcontent); - } else { $extention = end(explode(".", $aFile['FILE'])); - if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' || - $extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') { + if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' + || $extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') { $editable = 'true'; } else { $editable = 'false'; @@ -122,7 +125,6 @@ class FilesManager 'prf_update_date' => '', 'prf_content' => $fcontent); } - } return $aTheFiles; } catch (Exception $e) { @@ -145,7 +147,7 @@ class FilesManager { try { $aData['prf_path'] = rtrim($aData['prf_path'], '/') . '/'; - if (!$aData['prf_filename']){ + if (!$aData['prf_filename']) { throw (new \Exception( 'invalid value specified for `prf_filename`.')); } $sMainDirectory = current(explode("/", $aData['prf_path'])); @@ -199,6 +201,7 @@ class FilesManager fwrite($fp, $content); fclose($fp); $oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(), + 'prf_filename' => $aData['prf_filename'], 'usr_uid' => $oProcessFiles->getUsrUid(), 'prf_update_usr_uid' => $oProcessFiles->getPrfUpdateUsrUid(), 'prf_path' => $sMainDirectory. PATH_SEP . $sSubDirectory, @@ -236,7 +239,7 @@ class FilesManager $path = $aRow['PRF_PATH']; $rsCriteria->next(); } - if ($path == ''){ + if ($path == '') { throw new \Exception(\G::LoadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM')); } $file = end(explode("/",$path)); @@ -246,7 +249,7 @@ class FilesManager if ($_FILES['prf_file']['tmp_name'] != '') { \G::uploadFile($_FILES['prf_file']['tmp_name'], $path, $_FILES['prf_file']['name']); } - } + } } else { throw new \Exception(\G::LoadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM')); } @@ -306,14 +309,14 @@ class FilesManager $path = $aRow['PRF_PATH']; $rsCriteria->next(); } - if ($path == ''){ + if ($path == '') { throw new \Exception('invalid value specified for `prf_uid`.'); } $sFile = end(explode("/",$path)); $sPath = str_replace($sFile,'',$path); $sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID))))); $sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath); - if ($sMainDirectory == PATH_DATA_MAILTEMPLATES){ + if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) { $sMainDirectory = 'mailTemplates'; } else { $sMainDirectory = 'public'; @@ -375,14 +378,14 @@ class FilesManager $path = $aRow['PRF_PATH']; $rsCriteria->next(); } - if ($path == ''){ + if ($path == '') { throw new \Exception('invalid value specified for `prf_uid`.'); } $sFile = end(explode("/",$path)); $sPath = str_replace($sFile,'',$path); $sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID))))); $sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath); - if ($sMainDirectory == PATH_DATA_MAILTEMPLATES){ + if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) { $sMainDirectory = 'mailTemplates'; } else { $sMainDirectory = 'public'; @@ -419,14 +422,14 @@ class FilesManager $path = $aRow['PRF_PATH']; $rsCriteria->next(); } - if ($path == ''){ + if ($path == '') { throw new \Exception('invalid value specified for `prf_uid`.'); } $sFile = end(explode("/",$path)); $sPath = str_replace($sFile,'',$path); $sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID))))); $sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath); - if ($sMainDirectory == PATH_DATA_MAILTEMPLATES){ + if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) { $sMainDirectory = 'mailTemplates'; } else { $sMainDirectory = 'public'; diff --git a/workflow/engine/src/BusinessModel/Task.php b/workflow/engine/src/BusinessModel/Task.php index 6609c8eba..6e221c1cb 100644 --- a/workflow/engine/src/BusinessModel/Task.php +++ b/workflow/engine/src/BusinessModel/Task.php @@ -1027,7 +1027,6 @@ class Task 'aas_type' => "user" ); } $oDataset->next(); - } if ($start) { if ($start < 0) { @@ -1933,8 +1932,9 @@ class Task * * @return array */ - public function arrayPagination($display_array, $page, $show_per_page) { - $page = $page+1; + public function arrayPagination($display_array, $page, $show_per_page) + { + $page = $page + 1; $show_per_page = $show_per_page -1; $start = ($page - 1) * ($show_per_page + 1); $offset = $show_per_page + 1; diff --git a/workflow/engine/src/BusinessModel/User.php b/workflow/engine/src/BusinessModel/User.php index 2bd40c0ab..5d1a011ef 100644 --- a/workflow/engine/src/BusinessModel/User.php +++ b/workflow/engine/src/BusinessModel/User.php @@ -220,26 +220,26 @@ class User if ($form['USR_COUNTRY'] != '') { $oCountry = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']); if (is_null($oCountry)) { - throw new \Exception('invalid value for `usr_country`: '.$form['USR_COUNTRY']); - } + throw new \Exception('invalid value for `usr_country`: '.$form['USR_COUNTRY']); + } } if ($form['USR_CITY'] != '') { $oCity = \IsoSubdivisionPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_CITY']); if (is_null($oCity)) { - throw new \Exception('invalid value for `usr_city`: '.$form['USR_CITY']); - } + throw new \Exception('invalid value for `usr_city`: '.$form['USR_CITY']); + } } if ($form['USR_LOCATION'] != '') { $oLocation = \IsoLocationPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_LOCATION']); if (is_null($oLocation)) { - throw new \Exception('invalid value for `usr_location`: '.$form['USR_LOCATION']); - } + throw new \Exception('invalid value for `usr_location`: '.$form['USR_LOCATION']); + } } if ($form['USR_COUNTRY'] != '') { $oReplacedBy = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']); if (is_null($oReplacedBy)) { - throw new \Exception('invalid value for `usr_country`: '.$form['USR_COUNTRY']); - } + throw new \Exception('invalid value for `usr_country`: '.$form['USR_COUNTRY']); + } } if (isset($arrayData['USR_UID'])) { $form['USR_UID'] = $arrayData['USR_UID']; @@ -313,7 +313,7 @@ class User $aData['USR_BIRTHDAY'] = date('Y-m-d'); $aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN']; $statusWF = $form['USR_STATUS']; - if ($form['USR_STATUS'] == '') { + if ($form['USR_STATUS'] == '') { throw new \Exception('invalid value specified for `usr_status`, can`t be null'); } else { if ($form['USR_STATUS'] == 'ACTIVE' || $form['USR_STATUS'] == 'INACTIVE' || $form['USR_STATUS'] == 'VACATION') { @@ -322,7 +322,7 @@ class User throw new \Exception('`usr_status`. Invalid value for status field.'); } } - if ($form['USR_ROLE'] == '') { + if ($form['USR_ROLE'] == '') { throw new \Exception('invalid value specified for `usr_role`, can`t be null'); } else { $oCriteria = new \Criteria('rbac'); diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php index e1cf9c96d..3b083339e 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php @@ -239,6 +239,6 @@ class Assignee extends Api //Response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } - } + } } diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php index fec254d3b..6abe205d5 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php @@ -145,7 +145,7 @@ class ProcessFilesManagerStructure * @var string {@from body} */ public $prf_path; - + /** * @var string {@from body} */ diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/OutputDocuments.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/OutputDocuments.php index 0a35330fd..9cbc3f581 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/OutputDocuments.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/OutputDocuments.php @@ -90,7 +90,7 @@ class OutputDocuments extends Api } catch (\Exception $e) { //Response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); - } + } } /** diff --git a/workflow/engine/src/Services/Api/ProcessMaker/User.php b/workflow/engine/src/Services/Api/ProcessMaker/User.php index c82c6f376..6b1bfb914 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/User.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/User.php @@ -112,6 +112,5 @@ class User extends Api throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } - }