Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Freddy Daniel Rojas Valda
2014-02-17 16:10:37 -04:00
5 changed files with 68 additions and 36 deletions

View File

@@ -109,6 +109,19 @@ class DataBaseConnection
}
}
if (isset($dataDBConnection['DBS_SERVER']) && $dataDBConnection['DBS_SERVER'] == '') {
throw (new \Exception("This 'dbs_server' is invalid"));
}
if (isset($dataDBConnection['DBS_DATABASE_NAME']) && $dataDBConnection['DBS_DATABASE_NAME'] == '') {
throw (new \Exception("This 'dbs_database_name' is invalid"));
}
if (isset($dataDBConnection['DBS_PORT']) &&
($dataDBConnection['DBS_PORT'] == ''|| $dataDBConnection['DBS_PORT'] == 0)) {
throw (new \Exception("This 'dbs_port' is invalid"));
}
if (isset($dataDBConnection['DBS_ENCODE'])) {
$encodesExists = array();
$dbs = new dbConnections();
@@ -306,7 +319,8 @@ class DataBaseConnection
*
* @return array
*/
public function getDbEngines () {
public function getDbEngines ()
{
if (!class_exists('dbConnections')) {
G::LoadClass('dbConnections');
}
@@ -324,7 +338,8 @@ class DataBaseConnection
*
* @return string
*/
public function validateProUid ($pro_uid) {
public function validateProUid ($pro_uid)
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The project with prj_uid: '', does not exist."));
@@ -346,7 +361,8 @@ class DataBaseConnection
*
* @return string
*/
public function validateDbsUid ($dbs_uid, $pro_uid) {
public function validateDbsUid ($dbs_uid, $pro_uid)
{
$dbs_uid = trim($dbs_uid);
if ($dbs_uid == '') {
throw (new \Exception("The database connection with dbs_uid: '', does not exist."));

View File

@@ -174,7 +174,8 @@ class Event
*
* @return string
*/
public function validateProUid ($pro_uid) {
public function validateProUid ($pro_uid)
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The project with prj_uid: '', does not exist."));
@@ -195,7 +196,8 @@ class Event
*
* @return string
*/
public function validateEvnUid ($evn_uid) {
public function validateEvnUid ($evn_uid)
{
$evn_uid = trim($evn_uid);
if ($evn_uid == '') {
throw (new \Exception("The event with evn_uid: '', does not exist."));
@@ -216,7 +218,8 @@ class Event
*
* @return string
*/
public function validateTasUid($tas_uid) {
public function validateTasUid($tas_uid)
{
$tas_uid = trim($tas_uid);
if ($tas_uid == '') {
throw (new \Exception("The task with tas_uid: '', does not exist."));
@@ -237,7 +240,8 @@ class Event
*
* @return string
*/
public function validateTriUid($tri_uid) {
public function validateTriUid($tri_uid)
{
$tri_uid = trim($tri_uid);
if ($tri_uid == '') {
throw (new \Exception("The trigger with tri_uid: '', does not exist."));

View File

@@ -304,7 +304,8 @@ class ProcessPermissions
*
* @return string
*/
public function validateProUid ($pro_uid) {
public function validateProUid ($pro_uid)
{
$pro_uid = trim($pro_uid);
if ($pro_uid == '') {
throw (new \Exception("The project with prj_uid: '', does not exist."));
@@ -325,7 +326,8 @@ class ProcessPermissions
*
* @return string
*/
public function validateOpUid ($op_uid) {
public function validateOpUid ($op_uid)
{
$op_uid = trim($op_uid);
if ($op_uid == '') {
throw (new \Exception("The process permission with op_uid: '', does not exist."));
@@ -346,7 +348,8 @@ class ProcessPermissions
*
* @return string
*/
public function validateUsrUid($usr_uid) {
public function validateUsrUid($usr_uid)
{
$usr_uid = trim($usr_uid);
if ($usr_uid == '') {
throw (new \Exception("The user with usr_uid: '', does not exist."));
@@ -367,7 +370,8 @@ class ProcessPermissions
*
* @return string
*/
public function validateGrpUid($grp_uid) {
public function validateGrpUid($grp_uid)
{
$grp_uid = trim($grp_uid);
if ($grp_uid == '') {
throw (new \Exception("The group with usr_uid: '', does not exist."));
@@ -388,7 +392,8 @@ class ProcessPermissions
*
* @return string
*/
public function validateTasUid($tas_uid) {
public function validateTasUid($tas_uid)
{
$tas_uid = trim($tas_uid);
if ($tas_uid == '') {
throw (new \Exception("The task with tas_uid: '', does not exist."));
@@ -409,7 +414,8 @@ class ProcessPermissions
*
* @return string
*/
public function validateDynUid($dyn_uid) {
public function validateDynUid($dyn_uid)
{
$dyn_uid = trim($dyn_uid);
if ($dyn_uid == '') {
throw (new \Exception("The dynaform with dynaforms: '', does not exist."));
@@ -430,7 +436,8 @@ class ProcessPermissions
*
* @return string
*/
public function validateInpUid($inp_uid) {
public function validateInpUid($inp_uid)
{
$inp_uid = trim($inp_uid);
if ($inp_uid == '') {
throw (new \Exception("The input with inputs: '', does not exist."));
@@ -451,7 +458,8 @@ class ProcessPermissions
*
* @return string
*/
public function validateOutUid($out_uid) {
public function validateOutUid($out_uid)
{
$out_uid = trim($out_uid);
if ($out_uid == '') {
throw (new \Exception("The output with outputs: '', does not exist."));

View File

@@ -259,13 +259,12 @@ class Table
$columnsStd = array();
foreach ($columns as $i => $column) {
if (isset($columns[$i]['fld_dyn'])) {
$columns[$i]['fld_dyn'] = ($reportFlag) ? $columns[$i]['fld_dyn'] : '';
$columns[$i]['field_dyn'] = $columns[$i]['fld_dyn'];
unset($columns[$i]['fld_dyn']);
} else {
$columns[$i]['fld_dyn'] = '';
}
$columns[$i]['fld_dyn'] = ($reportFlag) ? $columns[$i]['fld_dyn'] : '';
if (isset($columns[$i]['fld_name'])) {
$columns[$i]['field_name'] = $columns[$i]['fld_name'];
}
@@ -575,7 +574,7 @@ class Table
$classPeerName = $className . 'Peer';
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
if (! file_exists( $sPath . $className . '.php' )) {
throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className ) );
throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) );
}
require_once $sPath . $className . '.php';
@@ -667,7 +666,7 @@ class Table
$classPeerName = $className . 'Peer';
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
if (! file_exists( $sPath . $className . '.php' )) {
throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className ) );
throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) );
}
require_once $sPath . $className . '.php';
@@ -717,8 +716,8 @@ class Table
$aFields['PRO_UID'] = $pro_uid;
if (isset( $rep_tab_type ) && $rep_tab_type == 'GRID') {
$this->dynUid = $rep_tab_grid;
$dynFields = $this->_getDynafields($pro_uid, 'grid', $rep_tab_grid);
list ($gridName, $gridId) = explode( '-', $rep_tab_grid );
$dynFields = $this->_getDynafields($pro_uid, 'grid', $gridId);
} else {
$dynFields = $this->_getDynafields($pro_uid, 'xmlform');
}
@@ -753,7 +752,7 @@ class Table
$oCriteria->add( \DynaformPeer::DYN_TYPE, $type );
if ($rep_tab_grid != '') {
$oCriteria->add( \DynaformPeer::DYN_UID, $this->dynUid );
$oCriteria->add( \DynaformPeer::DYN_UID, $rep_tab_grid );
}
$oDataset = \DynaformPeer::doSelectRS( $oCriteria );
@@ -1022,6 +1021,7 @@ class Table
G::loadSystem('dynaformhandler');
$grids = array();
$namesGrid = array();
$aFieldsNames = array();
$oCriteria = new \Criteria( 'workflow' );
@@ -1041,14 +1041,18 @@ class Table
$fieldType = $arrayNode['type'];
if ($fieldType == 'grid') {
if (! in_array( $fieldName, $aFieldsNames )) {
$namesGrid[] = $fieldName;
$grids[] = str_replace( $pro_uid . '/', '', $arrayNode['xmlgrid']);
}
}
}
}
if (!in_array($rep_tab_grid, $grids)) {
$find = array_search($rep_tab_grid, $grids);
if ($find === false) {
throw (new \Exception("The property rep_tab_grid: '$rep_tab_grid', is incorrect."));
} else {
$rep_tab_grid = $namesGrid[$find] . '-' . $rep_tab_grid;
}
return $rep_tab_grid;
}

View File

@@ -58,12 +58,12 @@ class DataBaseConnection extends Api
* @param string $prj_uid {@min 1} {@max 32}
* @param array $request_data
*
* @param string $dbs_type {@from body} {@min 1}
* @param string $dbs_server {@from body} {@min 1}
* @param string $dbs_database_name {@from body} {@min 1}
* @param string $dbs_type {@from body} {@required true}
* @param string $dbs_server {@from body} {@required true}
* @param string $dbs_database_name {@from body} {@required true}
* @param string $dbs_username {@from body}
* @param string $dbs_port {@from body} {@type float}
* @param string $dbs_encode {@from body} {@min 1}
* @param string $dbs_encode {@from body} {@required true}
* @param string $dbs_password {@from body}
* @param string $dbs_description {@from body}
* @return array
@@ -99,12 +99,12 @@ class DataBaseConnection extends Api
* @param string $prj_uid {@min 1} {@max 32}
* @param array $request_data
*
* @param string $dbs_type {@from body} {@min 1}
* @param string $dbs_server {@from body} {@min 1}
* @param string $dbs_database_name {@from body} {@min 1}
* @param string $dbs_type {@from body} {@required true}
* @param string $dbs_server {@from body} {@required true}
* @param string $dbs_database_name {@from body} {@required true}
* @param string $dbs_username {@from body}
* @param string $dbs_port {@from body} {@type float}
* @param string $dbs_encode {@from body} {@min 1}
* @param string $dbs_encode {@from body} {@required true}
* @param string $dbs_password {@from body}
* @param string $dbs_description {@from body}
* @return array
@@ -141,12 +141,12 @@ class DataBaseConnection extends Api
* @param string $dbs_uid {@min 1} {@max 32}
* @param array $request_data
*
* @param string $dbs_type {@from body}
* @param string $dbs_server {@from body}
* @param string $dbs_database_name {@from body}
* @param string $dbs_type {@from body} {@required true}
* @param string $dbs_server {@from body} {@required true}
* @param string $dbs_database_name {@from body} {@required true}
* @param string $dbs_username {@from body}
* @param string $dbs_port {@from body}
* @param string $dbs_encode {@from body}
* @param string $dbs_port {@from body} {@type float}
* @param string $dbs_encode {@from body} {@required true}
* @param string $dbs_password {@from body}
* @param string $dbs_description {@from body}
* @return void