Se corrige code style para CASESCHEDULER, FILESMANAGER, TASK, USER.

This commit is contained in:
Freddy Daniel Rojas Valda
2014-02-26 16:22:23 -04:00
parent 106e4d770b
commit 4c49fd96eb
8 changed files with 36 additions and 34 deletions

View File

@@ -346,7 +346,7 @@ class CaseScheduler
$nSW = 0; $nSW = 0;
$aData['SCH_DAYS_PERFORM_TASK'] = ''; $aData['SCH_DAYS_PERFORM_TASK'] = '';
switch ($sOption) { switch ($sOption) {
case '1': case '1': // If the option is zero, set by default 1
$aData['SCH_DAYS_PERFORM_TASK'] = '1'; $aData['SCH_DAYS_PERFORM_TASK'] = '1';
$sValue = $aData['SCH_DAYS_PERFORM_TASK']; $sValue = $aData['SCH_DAYS_PERFORM_TASK'];
switch ($sValue) { switch ($sValue) {
@@ -637,7 +637,7 @@ class CaseScheduler
$nSW = 0; $nSW = 0;
$aData['SCH_DAYS_PERFORM_TASK'] = ''; $aData['SCH_DAYS_PERFORM_TASK'] = '';
switch ($sOption) { switch ($sOption) {
case '1': case '1': // If the option is zero, set by default 1
$aData['SCH_DAYS_PERFORM_TASK'] = '1'; $aData['SCH_DAYS_PERFORM_TASK'] = '1';
$sValue = $aData['SCH_DAYS_PERFORM_TASK']; $sValue = $aData['SCH_DAYS_PERFORM_TASK'];
switch ($sValue) { switch ($sValue) {

View File

@@ -44,6 +44,10 @@ class FilesManager
public function getProcessFilesManagerPath($sProcessUID, $path) public function getProcessFilesManagerPath($sProcessUID, $path)
{ {
try { try {
$checkPath = substr($path, -1);
if ($checkPath == '/') {
$path = substr($path, 0, -1);
}
$sMainDirectory = current(explode("/", $path)); $sMainDirectory = current(explode("/", $path));
if (strstr($path,'/')) { if (strstr($path,'/')) {
$sSubDirectory = substr($path, strpos($path, "/")+1). PATH_SEP ; $sSubDirectory = substr($path, strpos($path, "/")+1). PATH_SEP ;
@@ -84,10 +88,10 @@ class FilesManager
$arrayFileUid = $this->getFileManagerUid($sDirectory.$aFile['FILE']); $arrayFileUid = $this->getFileManagerUid($sDirectory.$aFile['FILE']);
$fcontent = file_get_contents($sDirectory.$aFile['FILE']); $fcontent = file_get_contents($sDirectory.$aFile['FILE']);
$fileUid = $arrayFileUid["PRF_UID"]; $fileUid = $arrayFileUid["PRF_UID"];
if ($fileUid) { if ($fileUid != null) {
$oProcessFiles = \ProcessFilesPeer::retrieveByPK($fileUid); $oProcessFiles = \ProcessFilesPeer::retrieveByPK($fileUid);
$editable = $oProcessFiles->getPrfEditable(); $editable = $oProcessFiles->getPrfEditable();
if ($editable == 1){ if ($editable == '1') {
$editable = 'true'; $editable = 'true';
} else { } else {
$editable = 'false'; $editable = 'false';
@@ -102,11 +106,10 @@ class FilesManager
'prf_create_date' => $oProcessFiles->getPrfCreateDate(), 'prf_create_date' => $oProcessFiles->getPrfCreateDate(),
'prf_update_date' => $oProcessFiles->getPrfUpdateDate(), 'prf_update_date' => $oProcessFiles->getPrfUpdateDate(),
'prf_content' => $fcontent); 'prf_content' => $fcontent);
} else { } else {
$extention = end(explode(".", $aFile['FILE'])); $extention = end(explode(".", $aFile['FILE']));
if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' || if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp'
$extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') { || $extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') {
$editable = 'true'; $editable = 'true';
} else { } else {
$editable = 'false'; $editable = 'false';
@@ -122,7 +125,6 @@ class FilesManager
'prf_update_date' => '', 'prf_update_date' => '',
'prf_content' => $fcontent); 'prf_content' => $fcontent);
} }
} }
return $aTheFiles; return $aTheFiles;
} catch (Exception $e) { } catch (Exception $e) {
@@ -145,7 +147,7 @@ class FilesManager
{ {
try { try {
$aData['prf_path'] = rtrim($aData['prf_path'], '/') . '/'; $aData['prf_path'] = rtrim($aData['prf_path'], '/') . '/';
if (!$aData['prf_filename']){ if (!$aData['prf_filename']) {
throw (new \Exception( 'invalid value specified for `prf_filename`.')); throw (new \Exception( 'invalid value specified for `prf_filename`.'));
} }
$sMainDirectory = current(explode("/", $aData['prf_path'])); $sMainDirectory = current(explode("/", $aData['prf_path']));
@@ -199,6 +201,7 @@ class FilesManager
fwrite($fp, $content); fwrite($fp, $content);
fclose($fp); fclose($fp);
$oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(), $oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(),
'prf_filename' => $aData['prf_filename'],
'usr_uid' => $oProcessFiles->getUsrUid(), 'usr_uid' => $oProcessFiles->getUsrUid(),
'prf_update_usr_uid' => $oProcessFiles->getPrfUpdateUsrUid(), 'prf_update_usr_uid' => $oProcessFiles->getPrfUpdateUsrUid(),
'prf_path' => $sMainDirectory. PATH_SEP . $sSubDirectory, 'prf_path' => $sMainDirectory. PATH_SEP . $sSubDirectory,
@@ -236,7 +239,7 @@ class FilesManager
$path = $aRow['PRF_PATH']; $path = $aRow['PRF_PATH'];
$rsCriteria->next(); $rsCriteria->next();
} }
if ($path == ''){ if ($path == '') {
throw new \Exception(\G::LoadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM')); throw new \Exception(\G::LoadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM'));
} }
$file = end(explode("/",$path)); $file = end(explode("/",$path));
@@ -246,7 +249,7 @@ class FilesManager
if ($_FILES['prf_file']['tmp_name'] != '') { if ($_FILES['prf_file']['tmp_name'] != '') {
\G::uploadFile($_FILES['prf_file']['tmp_name'], $path, $_FILES['prf_file']['name']); \G::uploadFile($_FILES['prf_file']['tmp_name'], $path, $_FILES['prf_file']['name']);
} }
} }
} else { } else {
throw new \Exception(\G::LoadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM')); throw new \Exception(\G::LoadTranslation('ID_PMTABLE_UPLOADING_FILE_PROBLEM'));
} }
@@ -306,14 +309,14 @@ class FilesManager
$path = $aRow['PRF_PATH']; $path = $aRow['PRF_PATH'];
$rsCriteria->next(); $rsCriteria->next();
} }
if ($path == ''){ if ($path == '') {
throw new \Exception('invalid value specified for `prf_uid`.'); throw new \Exception('invalid value specified for `prf_uid`.');
} }
$sFile = end(explode("/",$path)); $sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path); $sPath = str_replace($sFile,'',$path);
$sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID))))); $sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))));
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath); $sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
if ($sMainDirectory == PATH_DATA_MAILTEMPLATES){ if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) {
$sMainDirectory = 'mailTemplates'; $sMainDirectory = 'mailTemplates';
} else { } else {
$sMainDirectory = 'public'; $sMainDirectory = 'public';
@@ -375,14 +378,14 @@ class FilesManager
$path = $aRow['PRF_PATH']; $path = $aRow['PRF_PATH'];
$rsCriteria->next(); $rsCriteria->next();
} }
if ($path == ''){ if ($path == '') {
throw new \Exception('invalid value specified for `prf_uid`.'); throw new \Exception('invalid value specified for `prf_uid`.');
} }
$sFile = end(explode("/",$path)); $sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path); $sPath = str_replace($sFile,'',$path);
$sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID))))); $sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))));
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath); $sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
if ($sMainDirectory == PATH_DATA_MAILTEMPLATES){ if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) {
$sMainDirectory = 'mailTemplates'; $sMainDirectory = 'mailTemplates';
} else { } else {
$sMainDirectory = 'public'; $sMainDirectory = 'public';
@@ -419,14 +422,14 @@ class FilesManager
$path = $aRow['PRF_PATH']; $path = $aRow['PRF_PATH'];
$rsCriteria->next(); $rsCriteria->next();
} }
if ($path == ''){ if ($path == '') {
throw new \Exception('invalid value specified for `prf_uid`.'); throw new \Exception('invalid value specified for `prf_uid`.');
} }
$sFile = end(explode("/",$path)); $sFile = end(explode("/",$path));
$sPath = str_replace($sFile,'',$path); $sPath = str_replace($sFile,'',$path);
$sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID))))); $sSubDirectory = str_replace('/','',str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))));
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath); $sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
if ($sMainDirectory == PATH_DATA_MAILTEMPLATES){ if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) {
$sMainDirectory = 'mailTemplates'; $sMainDirectory = 'mailTemplates';
} else { } else {
$sMainDirectory = 'public'; $sMainDirectory = 'public';

View File

@@ -1027,7 +1027,6 @@ class Task
'aas_type' => "user" ); 'aas_type' => "user" );
} }
$oDataset->next(); $oDataset->next();
} }
if ($start) { if ($start) {
if ($start < 0) { if ($start < 0) {
@@ -1933,8 +1932,9 @@ class Task
* *
* @return array * @return array
*/ */
public function arrayPagination($display_array, $page, $show_per_page) { public function arrayPagination($display_array, $page, $show_per_page)
$page = $page+1; {
$page = $page + 1;
$show_per_page = $show_per_page -1; $show_per_page = $show_per_page -1;
$start = ($page - 1) * ($show_per_page + 1); $start = ($page - 1) * ($show_per_page + 1);
$offset = $show_per_page + 1; $offset = $show_per_page + 1;

View File

@@ -220,26 +220,26 @@ class User
if ($form['USR_COUNTRY'] != '') { if ($form['USR_COUNTRY'] != '') {
$oCountry = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']); $oCountry = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']);
if (is_null($oCountry)) { 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'] != '') { if ($form['USR_CITY'] != '') {
$oCity = \IsoSubdivisionPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_CITY']); $oCity = \IsoSubdivisionPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_CITY']);
if (is_null($oCity)) { 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'] != '') { if ($form['USR_LOCATION'] != '') {
$oLocation = \IsoLocationPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_LOCATION']); $oLocation = \IsoLocationPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_LOCATION']);
if (is_null($oLocation)) { 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'] != '') { if ($form['USR_COUNTRY'] != '') {
$oReplacedBy = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']); $oReplacedBy = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']);
if (is_null($oReplacedBy)) { 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'])) { if (isset($arrayData['USR_UID'])) {
$form['USR_UID'] = $arrayData['USR_UID']; $form['USR_UID'] = $arrayData['USR_UID'];

View File

@@ -239,6 +239,6 @@ class Assignee extends Api
//Response //Response
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
} }
} }
} }

View File

@@ -112,6 +112,5 @@ class User extends Api
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
} }
} }
} }