HOR-4527
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
parent
abe71a6ffe
commit
0d533e19d9
@@ -19,7 +19,7 @@ require_once 'classes/model/om/BaseAdditionalTables.php';
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
|
||||
function validateType ($value, $type)
|
||||
function validateType($value, $type)
|
||||
{
|
||||
switch ($type) {
|
||||
case 'INTEGER':
|
||||
@@ -35,16 +35,16 @@ function validateType ($value, $type)
|
||||
$posPoint = ($posPoint === false) ? 0 : $posPoint;
|
||||
|
||||
if ($pos > $posPoint) {
|
||||
$value2 = substr($value, $pos+1);
|
||||
$value2 = substr($value, $pos + 1);
|
||||
$value1 = substr($value, 0, $pos);
|
||||
$value1 = str_replace(".", "", $value1);
|
||||
$value = $value1.".".$value2;
|
||||
$value = $value1 . "." . $value2;
|
||||
} else {
|
||||
if($posPoint) {
|
||||
$value2 = substr($value, $posPoint+1);
|
||||
if ($posPoint) {
|
||||
$value2 = substr($value, $posPoint + 1);
|
||||
$value1 = substr($value, 0, $posPoint);
|
||||
$value1 = str_replace(",", "", $value1);
|
||||
$value = $value1.".".$value2;
|
||||
$value = $value1 . "." . $value2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -146,12 +146,6 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_CLASS_NAME);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
//DEPRECATED! $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_LOG_INSERT);
|
||||
// $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_LOG_UPDATE);
|
||||
// $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_LOG_DELETE);
|
||||
// $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_LOG_SELECT);
|
||||
// $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_MAX_LENGTH);
|
||||
// $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_AUTO_DELETE);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_PLG_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
||||
$oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
||||
@@ -203,7 +197,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
'SHD_DATE' => date('Y-m-d H:i:s')));
|
||||
*/
|
||||
|
||||
$addTabDescription = ($aData["ADD_TAB_DESCRIPTION"] != "")? ", Description: " . $aData["ADD_TAB_DESCRIPTION"] : ".";
|
||||
$addTabDescription = ($aData["ADD_TAB_DESCRIPTION"] != "") ? ", Description: " . $aData["ADD_TAB_DESCRIPTION"] : ".";
|
||||
G::auditLog("CreatePmtable", "PM Table Name: " . $aData['ADD_TAB_NAME'] . $addTabDescription);
|
||||
return $aData['ADD_TAB_UID'];
|
||||
} else {
|
||||
@@ -232,7 +226,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$iResult = $oAdditionalTables->save();
|
||||
$oConnection->commit();
|
||||
$addTabDescription = (isset($aData["ADD_TAB_DESCRIPTION"]) && $aData["ADD_TAB_DESCRIPTION"] != "") ? ", Description: " . $aData["ADD_TAB_DESCRIPTION"] : ".";
|
||||
G::auditLog("UpdatePmtable", "PM Table Name: " . ( isset($aData['ADD_TAB_NAME']) ? $aData['ADD_TAB_NAME'] : $aData['ADD_TAB_TAG']) . $addTabDescription . ", PM Table ID: (" . $aData['ADD_TAB_UID'] . ") ");
|
||||
G::auditLog("UpdatePmtable", "PM Table Name: " . (isset($aData['ADD_TAB_NAME']) ? $aData['ADD_TAB_NAME'] : $aData['ADD_TAB_TAG']) . $addTabDescription . ", PM Table ID: (" . $aData['ADD_TAB_UID'] . ") ");
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oAdditionalTables->getValidationFailures();
|
||||
@@ -274,9 +268,9 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
/**
|
||||
* verify if Additional Table row specified in [sUID] exists.
|
||||
*
|
||||
* @param string $sUID the uid of the additional table
|
||||
* @param string $sUID the uid of the additional table
|
||||
*/
|
||||
public function exists ($sUID)
|
||||
public function exists($sUID)
|
||||
{
|
||||
$con = Propel::getConnection(AdditionalTablesPeer::DATABASE_NAME);
|
||||
|
||||
@@ -334,8 +328,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$aData = $this->load($sUID, true);
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sClassName = ($aData['ADD_TAB_CLASS_NAME'] != ''
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
|
||||
if (file_exists($sPath . $sClassName . '.php')) {
|
||||
require_once $sPath . $sClassName . '.php';
|
||||
@@ -347,7 +341,6 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$con = Propel::getConnection($aData['DBS_UID']);
|
||||
$oCriteria = new Criteria($aData['DBS_UID']);
|
||||
|
||||
//eval('$oCriteria->addSelectColumn(' . $sClassPeerName . '::PM_UNIQUE_ID);');
|
||||
eval('$oCriteria->addSelectColumn("\'1\' AS DUMMY");');
|
||||
foreach ($aData['FIELDS'] as $aField) {
|
||||
eval('$oCriteria->addSelectColumn(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ');');
|
||||
@@ -357,18 +350,13 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
case 'VARCHAR':
|
||||
case 'TEXT':
|
||||
case 'DATE':
|
||||
// if($aField['FLD_NULL']!=1)
|
||||
// eval('$oCriteria->add(' . $sClassPeerName . '::' . $aField['FLD_NAME']
|
||||
//. ', \'(<28>_<EFBFBD>_<EFBFBD>)\', Criteria::NOT_EQUAL);');
|
||||
break;
|
||||
case 'INT';
|
||||
case 'INT':
|
||||
case 'FLOAT':
|
||||
eval('$oCriteria->add(' . $sClassPeerName . '::' . $aField['FLD_NAME']
|
||||
.', -99999999999, Criteria::NOT_EQUAL);');
|
||||
. ', -99999999999, Criteria::NOT_EQUAL);');
|
||||
break;
|
||||
}
|
||||
//eval('$oCriteria->addAscendingOrderByColumn(' . $sClassPeerName . '::PM_UNIQUE_ID);');
|
||||
//echo $oCriteria->toString();
|
||||
return $oCriteria;
|
||||
} catch (Exception $oError) {
|
||||
throw($oError);
|
||||
@@ -385,8 +373,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$aData['DBS_UID'] = $aData['DBS_UID'] ? $aData['DBS_UID'] : 'workflow';
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sClassName = ($aData['ADD_TAB_CLASS_NAME'] != ''
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
|
||||
if (file_exists($sPath . $sClassName . '.php')) {
|
||||
require_once $sPath . $sClassName . '.php';
|
||||
@@ -398,7 +386,6 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$con = Propel::getConnection($aData['DBS_UID']);
|
||||
$oCriteria = new Criteria($aData['DBS_UID']);
|
||||
|
||||
//eval('$oCriteria->addSelectColumn("\'1\' AS DUMMY");');
|
||||
|
||||
/*
|
||||
* data type:
|
||||
@@ -414,13 +401,9 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$field = '$oCriteria->addAsColumn("' . $aField['FLD_NAME'] . '", "round(" . ' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ' . ", ' . ($aField['FLD_TYPE'] == 'DOUBLE' ? '8' : '2') . ')");';
|
||||
}
|
||||
eval($field);
|
||||
/*if ($aField['FLD_KEY'] == '1') {
|
||||
eval('$oCriteria->addAscendingOrderByColumn('. $sClassPeerName . '::' . $aField['FLD_NAME'] . ');');
|
||||
}*/
|
||||
}
|
||||
}
|
||||
$oCriteriaCount = clone $oCriteria;
|
||||
//$count = $sClassPeerName::doCount($oCriteria);
|
||||
eval('$count = ' . $sClassPeerName . '::doCount($oCriteria);');
|
||||
|
||||
if ($filter != '' && is_string($filter)) {
|
||||
@@ -428,17 +411,17 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$closure = '';
|
||||
$types = array('INTEGER', 'BIGINT', 'SMALLINT', 'TINYINT', 'DECIMAL', 'DOUBLE', 'FLOAT', 'REAL');
|
||||
foreach ($aData['FIELDS'] as $aField) {
|
||||
if (($appUid == false && $aField['FLD_NAME'] != 'APP_UID') || ($appUid == true)) {
|
||||
if (in_array($aField['FLD_TYPE'], $types)) {
|
||||
if (is_numeric($filter)) {
|
||||
$stringOr = $stringOr . '$a = $oCriteria->getNewCriterion(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ', "' . $filter . '", Criteria::EQUAL)' . $closure . ';';
|
||||
$closure = '->addOr($a)';
|
||||
}
|
||||
} else {
|
||||
$stringOr = $stringOr . '$a = $oCriteria->getNewCriterion(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ', "%' . $filter . '%", Criteria::LIKE)' . $closure . ';';
|
||||
$closure = '->addOr($a)';
|
||||
}
|
||||
}
|
||||
if (($appUid == false && $aField['FLD_NAME'] != 'APP_UID') || ($appUid == true)) {
|
||||
if (in_array($aField['FLD_TYPE'], $types)) {
|
||||
if (is_numeric($filter)) {
|
||||
$stringOr = $stringOr . '$a = $oCriteria->getNewCriterion(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ', "' . $filter . '", Criteria::EQUAL)' . $closure . ';';
|
||||
$closure = '->addOr($a)';
|
||||
}
|
||||
} else {
|
||||
$stringOr = $stringOr . '$a = $oCriteria->getNewCriterion(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ', "%' . $filter . '%", Criteria::LIKE)' . $closure . ';';
|
||||
$closure = '->addOr($a)';
|
||||
}
|
||||
}
|
||||
}
|
||||
$stringOr = $stringOr . '$oCriteria->add($a);';
|
||||
eval($stringOr);
|
||||
@@ -488,7 +471,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
eval('$count = ' . $sClassPeerName . '::doCount($oCriteria);');
|
||||
}
|
||||
|
||||
$filter = new InputFilter();
|
||||
$filter = new InputFilter();
|
||||
$sClassPeerName = $filter->validateInput($sClassPeerName);
|
||||
|
||||
if (isset($_POST['sort'])) {
|
||||
@@ -515,11 +498,10 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
if (isset($start)) {
|
||||
$oCriteria->setOffset($start);
|
||||
}
|
||||
//$rs = $sClassPeerName::doSelectRS($oCriteria);
|
||||
eval('$rs = ' . $sClassPeerName . '::doSelectRS($oCriteria);');
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rows = Array();
|
||||
$rows = array();
|
||||
while ($rs->next()) {
|
||||
$rows[] = $rs->getRow();
|
||||
}
|
||||
@@ -533,8 +515,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$aData = $this->load($sUID, true);
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sClassName = ($aData['ADD_TAB_CLASS_NAME'] != ''
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
|
||||
if (file_exists($sPath . $sClassName . '.php')) {
|
||||
return $sClassName;
|
||||
@@ -552,9 +534,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$aData = $this->load($sUID, true);
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sClassName = ($aData['ADD_TAB_CLASS_NAME'] != ''
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
// $oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
$oConnection = Propel::getConnection($aData['DBS_UID']);
|
||||
$stmt = $oConnection->createStatement();
|
||||
require_once $sPath . $sClassName . '.php';
|
||||
@@ -606,8 +587,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$aData = $this->load($sUID, true);
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sClassName = ($aData['ADD_TAB_CLASS_NAME'] != ''
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
require_once $sPath . $sClassName . '.php';
|
||||
$sKeys = '';
|
||||
foreach ($aKeys as $sName => $vValue) {
|
||||
@@ -616,7 +597,6 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
$sKeys = substr($sKeys, 0, -1);
|
||||
eval('$oClass = ' . $sClassName . 'Peer::retrieveByPK(' . $sKeys . ');');
|
||||
//eval('$oClass = ' . $sClassName . 'Peer::retrieveByPK($sPMUID);');
|
||||
if (!is_null($oClass)) {
|
||||
return $oClass->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
} else {
|
||||
@@ -630,12 +610,11 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
public function updateDataInTable($sUID, $aFields)
|
||||
{
|
||||
try {
|
||||
//$sPMUID = $aFields['PM_UNIQUE_ID'];
|
||||
$aData = $this->load($sUID, true);
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sClassName = ($aData['ADD_TAB_CLASS_NAME'] != ''
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
|
||||
require_once $sPath . $sClassName . '.php';
|
||||
$sKeys = '';
|
||||
@@ -648,7 +627,6 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
$sKeys = substr($sKeys, 0, -1);
|
||||
eval('$oClass = ' . $sClassName . 'Peer::retrieveByPK(' . $sKeys . ');');
|
||||
//eval('$oClass = ' . $sClassName . 'Peer::retrieveByPK($sPMUID);');
|
||||
if (!is_null($oClass)) {
|
||||
$oClass->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||
if ($oClass->validate()) {
|
||||
@@ -681,8 +659,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$aData = $this->load($sUID, true);
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sClassName = ($aData['ADD_TAB_CLASS_NAME'] != ''
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
? $aData['ADD_TAB_CLASS_NAME']
|
||||
: $this->getPHPName($aData['ADD_TAB_NAME']));
|
||||
$oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
|
||||
require_once $sPath . $sClassName . '.php';
|
||||
$sKeys = '';
|
||||
@@ -692,7 +670,6 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
$sKeys = substr($sKeys, 0, -1);
|
||||
eval('$oClass = ' . $sClassName . 'Peer::retrieveByPK(' . $sKeys . ');');
|
||||
//eval('$oClass = ' . $sClassName . 'Peer::retrieveByPK($sPMUID);');
|
||||
if (!is_null($oClass)) {
|
||||
if ($oClass->validate()) {
|
||||
$oConnection->begin();
|
||||
@@ -728,8 +705,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$this->classPeerName = $this->className . 'Peer';
|
||||
|
||||
if (!file_exists(PATH_WORKSPACE . 'classes/' . $this->className . '.php')) {
|
||||
throw new Exception( "ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php'
|
||||
. " class file doesn't exit!");
|
||||
throw new Exception("ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php'
|
||||
. " class file doesn't exit!");
|
||||
}
|
||||
|
||||
require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php';
|
||||
@@ -765,7 +742,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
case 'FLOAT':
|
||||
case 'DOUBLE':
|
||||
case 'INTEGER':
|
||||
$fieldTypes[] = array($rowfield['FLD_NAME']=>$rowfield['FLD_TYPE']);
|
||||
$fieldTypes[] = array($rowfield['FLD_NAME'] => $rowfield['FLD_TYPE']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -780,11 +757,11 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$j = key($dValue);
|
||||
$dValue = (is_array($dValue[$j])) ? $dValue : $dValue[$j];
|
||||
}
|
||||
if (!is_array($dValue)) {
|
||||
if (is_string($dValue)) {
|
||||
foreach ($fieldTypes as $key => $fieldType) {
|
||||
foreach ($fieldType as $name => $theType) {
|
||||
if (strtoupper($dKey) == $name) {
|
||||
$caseData[$dKey] = validateType ($dValue, $theType);
|
||||
$caseData[$dKey] = validateType($dValue, $theType);
|
||||
unset($name);
|
||||
}
|
||||
}
|
||||
@@ -795,11 +772,13 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
} else {
|
||||
// grids
|
||||
foreach ($caseData[$dKey] as $dIndex => $dRow) {
|
||||
if (is_array($dRow)) {
|
||||
foreach ($dRow as $k => $v) {
|
||||
if (trim($v) === '') {
|
||||
$caseData[$dKey][$dIndex][$k] = null;
|
||||
if (is_array($caseData[$dKey])) {
|
||||
foreach ($caseData[$dKey] as $dIndex => $dRow) {
|
||||
if (is_array($dRow)) {
|
||||
foreach ($dRow as $k => $v) {
|
||||
if (is_string($v) && trim($v) === '') {
|
||||
$caseData[$dKey][$dIndex][$k] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -807,7 +786,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == 'GRID') {
|
||||
if ($type === 'GRID') {
|
||||
list($gridName, $gridUid) = explode('-', $gridKey);
|
||||
$gridData = isset($caseData[$gridName]) ? $caseData[$gridName] : array();
|
||||
|
||||
@@ -883,7 +862,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
case 'FLOAT':
|
||||
case 'DOUBLE':
|
||||
case 'INTEGER':
|
||||
$fieldTypes[] = array($rowfield['FLD_NAME']=>$rowfield['FLD_TYPE']);
|
||||
$fieldTypes[] = array($rowfield['FLD_NAME'] => $rowfield['FLD_TYPE']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -904,8 +883,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
foreach ($fieldTypes as $key => $fieldType) {
|
||||
foreach ($fieldType as $name => $type) {
|
||||
if ( strtoupper ( $i) == $name) {
|
||||
$v = validateType ($v, $type);
|
||||
if (strtoupper($i) == $name) {
|
||||
$v = validateType($v, $type);
|
||||
unset($name);
|
||||
}
|
||||
}
|
||||
@@ -954,8 +933,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
foreach ($gridRow as $j => $v) {
|
||||
foreach ($fieldTypes as $key => $fieldType) {
|
||||
foreach ($fieldType as $name => $type) {
|
||||
if ( strtoupper ( $j) == $name) {
|
||||
$v = validateType ($v, $type);
|
||||
if (strtoupper($j) == $name) {
|
||||
$v = validateType($v, $type);
|
||||
unset($name);
|
||||
}
|
||||
}
|
||||
@@ -995,9 +974,9 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
if ($bWhitType) {
|
||||
if (!in_array($aRow['FLD_NAME'], $aImportedVars)) {
|
||||
$aImportedVars[] = $aRow['FLD_NAME'];
|
||||
$aVars[] = array('sFieldName' => $aRow['FLD_NAME'],
|
||||
'sFieldDynName' => $aRow['FLD_DYN_NAME'],
|
||||
'sType' => $aRow['FLD_TYPE']);
|
||||
$aVars[] = array('sFieldName' => $aRow['FLD_NAME'],
|
||||
'sFieldDynName' => $aRow['FLD_DYN_NAME'],
|
||||
'sType' => $aRow['FLD_TYPE']);
|
||||
}
|
||||
} else {
|
||||
$aVars[] = $aRow['FLD_NAME'];
|
||||
@@ -1034,7 +1013,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
return $reportTables;
|
||||
}
|
||||
|
||||
|
||||
public function getAll($start = 0, $limit = 20, $filter = '', $process = null)
|
||||
{
|
||||
$oCriteria = new Criteria('workflow');
|
||||
@@ -1058,8 +1037,9 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
|
||||
if ($filter != '' && is_string($filter)) {
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%' . $filter . '%', Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE))
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%' . $filter . '%', Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1082,8 +1062,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$oDataset = AdditionalTablesPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$addTables = Array();
|
||||
$proUids = Array();
|
||||
$addTables = array();
|
||||
$proUids = array();
|
||||
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
@@ -1095,12 +1075,11 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
|
||||
//process details will have the info about the processes
|
||||
$procDetails = Array();
|
||||
$procDetails = array();
|
||||
|
||||
if (count($proUids) > 0) {
|
||||
//now get the labels for all process, using an array of Uids,
|
||||
$c = new Criteria('workflow');
|
||||
//$c->add ( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
|
||||
$c->add(ProcessPeer::PRO_UID, $proUids, Criteria::IN);
|
||||
$dt = ProcessPeer::doSelectRS($c);
|
||||
$dt->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
@@ -1143,17 +1122,17 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
array_unshift($aFields, $aUID); */
|
||||
$aTypes = array(
|
||||
'VARCHAR' => 'string',
|
||||
'TEXT' => 'string',
|
||||
'DATE' => 'int',
|
||||
'INT' => 'int',
|
||||
'FLOAT' => 'double'
|
||||
'TEXT' => 'string',
|
||||
'DATE' => 'int',
|
||||
'INT' => 'int',
|
||||
'FLOAT' => 'double'
|
||||
);
|
||||
$aCreoleTypes = array(
|
||||
'VARCHAR' => 'VARCHAR',
|
||||
'TEXT' => 'LONGVARCHAR',
|
||||
'DATE' => 'TIMESTAMP',
|
||||
'INT' => 'INTEGER',
|
||||
'FLOAT' => 'DOUBLE'
|
||||
'TEXT' => 'LONGVARCHAR',
|
||||
'DATE' => 'TIMESTAMP',
|
||||
'INT' => 'INTEGER',
|
||||
'FLOAT' => 'DOUBLE'
|
||||
);
|
||||
if ($sClassName == '') {
|
||||
$sClassName = $this->getPHPName($sTableName);
|
||||
@@ -1177,8 +1156,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$aData['GUID'] = $sAddTabUid;
|
||||
|
||||
$aData['firstColumn'] = isset($aFields[0])
|
||||
? strtoupper($aFields[0]['FLD_NAME'])
|
||||
: ($aFields[1]['FLD_NAME']);
|
||||
? strtoupper($aFields[0]['FLD_NAME'])
|
||||
: ($aFields[1]['FLD_NAME']);
|
||||
$aData['totalColumns'] = count($aFields);
|
||||
$aData['useIdGenerator'] = 'false';
|
||||
$oTP1 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'Table.tpl');
|
||||
@@ -1205,14 +1184,14 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
'creoleType' => $aCreoleTypes[$aField['FLD_TYPE']],
|
||||
'notNull' => ($aField['FLD_NULL'] == 'on' ? 'true' : 'false'),
|
||||
'size' => (($aField['FLD_TYPE'] == 'VARCHAR')
|
||||
|| ($aField['FLD_TYPE'] == 'INT')
|
||||
|| ($aField['FLD_TYPE'] == 'FLOAT') ? $aField['FLD_SIZE'] : 'null'),
|
||||
|| ($aField['FLD_TYPE'] == 'INT')
|
||||
|| ($aField['FLD_TYPE'] == 'FLOAT') ? $aField['FLD_SIZE'] : 'null'),
|
||||
'var' => strtolower($aField['FLD_NAME']),
|
||||
'attribute' => (($aField['FLD_TYPE'] == 'VARCHAR')
|
||||
|| ($aField['FLD_TYPE'] == 'TEXT')
|
||||
|| ($aField['FLD_TYPE'] == 'DATE')
|
||||
? '$' . strtolower($aField['FLD_NAME']) . " = ''"
|
||||
: '$' . strtolower($aField['FLD_NAME']) . ' = 0'),
|
||||
|| ($aField['FLD_TYPE'] == 'TEXT')
|
||||
|| ($aField['FLD_TYPE'] == 'DATE')
|
||||
? '$' . strtolower($aField['FLD_NAME']) . " = ''"
|
||||
: '$' . strtolower($aField['FLD_NAME']) . ' = 0'),
|
||||
'index' => $i,
|
||||
);
|
||||
if ($aField['FLD_TYPE'] == 'DATE') {
|
||||
@@ -1327,7 +1306,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$i++;
|
||||
}
|
||||
$oTP3 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'map'
|
||||
. PATH_SEP . 'TableMapBuilder.tpl');
|
||||
. PATH_SEP . 'TableMapBuilder.tpl');
|
||||
$oTP3->prepare();
|
||||
$oTP3->assignGlobal($aData);
|
||||
foreach ($aPKs as $iIndex => $aColumn) {
|
||||
@@ -1346,7 +1325,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
}
|
||||
file_put_contents($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName
|
||||
. 'MapBuilder.php', $oTP3->getOutputContent());
|
||||
. 'MapBuilder.php', $oTP3->getOutputContent());
|
||||
$oTP4 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'om' . PATH_SEP . 'BaseTable.tpl');
|
||||
$oTP4->prepare();
|
||||
switch (count($aPKs)) {
|
||||
@@ -1363,9 +1342,9 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$aData['setPrimaryKeyFunction'] = '';
|
||||
foreach ($aPKs as $iIndex => $aColumn) {
|
||||
$aData['getPrimaryKeyFunction'] .= '$pks[' . $iIndex . '] = $this->get'
|
||||
. $aColumn['phpName'] . '();' . "\n";
|
||||
. $aColumn['phpName'] . '();' . "\n";
|
||||
$aData['setPrimaryKeyFunction'] .= '$this->set' . $aColumn['phpName']
|
||||
. '($keys[' . $iIndex . ']);' . "\n";
|
||||
. '($keys[' . $iIndex . ']);' . "\n";
|
||||
}
|
||||
$aData['getPrimaryKeyFunction'] .= 'return $pks;' . "\n";
|
||||
break;
|
||||
@@ -1443,7 +1422,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
}
|
||||
file_put_contents($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base'
|
||||
. $sClassName . '.php', $oTP4->getOutputContent());
|
||||
. $sClassName . '.php', $oTP4->getOutputContent());
|
||||
$oTP5 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'om' . PATH_SEP . 'BaseTablePeer.tpl');
|
||||
$oTP5->prepare();
|
||||
$sKeys = '';
|
||||
@@ -1526,10 +1505,9 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
}
|
||||
}
|
||||
file_put_contents($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base'
|
||||
. $sClassName . 'Peer.php', $oTP5->getOutputContent());
|
||||
. $sClassName . 'Peer.php', $oTP5->getOutputContent());
|
||||
} catch (Exception $oError) {
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ class AddonsManager extends BaseAddonsManager
|
||||
$filter = new InputFilter();
|
||||
$requiredPath = PATH_PLUGINS . $this->getAddonName() . ".php";
|
||||
$requiredPath = $filter->validateInput($requiredPath, 'path');
|
||||
require_once ($requiredPath);
|
||||
require_once($requiredPath);
|
||||
|
||||
if ($enable) {
|
||||
$oPluginRegistry->enablePlugin($this->getAddonName());
|
||||
@@ -223,7 +223,7 @@ class AddonsManager extends BaseAddonsManager
|
||||
}
|
||||
|
||||
///////
|
||||
$licenseManager = &PmLicenseManager::getSingleton();
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
$activeLicense = $licenseManager->getActiveLicense();
|
||||
|
||||
$data = $data . "Content-Disposition: form-data; name=\"licenseFile\"; filename=\"" . $licenseManager->file . "\"\n";
|
||||
@@ -474,18 +474,18 @@ class AddonsManager extends BaseAddonsManager
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
$con = Propel::getConnection( AddonsManagerPeer::DATABASE_NAME );
|
||||
$con = Propel::getConnection(AddonsManagerPeer::DATABASE_NAME);
|
||||
try {
|
||||
$con->begin();
|
||||
$this->setNew( false );
|
||||
$this->fromArray( $data, BasePeer::TYPE_FIELDNAME );
|
||||
$this->setNew(false);
|
||||
$this->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
if ($this->validate()) {
|
||||
$result = $this->save();
|
||||
$con->commit();
|
||||
return $result;
|
||||
} else {
|
||||
$con->rollback();
|
||||
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
||||
throw (new Exception("Failed Validation in class " . get_class($this) . "."));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$con->rollback();
|
||||
|
||||
@@ -35,7 +35,7 @@ class AddonsStore extends BaseAddonsStore
|
||||
public static function checkLicenseStore()
|
||||
{
|
||||
//getting the licenseManager....
|
||||
$licenseManager = &PmLicenseManager::getSingleton();
|
||||
$licenseManager = PmLicenseManager::getSingleton();
|
||||
|
||||
if (isset($licenseManager->id)) {
|
||||
//Remove any license store that is not the active license
|
||||
@@ -72,7 +72,7 @@ class AddonsStore extends BaseAddonsStore
|
||||
|
||||
AddonsStore::checkLicenseStore();
|
||||
|
||||
$licenseManager = &PmLicenseManager::getSingleton(); //Getting the licenseManager
|
||||
$licenseManager = PmLicenseManager::getSingleton(); //Getting the licenseManager
|
||||
|
||||
$result["store_errors"] = array();
|
||||
list($stores, $errors) = AddonsStore::updateAll(false, $type);
|
||||
@@ -155,7 +155,7 @@ class AddonsStore extends BaseAddonsStore
|
||||
if ($addon->getAddonId() == "enterprise" && $status== 'ready') {
|
||||
$status = 'installed';
|
||||
}
|
||||
if ($status == 'minus-circle' ) {
|
||||
if ($status == 'minus-circle') {
|
||||
$status = "available";
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ class AddonsStore extends BaseAddonsStore
|
||||
|
||||
AddonsStore::checkLicenseStore();
|
||||
|
||||
$licenseManager = &PmLicenseManager::getSingleton(); //Getting the licenseManager
|
||||
$licenseManager = PmLicenseManager::getSingleton(); //Getting the licenseManager
|
||||
|
||||
$result["store_errors"] = array();
|
||||
list($stores, $errors) = AddonsStore::updateAll(false);
|
||||
@@ -256,7 +256,7 @@ class AddonsStore extends BaseAddonsStore
|
||||
if ($addon->getAddonId() == "enterprise" && $status== 'ready') {
|
||||
$status = 'installed';
|
||||
}
|
||||
if ($status == 'minus-circle' ) {
|
||||
if ($status == 'minus-circle') {
|
||||
$status = "available";
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ class AddonsStore extends BaseAddonsStore
|
||||
$aPluginsPP = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee')));
|
||||
}
|
||||
|
||||
$pmLicenseManagerO = &PmLicenseManager::getSingleton();
|
||||
$pmLicenseManagerO = PmLicenseManager::getSingleton();
|
||||
$localPlugins = array();
|
||||
|
||||
if ($type == 'plugin') {
|
||||
@@ -436,7 +436,7 @@ class AddonsStore extends BaseAddonsStore
|
||||
if (is_array($list)) {
|
||||
foreach ($list['addons'] as $key => $feature) {
|
||||
$addon = new AddonsManager();
|
||||
if($addon->exists($feature['name'],$feature['guid'])){
|
||||
if ($addon->exists($feature['name'], $feature['guid'])) {
|
||||
$arrayData['ADDON_ID'] = $feature['name'];
|
||||
$arrayData['STORE_ID'] = $feature['guid'];
|
||||
$arrayData['ADDON_NAME'] = $feature['name'];
|
||||
|
||||
@@ -100,26 +100,26 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @param $isSubprocess is a subprocess inside a process?
|
||||
* @return delegation index of the application delegation.
|
||||
*/
|
||||
public function createAppDelegation ($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0, $appNumber = 0, $taskId = 0, $userId = 0, $proId = 0)
|
||||
public function createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0, $appNumber = 0, $taskId = 0, $userId = 0, $proId = 0)
|
||||
{
|
||||
if (! isset( $sProUid ) || strlen( $sProUid ) == 0) {
|
||||
throw (new Exception( 'Column "PRO_UID" cannot be null.' ));
|
||||
if (! isset($sProUid) || strlen($sProUid) == 0) {
|
||||
throw (new Exception('Column "PRO_UID" cannot be null.'));
|
||||
}
|
||||
|
||||
if (! isset( $sAppUid ) || strlen( $sAppUid ) == 0) {
|
||||
throw (new Exception( 'Column "APP_UID" cannot be null.' ));
|
||||
if (! isset($sAppUid) || strlen($sAppUid) == 0) {
|
||||
throw (new Exception('Column "APP_UID" cannot be null.'));
|
||||
}
|
||||
|
||||
if (! isset( $sTasUid ) || strlen( $sTasUid ) == 0) {
|
||||
throw (new Exception( 'Column "TAS_UID" cannot be null.' ));
|
||||
if (! isset($sTasUid) || strlen($sTasUid) == 0) {
|
||||
throw (new Exception('Column "TAS_UID" cannot be null.'));
|
||||
}
|
||||
|
||||
if (! isset( $sUsrUid ) /*|| strlen($sUsrUid ) == 0*/ ) {
|
||||
throw (new Exception( 'Column "USR_UID" cannot be null.' ));
|
||||
if (! isset($sUsrUid) /*|| strlen($sUsrUid ) == 0*/) {
|
||||
throw (new Exception('Column "USR_UID" cannot be null.'));
|
||||
}
|
||||
|
||||
if (! isset( $sAppThread ) || strlen( $sAppThread ) == 0) {
|
||||
throw (new Exception( 'Column "APP_THREAD" cannot be null.' ));
|
||||
if (! isset($sAppThread) || strlen($sAppThread) == 0) {
|
||||
throw (new Exception('Column "APP_THREAD" cannot be null.'));
|
||||
}
|
||||
|
||||
$this->delegation_id = null;
|
||||
@@ -161,17 +161,17 @@ class AppDelegation extends BaseAppDelegation
|
||||
}
|
||||
}
|
||||
//Verify successors: parrallel submit in the same time
|
||||
if($flagControl){
|
||||
if ($flagControl) {
|
||||
$nextTaskUid = $sTasUid;
|
||||
$index = $this->getAllTasksBeforeSecJoin($nextTaskUid, $sAppUid, $delPreviousFather);
|
||||
if($this->createThread($index, $sAppUid)){
|
||||
if ($this->createThread($index, $sAppUid)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if($flagControlMulInstance){
|
||||
if ($flagControlMulInstance) {
|
||||
$nextTaskUid = $sTasUid;
|
||||
$index = $this->getAllTheardMultipleInstance($delPreviousFather, $sAppUid);
|
||||
if($this->createThread($index, $sAppUid, $sUsrUid)){
|
||||
if ($this->createThread($index, $sAppUid, $sUsrUid)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -181,18 +181,18 @@ class AppDelegation extends BaseAppDelegation
|
||||
$criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0);
|
||||
BasePeer::doUpdate($criteria, $criteriaUpdate, Propel::getConnection('workflow'));
|
||||
|
||||
$this->setAppUid( $sAppUid );
|
||||
$this->setProUid( $sProUid );
|
||||
$this->setTasUid( $sTasUid );
|
||||
$this->setDelIndex( $delIndex );
|
||||
$this->setAppUid($sAppUid);
|
||||
$this->setProUid($sProUid);
|
||||
$this->setTasUid($sTasUid);
|
||||
$this->setDelIndex($delIndex);
|
||||
$this->setDelLastIndex(1);
|
||||
$this->setDelPrevious( $sPrevious == - 1 ? 0 : $sPrevious );
|
||||
$this->setUsrUid( $sUsrUid );
|
||||
$this->setDelType( 'NORMAL' );
|
||||
$this->setDelPriority( ($iPriority != '' ? $iPriority : '3') );
|
||||
$this->setDelThread( $sAppThread );
|
||||
$this->setDelThreadStatus( 'OPEN' );
|
||||
$this->setDelDelegateDate( 'now' );
|
||||
$this->setDelPrevious($sPrevious == - 1 ? 0 : $sPrevious);
|
||||
$this->setUsrUid($sUsrUid);
|
||||
$this->setDelType('NORMAL');
|
||||
$this->setDelPriority(($iPriority != '' ? $iPriority : '3'));
|
||||
$this->setDelThread($sAppThread);
|
||||
$this->setDelThreadStatus('OPEN');
|
||||
$this->setDelDelegateDate('now');
|
||||
$this->setAppNumber($appNumber);
|
||||
$this->setTasId($taskId);
|
||||
$this->setUsrId($userId);
|
||||
@@ -206,17 +206,17 @@ class AppDelegation extends BaseAppDelegation
|
||||
$this->setDelTaskDueDate($delTaskDueDate);
|
||||
$this->setDelRiskDate($delRiskDate);
|
||||
|
||||
if ((defined( "DEBUG_CALENDAR_LOG" )) && (DEBUG_CALENDAR_LOG)) {
|
||||
if ((defined("DEBUG_CALENDAR_LOG")) && (DEBUG_CALENDAR_LOG)) {
|
||||
//$this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine
|
||||
$this->setDelData( $delTaskDueDate );
|
||||
$this->setDelData($delTaskDueDate);
|
||||
} else {
|
||||
$this->setDelData( '' );
|
||||
$this->setDelData('');
|
||||
}
|
||||
|
||||
// this condition assures that an internal delegation like a subprocess dont have an initial date setted
|
||||
if ($delIndex == 1 && ! $isSubprocess) {
|
||||
//the first delegation, init date this should be now for draft applications, in other cases, should be null.
|
||||
$this->setDelInitDate( 'now' );
|
||||
$this->setDelInitDate('now');
|
||||
}
|
||||
|
||||
if ($this->validate()) {
|
||||
@@ -233,13 +233,13 @@ class AppDelegation extends BaseAppDelegation
|
||||
foreach ($validationFailuresArray as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
throw (new Exception( 'Failed Data validation. ' . $msg ));
|
||||
throw (new Exception('Failed Data validation. ' . $msg));
|
||||
}
|
||||
|
||||
$delIndex = $this->getDelIndex();
|
||||
|
||||
// Hook for the trigger PM_CREATE_NEW_DELEGATION
|
||||
if (defined( 'PM_CREATE_NEW_DELEGATION' )) {
|
||||
if (defined('PM_CREATE_NEW_DELEGATION')) {
|
||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||
$flagActionsByEmail = true;
|
||||
|
||||
@@ -268,7 +268,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
if ($resultAbe->next()) {
|
||||
$dataAbe = $resultAbe->getRow();
|
||||
$flagActionsByEmail = false;
|
||||
if($dataAbe['ABE_TYPE']!='' && $data->USR_UID!=''){
|
||||
if ($dataAbe['ABE_TYPE']!='' && $data->USR_UID!='') {
|
||||
$actionsByEmail = new ActionsByEmailCoreClass();
|
||||
$actionsByEmail->sendActionsByEmail($data, $dataAbe);
|
||||
}
|
||||
@@ -278,10 +278,10 @@ class AppDelegation extends BaseAppDelegation
|
||||
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton ();
|
||||
if ($licensedFeatures->verifyfeature ( '7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09' )) {
|
||||
try{
|
||||
$pmGoogle = new PmGoogleApi ();
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
try {
|
||||
$pmGoogle = new PmGoogleApi();
|
||||
if ($pmGoogle->getServiceGmailStatus()) {
|
||||
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
|
||||
$Pmgmail->gmailsForRouting($sUsrUid, $sTasUid, $sAppUid, $delIndex, $isSubprocess);
|
||||
@@ -338,30 +338,30 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @return array $Fields the fields
|
||||
*/
|
||||
|
||||
public function LoadParallel ($AppUid, $index = "")
|
||||
public function LoadParallel($AppUid, $index = "")
|
||||
{
|
||||
$aCases = array();
|
||||
|
||||
$c = new Criteria( 'workflow' );
|
||||
$c->addSelectColumn( AppDelegationPeer::APP_UID );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$c->addSelectColumn( AppDelegationPeer::PRO_UID );
|
||||
$c->addSelectColumn( AppDelegationPeer::TAS_UID );
|
||||
$c->addSelectColumn( AppDelegationPeer::USR_UID );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_PREVIOUS );
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn(AppDelegationPeer::APP_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$c->addSelectColumn(AppDelegationPeer::PRO_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
|
||||
$c->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
|
||||
$c->add( AppDelegationPeer::APP_UID, $AppUid );
|
||||
if(!empty($index)) {
|
||||
$c->add( AppDelegationPeer::DEL_INDEX, $index );
|
||||
$c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
$c->add(AppDelegationPeer::APP_UID, $AppUid);
|
||||
if (!empty($index)) {
|
||||
$c->add(AppDelegationPeer::DEL_INDEX, $index);
|
||||
}
|
||||
$c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$rs = AppDelegationPeer::doSelectRS( $c );
|
||||
$row= $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$c->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$rs = AppDelegationPeer::doSelectRS($c);
|
||||
$row= $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
@@ -393,14 +393,14 @@ class AppDelegation extends BaseAppDelegation
|
||||
*
|
||||
*/
|
||||
|
||||
public function update ($aData)
|
||||
public function update($aData)
|
||||
{
|
||||
$con = Propel::getConnection( AppDelegationPeer::DATABASE_NAME );
|
||||
$con = Propel::getConnection(AppDelegationPeer::DATABASE_NAME);
|
||||
try {
|
||||
$con->begin();
|
||||
$oApp = AppDelegationPeer::retrieveByPK( $aData['APP_UID'], $aData['DEL_INDEX'] );
|
||||
if (is_object( $oApp ) && get_class( $oApp ) == 'AppDelegation') {
|
||||
$oApp->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
$oApp = AppDelegationPeer::retrieveByPK($aData['APP_UID'], $aData['DEL_INDEX']);
|
||||
if (is_object($oApp) && get_class($oApp) == 'AppDelegation') {
|
||||
$oApp->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||
if ($oApp->validate()) {
|
||||
$res = $oApp->save();
|
||||
$con->commit();
|
||||
@@ -411,24 +411,24 @@ class AppDelegation extends BaseAppDelegation
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
|
||||
throw (new PropelException( 'The row cannot be created!', new PropelException( $msg ) ));
|
||||
throw (new PropelException('The row cannot be created!', new PropelException($msg)));
|
||||
}
|
||||
} else {
|
||||
$con->rollback();
|
||||
throw (new Exception( "This AppDelegation row doesn't exist!" ));
|
||||
throw (new Exception("This AppDelegation row doesn't exist!"));
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function remove ($sApplicationUID, $iDelegationIndex)
|
||||
public function remove($sApplicationUID, $iDelegationIndex)
|
||||
{
|
||||
$oConnection = Propel::getConnection( StepTriggerPeer::DATABASE_NAME );
|
||||
$oConnection = Propel::getConnection(StepTriggerPeer::DATABASE_NAME);
|
||||
try {
|
||||
$oConnection->begin();
|
||||
$oApp = AppDelegationPeer::retrieveByPK( $sApplicationUID, $iDelegationIndex );
|
||||
if (is_object( $oApp ) && get_class( $oApp ) == 'AppDelegation') {
|
||||
$oApp = AppDelegationPeer::retrieveByPK($sApplicationUID, $iDelegationIndex);
|
||||
if (is_object($oApp) && get_class($oApp) == 'AppDelegation') {
|
||||
$result = $oApp->delete();
|
||||
}
|
||||
$oConnection->commit();
|
||||
@@ -441,20 +441,20 @@ class AppDelegation extends BaseAppDelegation
|
||||
|
||||
// TasTypeDay = 1 => working days
|
||||
// TasTypeDay = 2 => calendar days
|
||||
public function calculateDueDate ($sNextTasParam)
|
||||
public function calculateDueDate($sNextTasParam)
|
||||
{
|
||||
//Get Task properties
|
||||
$task = TaskPeer::retrieveByPK( $this->getTasUid() );
|
||||
$task = TaskPeer::retrieveByPK($this->getTasUid());
|
||||
|
||||
$aData = array();
|
||||
$aData['TAS_UID'] = $this->getTasUid();
|
||||
//Added to allow User defined Timing Control at Run time from Derivation screen
|
||||
if (isset( $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] ) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
|
||||
if (isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
|
||||
$aData['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION'];
|
||||
$aData['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT'];
|
||||
$aData['TAS_TYPE_DAY'] = $sNextTasParam['NEXT_TASK']['TAS_TYPE_DAY'];
|
||||
|
||||
if (isset( $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] ) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') {
|
||||
if (isset($sNextTasParam['NEXT_TASK']['TAS_CALENDAR']) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') {
|
||||
$aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'];
|
||||
} else {
|
||||
$aCalendarUID = '';
|
||||
@@ -462,9 +462,9 @@ class AppDelegation extends BaseAppDelegation
|
||||
|
||||
//Updating the task Table , so that user will see updated values in the assign screen in consequent cases
|
||||
$oTask = new Task();
|
||||
$oTask->update( $aData );
|
||||
$oTask->update($aData);
|
||||
} else {
|
||||
if (is_null( $task )) {
|
||||
if (is_null($task)) {
|
||||
return 0;
|
||||
}
|
||||
$aData['TAS_DURATION'] = $task->getTasDuration();
|
||||
@@ -496,13 +496,12 @@ class AppDelegation extends BaseAppDelegation
|
||||
public function calculateRiskDate($dueDate, $risk)
|
||||
{
|
||||
try {
|
||||
|
||||
$data = array();
|
||||
if (isset( $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] ) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
|
||||
if (isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
|
||||
$data['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION'];
|
||||
$data['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT'];
|
||||
} else {
|
||||
$task = TaskPeer::retrieveByPK( $this->getTasUid() );
|
||||
$task = TaskPeer::retrieveByPK($this->getTasUid());
|
||||
$data['TAS_DURATION'] = $task->getTasDuration();
|
||||
$data['TAS_TIMEUNIT'] = $task->getTasTimeUnit();
|
||||
}
|
||||
@@ -529,47 +528,47 @@ class AppDelegation extends BaseAppDelegation
|
||||
}
|
||||
}
|
||||
|
||||
public function getDiffDate ($date1, $date2)
|
||||
public function getDiffDate($date1, $date2)
|
||||
{
|
||||
return ($date1 - $date2) / (24 * 60 * 60); //days
|
||||
return ($date1 - $date2) / 3600;
|
||||
}
|
||||
|
||||
//usually this function is called when routing in the flow, so by default cron =0
|
||||
public function calculateDuration($cron = 0)
|
||||
{
|
||||
$this->writeFileIfCalledFromCronForCalculateDuration($cron);
|
||||
$this->patchDataWithValuesForCalculateDuration();
|
||||
$rs = $this->recordSetForCalculateDuration();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$i = 0;
|
||||
$calendar = new Calendar();
|
||||
$now = new DateTime();
|
||||
while (is_array ($row)) {
|
||||
$oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] );
|
||||
//usually this function is called when routing in the flow, so by default cron =0
|
||||
public function calculateDuration($cron = 0)
|
||||
{
|
||||
$this->writeFileIfCalledFromCronForCalculateDuration($cron);
|
||||
$this->patchDataWithValuesForCalculateDuration();
|
||||
$rs = $this->recordSetForCalculateDuration();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$i = 0;
|
||||
$calendar = new Calendar();
|
||||
$now = new DateTime();
|
||||
while (is_array($row)) {
|
||||
$oAppDel = AppDelegationPeer::retrieveByPk($row['APP_UID'], $row['DEL_INDEX']);
|
||||
$calendar = new Calendar();
|
||||
$calendar->getCalendar($row['USR_UID'], $row['PRO_UID'], $row['TAS_UID']);
|
||||
$calData = $calendar->getCalendarData();
|
||||
$calculatedValues = $this->getValuesToStoreForCalculateDuration($row, $calendar, $calData, $now);
|
||||
|
||||
$oAppDel->setDelStarted($calculatedValues['isStarted']);
|
||||
$oAppDel->setDelFinished($calculatedValues['isFinished']);
|
||||
$oAppDel->setDelDelayed($calculatedValues['isDelayed']);
|
||||
$oAppDel->setDelQueueDuration($calculatedValues['queueTime']);
|
||||
$oAppDel->setDelDelayDuration($calculatedValues['delayTime']);
|
||||
$oAppDel->setDelDuration($calculatedValues['durationTime']);
|
||||
$oAppDel->setAppOverduePercentage($calculatedValues['percentDelay']);
|
||||
$RES = $oAppDel->save();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
}
|
||||
$oAppDel->setDelStarted($calculatedValues['isStarted']);
|
||||
$oAppDel->setDelFinished($calculatedValues['isFinished']);
|
||||
$oAppDel->setDelDelayed($calculatedValues['isDelayed']);
|
||||
$oAppDel->setDelQueueDuration($calculatedValues['queueTime']);
|
||||
$oAppDel->setDelDelayDuration($calculatedValues['delayTime']);
|
||||
$oAppDel->setDelDuration($calculatedValues['durationTime']);
|
||||
$oAppDel->setAppOverduePercentage($calculatedValues['percentDelay']);
|
||||
$RES = $oAppDel->save();
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
}
|
||||
|
||||
public function getValuesToStoreForCalculateDuration($row, $calendar, $calData, $nowDate)
|
||||
{
|
||||
public function getValuesToStoreForCalculateDuration($row, $calendar, $calData, $nowDate)
|
||||
{
|
||||
$rowValues = $this->completeRowDataForCalculateDuration($row, $nowDate);
|
||||
return Array(
|
||||
return array(
|
||||
'isStarted' => $this->createDateFromString($row['DEL_INIT_DATE']) != null ? 1 : 0,
|
||||
'isFinished' => $this->createDateFromString($row['DEL_FINISH_DATE']) != null ? 1: 0,
|
||||
'isDelayed' => $this->calculateDelayTime($calendar, $calData, $rowValues) > 0 ? 1 : 0,
|
||||
@@ -577,11 +576,11 @@ class AppDelegation extends BaseAppDelegation
|
||||
'delayTime' => $this->calculateDelayTime($calendar, $calData, $rowValues),
|
||||
'durationTime' => $this->calculateNetProcessingTime($calendar, $calData, $rowValues),
|
||||
'percentDelay' => $this->calculateOverduePercentage($calendar, $calData, $rowValues)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private function calculateOverduePercentage($calendar, $calData, $rowValues)
|
||||
{
|
||||
private function calculateOverduePercentage($calendar, $calData, $rowValues)
|
||||
{
|
||||
if ($rowValues['fTaskDuration'] == 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -591,203 +590,210 @@ class AppDelegation extends BaseAppDelegation
|
||||
: $rowValues['fTaskDuration'] / 24;
|
||||
|
||||
return $this->calculateDelayTime($calendar, $calData, $rowValues) * 100/ $taskTime;
|
||||
}
|
||||
}
|
||||
|
||||
//time in days from init or delegate date to finish or today's date
|
||||
private function calculateNetProcessingTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $this->selectDate ($rowValues['dInitDate'], $rowValues['dDelegateDate'], 'max');
|
||||
$endDateForCalc = $this->selectDate ($rowValues['dFinishDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData)/(24*60*60);
|
||||
}
|
||||
//time in days from init or delegate date to finish or today's date
|
||||
private function calculateNetProcessingTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $this->selectDate($rowValues['dInitDate'], $rowValues['dDelegateDate'], 'max');
|
||||
$endDateForCalc = $this->selectDate($rowValues['dFinishDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData
|
||||
)/(24*60*60);
|
||||
}
|
||||
|
||||
//time in days from delegate date to init date
|
||||
private function calculateQueueTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $rowValues['dDelegateDate'];
|
||||
$endDateForCalc = $this->selectDate ($rowValues['dInitDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData)/(24*60*60);
|
||||
}
|
||||
//time in days from delegate date to init date
|
||||
private function calculateQueueTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $rowValues['dDelegateDate'];
|
||||
$endDateForCalc = $this->selectDate($rowValues['dInitDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData
|
||||
)/(24*60*60);
|
||||
}
|
||||
|
||||
//time in days from due date to finish or today date
|
||||
private function calculateDelayTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $this->selectDate($rowValues['dDueDate'], $rowValues['dDelegateDate'], 'max');
|
||||
$endDateForCalc = $this->selectDate ($rowValues['dFinishDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData)/(24*60*60);
|
||||
}
|
||||
//time in days from due date to finish or today date
|
||||
private function calculateDelayTime($calendar, $calData, $rowValues)
|
||||
{
|
||||
$initDateForCalc = $this->selectDate($rowValues['dDueDate'], $rowValues['dDelegateDate'], 'max');
|
||||
$endDateForCalc = $this->selectDate($rowValues['dFinishDate'], $rowValues['dNow'], 'min');
|
||||
return $calendar->dashCalculateDurationWithCalendar(
|
||||
$initDateForCalc->format('Y-m-d H:i:s'),
|
||||
$endDateForCalc->format('Y-m-d H:i:s'),
|
||||
$calData
|
||||
)/(24*60*60);
|
||||
}
|
||||
|
||||
//to avoid aplying many times the same conversions and functions the row data
|
||||
//is used to create dates as DateTime objects and other fields are stracted also,
|
||||
//so the array returned will work as a "context" object for the rest of the functions.
|
||||
private function completeRowDataForCalculateDuration($row, $nowDate)
|
||||
{
|
||||
return Array(
|
||||
'dDelegateDate' => $this->createDateFromString ($row['DEL_DELEGATE_DATE']),
|
||||
'dInitDate' => $this->createDateFromString ($row['DEL_INIT_DATE']),
|
||||
'dDueDate' => $this->createDateFromString ($row['DEL_TASK_DUE_DATE']),
|
||||
'dFinishDate' => $this->createDateFromString ($row['DEL_FINISH_DATE']),
|
||||
'fTaskDuration' => $row['TAS_DURATION'] * 1.0,
|
||||
'cTaskDurationUnit' => $row['TAS_TIMEUNIT'],
|
||||
'dNow' => $nowDate,
|
||||
'row' => $row
|
||||
);
|
||||
}
|
||||
private function completeRowDataForCalculateDuration($row, $nowDate)
|
||||
{
|
||||
return array(
|
||||
'dDelegateDate' => $this->createDateFromString($row['DEL_DELEGATE_DATE']),
|
||||
'dInitDate' => $this->createDateFromString($row['DEL_INIT_DATE']),
|
||||
'dDueDate' => $this->createDateFromString($row['DEL_TASK_DUE_DATE']),
|
||||
'dFinishDate' => $this->createDateFromString($row['DEL_FINISH_DATE']),
|
||||
'fTaskDuration' => $row['TAS_DURATION'] * 1.0,
|
||||
'cTaskDurationUnit' => $row['TAS_TIMEUNIT'],
|
||||
'dNow' => $nowDate,
|
||||
'row' => $row
|
||||
);
|
||||
}
|
||||
|
||||
//by default min function returns de null value if one of the params is null
|
||||
//by default min function returns de null value if one of the params is null
|
||||
//to avoid that behaviour this function was created so the function returns the first
|
||||
//not null date or if both are not null the mix/max date
|
||||
//NOTE date1 and date2 are DateTime objects.
|
||||
private function selectDate($date1, $date2, $compareFunction)
|
||||
{
|
||||
if ($date1 == null)
|
||||
return $date2;
|
||||
private function selectDate($date1, $date2, $compareFunction)
|
||||
{
|
||||
if ($date1 == null) {
|
||||
return $date2;
|
||||
}
|
||||
|
||||
if ($date2 == null)
|
||||
return $date1;
|
||||
if ($date2 == null) {
|
||||
return $date1;
|
||||
}
|
||||
|
||||
return $compareFunction($date1, $date2);
|
||||
}
|
||||
return $compareFunction($date1, $date2);
|
||||
}
|
||||
|
||||
//Creates a DateTime object from a string. If the string is null or empty a null object is returned
|
||||
private function createDateFromString($stringDate) {
|
||||
if ($stringDate == null || $stringDate == '')
|
||||
return null;
|
||||
return new DateTime($stringDate);
|
||||
}
|
||||
|
||||
private function recordSetForCalculateDuration()
|
||||
{
|
||||
//walk in all rows with DEL_STARTED = 0 or DEL_FINISHED = 0
|
||||
$c = new Criteria( 'workflow' );
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( AppDelegationPeer::APP_UID );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$c->addSelectColumn( AppDelegationPeer::USR_UID);
|
||||
$c->addSelectColumn( AppDelegationPeer::PRO_UID);
|
||||
$c->addSelectColumn( AppDelegationPeer::TAS_UID);
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DURATION );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_QUEUE_DURATION );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELAY_DURATION );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_STARTED );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_FINISHED );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELAYED );
|
||||
$c->addSelectColumn( TaskPeer::TAS_DURATION );
|
||||
$c->addSelectColumn( TaskPeer::TAS_TIMEUNIT );
|
||||
$c->addSelectColumn( TaskPeer::TAS_TYPE_DAY );
|
||||
|
||||
$c->addJoin( AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN );
|
||||
$cton1 = $c->getNewCriterion( AppDelegationPeer::DEL_STARTED, 0 );
|
||||
$cton2 = $c->getNewCriterion( AppDelegationPeer::DEL_FINISHED, 0 );
|
||||
$cton1->addOR( $cton2 );
|
||||
$c->add( $cton1 );
|
||||
$rs = AppDelegationPeer::doSelectRS( $c );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
return $rs;
|
||||
}
|
||||
private function writeFileIfCalledFromCronForCalculateDuration($cron)
|
||||
{
|
||||
if ($cron == 1) {
|
||||
$arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
|
||||
$arrayCron["processcTimeStart"] = time();
|
||||
@file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) );
|
||||
}
|
||||
}
|
||||
|
||||
private function patchDataWithValuesForCalculateDuration()
|
||||
{
|
||||
//patch rows with initdate = null and finish_date
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( AppDelegationPeer::APP_UID );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
||||
$c->add( AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNULL );
|
||||
$c->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL );
|
||||
//$c->add(AppDelegationPeer::DEL_INDEX, 1);
|
||||
|
||||
|
||||
$rs = AppDelegationPeer::doSelectRS( $c );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
|
||||
while (is_array( $row )) {
|
||||
$oAppDel = AppDelegationPeer::retrieveByPk( $row['APP_UID'], $row['DEL_INDEX'] );
|
||||
if (isset( $row['DEL_FINISH_DATE'] )) {
|
||||
$oAppDel->setDelInitDate( $row['DEL_FINISH_DATE'] );
|
||||
} else {
|
||||
$oAppDel->setDelInitDate( $row['DEL_INIT_DATE'] );
|
||||
}
|
||||
$oAppDel->save();
|
||||
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getLastDeleration ($APP_UID)
|
||||
private function createDateFromString($stringDate)
|
||||
{
|
||||
$c = new Criteria( 'workflow' );
|
||||
$c->addSelectColumn( AppDelegationPeer::APP_UID );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELEGATE_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_INIT_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DURATION );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_QUEUE_DURATION );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELAY_DURATION );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_STARTED );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_FINISHED );
|
||||
$c->addSelectColumn( AppDelegationPeer::DEL_DELAYED );
|
||||
$c->addSelectColumn( AppDelegationPeer::USR_UID );
|
||||
if ($stringDate == null || $stringDate == '') {
|
||||
return null;
|
||||
}
|
||||
return new DateTime($stringDate);
|
||||
}
|
||||
|
||||
$c->add( AppDelegationPeer::APP_UID, $APP_UID );
|
||||
$c->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$rs = AppDelegationPeer::doSelectRS( $c );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
private function recordSetForCalculateDuration()
|
||||
{
|
||||
//walk in all rows with DEL_STARTED = 0 or DEL_FINISHED = 0
|
||||
$c = new Criteria('workflow');
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn(AppDelegationPeer::APP_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$c->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::PRO_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DURATION);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_QUEUE_DURATION);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DELAY_DURATION);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_STARTED);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_FINISHED);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DELAYED);
|
||||
$c->addSelectColumn(TaskPeer::TAS_DURATION);
|
||||
$c->addSelectColumn(TaskPeer::TAS_TIMEUNIT);
|
||||
$c->addSelectColumn(TaskPeer::TAS_TYPE_DAY);
|
||||
|
||||
$c->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
|
||||
$cton1 = $c->getNewCriterion(AppDelegationPeer::DEL_STARTED, 0);
|
||||
$cton2 = $c->getNewCriterion(AppDelegationPeer::DEL_FINISHED, 0);
|
||||
$cton1->addOR($cton2);
|
||||
$c->add($cton1);
|
||||
$rs = AppDelegationPeer::doSelectRS($c);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
return $rs;
|
||||
}
|
||||
private function writeFileIfCalledFromCronForCalculateDuration($cron)
|
||||
{
|
||||
if ($cron == 1) {
|
||||
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
|
||||
$arrayCron["processcTimeStart"] = time();
|
||||
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
|
||||
}
|
||||
}
|
||||
|
||||
private function patchDataWithValuesForCalculateDuration()
|
||||
{
|
||||
//patch rows with initdate = null and finish_date
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn(AppDelegationPeer::APP_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
$c->add(AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNULL);
|
||||
$c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL);
|
||||
//$c->add(AppDelegationPeer::DEL_INDEX, 1);
|
||||
|
||||
|
||||
$rs = AppDelegationPeer::doSelectRS($c);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
|
||||
while (is_array($row)) {
|
||||
$oAppDel = AppDelegationPeer::retrieveByPk($row['APP_UID'], $row['DEL_INDEX']);
|
||||
if (isset($row['DEL_FINISH_DATE'])) {
|
||||
$oAppDel->setDelInitDate($row['DEL_FINISH_DATE']);
|
||||
} else {
|
||||
$oAppDel->setDelInitDate($row['DEL_INIT_DATE']);
|
||||
}
|
||||
$oAppDel->save();
|
||||
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getLastDeleration($APP_UID)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn(AppDelegationPeer::APP_UID);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DURATION);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_QUEUE_DURATION);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DELAY_DURATION);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_STARTED);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_FINISHED);
|
||||
$c->addSelectColumn(AppDelegationPeer::DEL_DELAYED);
|
||||
$c->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
|
||||
$c->add(AppDelegationPeer::APP_UID, $APP_UID);
|
||||
$c->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$rs = AppDelegationPeer::doSelectRS($c);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
return $rs->getRow();
|
||||
}
|
||||
|
||||
public function getCurrentIndex ($appUid)
|
||||
public function getCurrentIndex($appUid)
|
||||
{
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$oCriteria->add( AppDelegationPeer::APP_UID, $appUid );
|
||||
$oCriteria->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria );
|
||||
$oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||
$oCriteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$oRuleSet = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oRuleSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oRuleSet->next();
|
||||
$data = $oRuleSet->getRow();
|
||||
return (int)$data['DEL_INDEX'];
|
||||
}
|
||||
|
||||
public function getCurrentTask ($appUid)
|
||||
public function getCurrentTask($appUid)
|
||||
{
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );
|
||||
$oCriteria->add( AppDelegationPeer::APP_UID, $appUid );
|
||||
$oCriteria->addDescendingOrderByColumn( AppDelegationPeer::DEL_INDEX );
|
||||
$oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria );
|
||||
$oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||
$oCriteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$oRuleSet = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oRuleSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oRuleSet->next();
|
||||
$data = $oRuleSet->getRow();
|
||||
return $data['TAS_UID'];
|
||||
@@ -801,18 +807,16 @@ class AppDelegation extends BaseAppDelegation
|
||||
*/
|
||||
public function getCurrentUsers($appUid, $index)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn( AppDelegationPeer::USR_UID );
|
||||
$criteria->add( AppDelegationPeer::APP_UID, $appUid );
|
||||
$criteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
|
||||
$criteria->add( AppDelegationPeer::DEL_INDEX, $index );
|
||||
$dataResult = AppDelegationPeer::doSelectRS( $criteria );
|
||||
$dataResult->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
if($dataResult->next()) {
|
||||
return $dataResult->getRow();
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||
$oCriteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
$oCriteria->add(AppDelegationPeer::DEL_INDEX, $index);
|
||||
$oRuleSet = AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oRuleSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oRuleSet->next();
|
||||
$data = $oRuleSet->getRow();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -822,7 +826,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @return array $Fields the fields
|
||||
*/
|
||||
|
||||
public function alreadyRouted ($appUid, $sDelIndex)
|
||||
public function alreadyRouted($appUid, $sDelIndex)
|
||||
{
|
||||
$c = new Criteria("workflow");
|
||||
$c->clearSelectColumns();
|
||||
@@ -832,7 +836,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNOTNULL);
|
||||
$result = AppDelegationPeer::doSelectRS($c);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if($result->next()) {
|
||||
if ($result->next()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -858,7 +862,8 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @param string $sAppUid
|
||||
* @return array $index
|
||||
*/
|
||||
public static function getAllTasksBeforeSecJoin($nextTaskUid, $sAppUid, $sDelPrevious, $threadStatus = ''){
|
||||
public static function getAllTasksBeforeSecJoin($nextTaskUid, $sAppUid, $sDelPrevious, $threadStatus = '')
|
||||
{
|
||||
$criteriaR = new Criteria('workflow');
|
||||
$criteriaR->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteriaR->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
@@ -874,7 +879,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$rsCriteriaR->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$index = array();
|
||||
$c = 0;
|
||||
while($rsCriteriaR->next()){
|
||||
while ($rsCriteriaR->next()) {
|
||||
$row = $rsCriteriaR->getRow();
|
||||
$index[$c++] = $row['DEL_INDEX'];
|
||||
}
|
||||
@@ -889,13 +894,14 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @param string $sUsrUid
|
||||
* @return boolean $res
|
||||
*/
|
||||
public static function createThread($index, $sAppUid, $sUsrUid = ''){
|
||||
public static function createThread($index, $sAppUid, $sUsrUid = '')
|
||||
{
|
||||
$criteriaDel = new Criteria("workflow");
|
||||
$criteriaDel->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteriaDel->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
$criteriaDel->add(AppDelegationPeer::APP_UID, $sAppUid);
|
||||
$criteriaDel->add(AppDelegationPeer::DEL_PREVIOUS, $index, Criteria::IN);
|
||||
if($sUsrUid !== ''){
|
||||
if ($sUsrUid !== '') {
|
||||
$criteriaDel->add(AppDelegationPeer::USR_UID, $sUsrUid);
|
||||
}
|
||||
$criteriaDel = AppDelegationPeer::doSelectRS($criteriaDel);
|
||||
@@ -911,7 +917,8 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @param string $sAppUid
|
||||
* @return array $index
|
||||
*/
|
||||
public static function getAllTheardMultipleInstance($sPrevious, $sAppUid){
|
||||
public static function getAllTheardMultipleInstance($sPrevious, $sAppUid)
|
||||
{
|
||||
$criteriaR = new Criteria('workflow');
|
||||
$criteriaR->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteriaR->add(AppDelegationPeer::APP_UID, $sAppUid, Criteria::EQUAL);
|
||||
@@ -920,7 +927,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
$rsCriteriaR->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$index = array();
|
||||
$c = 0;
|
||||
while($rsCriteriaR->next()){
|
||||
while ($rsCriteriaR->next()) {
|
||||
$row = $rsCriteriaR->getRow();
|
||||
$index[$c++] = $row['DEL_INDEX'];
|
||||
}
|
||||
|
||||
@@ -51,18 +51,18 @@ class Content extends BaseContent
|
||||
* @param string $sUID
|
||||
* @return variant
|
||||
*/
|
||||
public static function load ($ConCategory, $ConParent, $ConId, $ConLang)
|
||||
public static function load($ConCategory, $ConParent, $ConId, $ConLang)
|
||||
{
|
||||
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
if (is_null( $content )) {
|
||||
$content = ContentPeer::retrieveByPK($ConCategory, $ConParent, $ConId, $ConLang);
|
||||
if (is_null($content)) {
|
||||
//we dont find any value for this field and language in CONTENT table;
|
||||
$ConValue = Content::autoLoadSave( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
$ConValue = Content::autoLoadSave($ConCategory, $ConParent, $ConId, $ConLang);
|
||||
} else {
|
||||
//krumo($content);
|
||||
$ConValue = $content->getConValue();
|
||||
if ($ConValue == "") {
|
||||
//try to find a valid translation
|
||||
$ConValue = Content::autoLoadSave( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
$ConValue = Content::autoLoadSave($ConCategory, $ConParent, $ConId, $ConLang);
|
||||
}
|
||||
}
|
||||
return $ConValue;
|
||||
@@ -76,27 +76,27 @@ class Content extends BaseContent
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public static function getDefaultContentLang ($ConCategory, $ConParent, $ConId, $destConLang)
|
||||
public static function getDefaultContentLang($ConCategory, $ConParent, $ConId, $destConLang)
|
||||
{
|
||||
$Criteria = new Criteria( 'workflow' );
|
||||
$Criteria = new Criteria('workflow');
|
||||
$Criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
|
||||
$Criteria->addSelectColumn( ContentPeer::CON_CATEGORY );
|
||||
$Criteria->addSelectColumn( ContentPeer::CON_PARENT );
|
||||
$Criteria->addSelectColumn( ContentPeer::CON_ID );
|
||||
$Criteria->addSelectColumn( ContentPeer::CON_LANG );
|
||||
$Criteria->addSelectColumn( ContentPeer::CON_VALUE );
|
||||
$Criteria->addSelectColumn(ContentPeer::CON_CATEGORY);
|
||||
$Criteria->addSelectColumn(ContentPeer::CON_PARENT);
|
||||
$Criteria->addSelectColumn(ContentPeer::CON_ID);
|
||||
$Criteria->addSelectColumn(ContentPeer::CON_LANG);
|
||||
$Criteria->addSelectColumn(ContentPeer::CON_VALUE);
|
||||
|
||||
$Criteria->add( ContentPeer::CON_CATEGORY, $ConCategory, CRITERIA::EQUAL );
|
||||
$Criteria->add( ContentPeer::CON_PARENT, $ConParent, CRITERIA::EQUAL );
|
||||
$Criteria->add( ContentPeer::CON_ID, $ConId, CRITERIA::EQUAL );
|
||||
$Criteria->add( ContentPeer::CON_LANG, $destConLang, CRITERIA::NOT_EQUAL );
|
||||
$Criteria->add(ContentPeer::CON_CATEGORY, $ConCategory, CRITERIA::EQUAL);
|
||||
$Criteria->add(ContentPeer::CON_PARENT, $ConParent, CRITERIA::EQUAL);
|
||||
$Criteria->add(ContentPeer::CON_ID, $ConId, CRITERIA::EQUAL);
|
||||
$Criteria->add(ContentPeer::CON_LANG, $destConLang, CRITERIA::NOT_EQUAL);
|
||||
|
||||
$rs = ContentPeer::doSelectRS( $Criteria );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rs = ContentPeer::doSelectRS($Criteria);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
|
||||
if (is_array( $row = $rs->getRow() )) {
|
||||
if (is_array($row = $rs->getRow())) {
|
||||
$defaultLang = $row['CON_LANG'];
|
||||
} else {
|
||||
$defaultLang = "";
|
||||
@@ -113,7 +113,7 @@ class Content extends BaseContent
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public static function updateEqualValue ($ConCategory, $ConParent, $ConId, $ConValue)
|
||||
public static function updateEqualValue($ConCategory, $ConParent, $ConId, $ConValue)
|
||||
{
|
||||
$con = Propel::getConnection('workflow');
|
||||
$c1 = new Criteria('workflow');
|
||||
@@ -136,18 +136,18 @@ class Content extends BaseContent
|
||||
* @return string
|
||||
* if the row doesn't exist, it will be created automatically, even the default 'en' language
|
||||
*/
|
||||
public static function autoLoadSave ($ConCategory, $ConParent, $ConId, $destConLang)
|
||||
public static function autoLoadSave($ConCategory, $ConParent, $ConId, $destConLang)
|
||||
{
|
||||
//search in 'en' language, the default language
|
||||
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, 'en' );
|
||||
$content = ContentPeer::retrieveByPK($ConCategory, $ConParent, $ConId, 'en');
|
||||
|
||||
if ((is_null( $content )) || ($content->getConValue() == "")) {
|
||||
$differentLang = Content::getDefaultContentLang( $ConCategory, $ConParent, $ConId, $destConLang );
|
||||
$content = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $differentLang );
|
||||
if ((is_null($content)) || ($content->getConValue() == "")) {
|
||||
$differentLang = Content::getDefaultContentLang($ConCategory, $ConParent, $ConId, $destConLang);
|
||||
$content = ContentPeer::retrieveByPK($ConCategory, $ConParent, $ConId, $differentLang);
|
||||
}
|
||||
|
||||
//to do: review if the $destConLang is a valid language/
|
||||
if (is_null( $content )) {
|
||||
if (is_null($content)) {
|
||||
$ConValue = '';
|
||||
//we dont find any value for this field and language in CONTENT table
|
||||
} else {
|
||||
@@ -155,15 +155,15 @@ class Content extends BaseContent
|
||||
}
|
||||
|
||||
try {
|
||||
$con = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $destConLang );
|
||||
if (is_null( $con )) {
|
||||
$con = ContentPeer::retrieveByPK($ConCategory, $ConParent, $ConId, $destConLang);
|
||||
if (is_null($con)) {
|
||||
$con = new Content();
|
||||
}
|
||||
$con->setConCategory( $ConCategory );
|
||||
$con->setConParent( $ConParent );
|
||||
$con->setConId( $ConId );
|
||||
$con->setConLang( $destConLang );
|
||||
$con->setConValue( $ConValue );
|
||||
$con->setConCategory($ConCategory);
|
||||
$con->setConParent($ConParent);
|
||||
$con->setConId($ConId);
|
||||
$con->setConLang($destConLang);
|
||||
$con->setConValue($ConValue);
|
||||
if ($con->validate()) {
|
||||
$res = $con->save();
|
||||
}
|
||||
@@ -183,32 +183,32 @@ class Content extends BaseContent
|
||||
* @param string $ConValue
|
||||
* @return variant
|
||||
*/
|
||||
public static function addContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
public static function addContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
{
|
||||
try {
|
||||
if ($ConLang != 'en') {
|
||||
$baseLangContent = ContentPeer::retrieveByPk( $ConCategory, $ConParent, $ConId, 'en' );
|
||||
$baseLangContent = ContentPeer::retrieveByPk($ConCategory, $ConParent, $ConId, 'en');
|
||||
if ($baseLangContent === null) {
|
||||
Content::addContent( $ConCategory, $ConParent, $ConId, 'en', $ConValue );
|
||||
Content::addContent($ConCategory, $ConParent, $ConId, 'en', $ConValue);
|
||||
}
|
||||
}
|
||||
|
||||
$con = ContentPeer::retrieveByPK( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
$con = ContentPeer::retrieveByPK($ConCategory, $ConParent, $ConId, $ConLang);
|
||||
|
||||
if (is_null( $con )) {
|
||||
if (is_null($con)) {
|
||||
$con = new Content();
|
||||
$con->setConCategory( $ConCategory );
|
||||
$con->setConCategory($ConCategory);
|
||||
if ($con->getConParent() != $ConParent) {
|
||||
$con->setConParent( $ConParent );
|
||||
$con->setConParent($ConParent);
|
||||
}
|
||||
$con->setConId( $ConId );
|
||||
$con->setConLang( $ConLang );
|
||||
$con->setConValue( $ConValue );
|
||||
$con->setConId($ConId);
|
||||
$con->setConLang($ConLang);
|
||||
$con->setConValue($ConValue);
|
||||
if ($con->validate()) {
|
||||
$res = $con->save();
|
||||
return $res;
|
||||
} else {
|
||||
$e = new Exception( "Error in addcontent, the row $ConCategory, $ConParent, $ConId, $ConLang is not Valid" );
|
||||
$e = new Exception("Error in addcontent, the row $ConCategory, $ConParent, $ConId, $ConLang is not Valid");
|
||||
throw ($e);
|
||||
}
|
||||
} else {
|
||||
@@ -216,7 +216,7 @@ class Content extends BaseContent
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Content::updateEqualValue( $ConCategory, $ConParent, $ConId, $ConValue );
|
||||
Content::updateEqualValue($ConCategory, $ConParent, $ConId, $ConValue);
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
@@ -232,20 +232,20 @@ class Content extends BaseContent
|
||||
* @param string $ConValue
|
||||
* @return variant
|
||||
*/
|
||||
public function insertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
public function insertContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
{
|
||||
try {
|
||||
$con = new Content();
|
||||
$con->setConCategory( $ConCategory );
|
||||
$con->setConParent( $ConParent );
|
||||
$con->setConId( $ConId );
|
||||
$con->setConLang( $ConLang );
|
||||
$con->setConValue( $ConValue );
|
||||
$con->setConCategory($ConCategory);
|
||||
$con->setConParent($ConParent);
|
||||
$con->setConId($ConId);
|
||||
$con->setConLang($ConLang);
|
||||
$con->setConValue($ConValue);
|
||||
if ($con->validate()) {
|
||||
$res = $con->save();
|
||||
return $res;
|
||||
} else {
|
||||
$e = new Exception( "Error in addcontent, the row $ConCategory, $ConParent, $ConId, $ConLang is not Valid" );
|
||||
$e = new Exception("Error in addcontent, the row $ConCategory, $ConParent, $ConId, $ConLang is not Valid");
|
||||
throw ($e);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
@@ -262,25 +262,24 @@ class Content extends BaseContent
|
||||
* @param string $ConValue
|
||||
* @return variant
|
||||
*/
|
||||
public static function removeContent ($ConCategory, $ConParent, $ConId)
|
||||
public static function removeContent($ConCategory, $ConParent, $ConId)
|
||||
{
|
||||
try {
|
||||
$c = new Criteria();
|
||||
$c->add( ContentPeer::CON_CATEGORY, $ConCategory );
|
||||
$c->add( ContentPeer::CON_PARENT, $ConParent );
|
||||
$c->add( ContentPeer::CON_ID, $ConId );
|
||||
$result = ContentPeer::doSelectRS( $c );
|
||||
$c->add(ContentPeer::CON_CATEGORY, $ConCategory);
|
||||
$c->add(ContentPeer::CON_PARENT, $ConParent);
|
||||
$c->add(ContentPeer::CON_ID, $ConId);
|
||||
$result = ContentPeer::doSelectRS($c);
|
||||
$result->next();
|
||||
$row = $result->getRow();
|
||||
while (is_array( $row )) {
|
||||
ContentPeer::doDelete( array ($ConCategory,$ConParent,$ConId,$row[3]) );
|
||||
while (is_array($row)) {
|
||||
ContentPeer::doDelete(array($ConCategory,$ConParent,$ConId,$row[3]));
|
||||
$result->next();
|
||||
$row = $result->getRow();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -293,11 +292,11 @@ class Content extends BaseContent
|
||||
* @param string $ConValue
|
||||
* @return boolean true or false
|
||||
*/
|
||||
public function Exists ($ConCategory, $ConParent, $ConId, $ConLang)
|
||||
public function Exists($ConCategory, $ConParent, $ConId, $ConLang)
|
||||
{
|
||||
try {
|
||||
$oPro = ContentPeer::retrieveByPk( $ConCategory, $ConParent, $ConId, $ConLang );
|
||||
if (is_object( $oPro ) && get_class( $oPro ) == 'Content') {
|
||||
$oPro = ContentPeer::retrieveByPk($ConCategory, $ConParent, $ConId, $ConLang);
|
||||
if (is_object($oPro) && get_class($oPro) == 'Content') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -318,14 +317,14 @@ class Content extends BaseContent
|
||||
$workSpace = config("system.workspace");
|
||||
}
|
||||
//Search the language
|
||||
$key = array_search( 'en', $langs );
|
||||
$key = array_search('en', $langs);
|
||||
if ($key === false) {
|
||||
$key = array_search( SYS_LANG, $langs );
|
||||
$key = array_search(SYS_LANG, $langs);
|
||||
if ($key === false) {
|
||||
$key = '0';
|
||||
}
|
||||
}
|
||||
$this->langsAsoc = array ();
|
||||
$this->langsAsoc = [];
|
||||
foreach ($langs as $key => $value) {
|
||||
$this->langsAsoc[$value] = $value;
|
||||
}
|
||||
@@ -337,26 +336,25 @@ class Content extends BaseContent
|
||||
$this->rowsClustered = 0;
|
||||
|
||||
//Creating table CONTENT_BACKUP
|
||||
$connection = Propel::getConnection( 'workflow' );
|
||||
$oStatement = $connection->prepareStatement( "CREATE TABLE IF NOT EXISTS `CONTENT_BACKUP` (
|
||||
$connection = Propel::getConnection('workflow');
|
||||
$oStatement = $connection->prepareStatement("CREATE TABLE IF NOT EXISTS `CONTENT_BACKUP` (
|
||||
`CON_CATEGORY` VARCHAR(30) default '' NOT NULL,
|
||||
`CON_PARENT` VARCHAR(32) default '' NOT NULL,
|
||||
`CON_ID` VARCHAR(100) default '' NOT NULL,
|
||||
`CON_LANG` VARCHAR(10) default '' NOT NULL,
|
||||
`CON_VALUE` MEDIUMTEXT NOT NULL,
|
||||
CONSTRAINT CONTENT_BACKUP_PK PRIMARY KEY (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG)
|
||||
)Engine=InnoDB DEFAULT CHARSET='utf8' COMMENT='Table for add content';" );
|
||||
)Engine=InnoDB DEFAULT CHARSET='utf8' COMMENT='Table for add content';");
|
||||
$oStatement->executeQuery();
|
||||
|
||||
$sql = " SELECT DISTINCT CON_LANG
|
||||
FROM CONTENT ";
|
||||
$sql = ' SELECT DISTINCT CON_LANG FROM CONTENT ';
|
||||
$stmt = $connection->createStatement();
|
||||
$rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC );
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
$language = $row['CON_LANG'];
|
||||
if (array_search( $row['CON_LANG'], $langs ) === false) {
|
||||
Content::removeLanguageContent( $row['CON_LANG'] );
|
||||
if (array_search($row['CON_LANG'], $langs) === false) {
|
||||
Content::removeLanguageContent($row['CON_LANG']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,126 +362,127 @@ class Content extends BaseContent
|
||||
FROM CONTENT
|
||||
ORDER BY CON_ID, CON_CATEGORY, CON_PARENT, CON_LANG";
|
||||
|
||||
$workSpace = new WorkspaceTools( $workSpace );
|
||||
$workSpace = new WorkspaceTools($workSpace);
|
||||
$workSpace->getDBInfo();
|
||||
|
||||
$link = @mysql_pconnect( $workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass) or die( "Could not connect" );
|
||||
$mysqli = new mysqli($workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass, $workSpace->dbName) or die("Could not connect");
|
||||
|
||||
mysql_select_db( $workSpace->dbName, $link );
|
||||
mysql_query( "SET NAMES 'utf8';" );
|
||||
mysql_query( "SET FOREIGN_KEY_CHECKS=0;" );
|
||||
mysql_query( 'SET OPTION SQL_BIG_SELECTS=1' );
|
||||
$result = mysql_unbuffered_query( $sql, $link );
|
||||
$list = array ();
|
||||
$default = array ();
|
||||
$sw = array ('CON_ID' => '','CON_CATEGORY' => '','CON_PARENT' => ''
|
||||
$mysqli->query( 'SET NAMES "utf8";');
|
||||
$mysqli->query( 'SET FOREIGN_KEY_CHECKS=0;');
|
||||
$mysqli->query( 'SET OPTION SQL_BIG_SELECTS=1');
|
||||
$result = $mysqli->query( $sql, MYSQLI_USE_RESULT);
|
||||
$list = [];
|
||||
$default = [];
|
||||
$sw = array('CON_ID' => '','CON_CATEGORY' => '','CON_PARENT' => ''
|
||||
);
|
||||
while ($row = mysql_fetch_assoc( $result )) {
|
||||
if ($sw['CON_ID'] == $row['CON_ID'] && $sw['CON_CATEGORY'] == $row['CON_CATEGORY'] && $sw['CON_PARENT'] == $row['CON_PARENT']) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
if ($sw['CON_ID'] === $row['CON_ID'] && $sw['CON_CATEGORY'] === $row['CON_CATEGORY'] && $sw['CON_PARENT'] === $row['CON_PARENT']) {
|
||||
$list[] = $row;
|
||||
} else {
|
||||
$this->rowsClustered ++;
|
||||
if (count( $langs ) != count( $list )) {
|
||||
$this->checkLanguage( $list, $default );
|
||||
if (count($langs) !== count($list)) {
|
||||
$this->checkLanguage($list, $default);
|
||||
} else {
|
||||
$this->rowsUnchanged = $this->rowsUnchanged + count( $langs );
|
||||
$this->rowsUnchanged += count($langs);
|
||||
}
|
||||
$sw = array ();
|
||||
$sw = [];
|
||||
$sw['CON_ID'] = $row['CON_ID'];
|
||||
$sw['CON_CATEGORY'] = $row['CON_CATEGORY'];
|
||||
$sw['CON_LANG'] = $row['CON_LANG'];
|
||||
$sw['CON_PARENT'] = $row['CON_PARENT'];
|
||||
unset( $list );
|
||||
unset( $default );
|
||||
$list = array ();
|
||||
$default = array ();
|
||||
unset($list);
|
||||
unset($default);
|
||||
$list = [];
|
||||
$default = [];
|
||||
$list[] = $row;
|
||||
}
|
||||
if ($sw['CON_LANG'] == $langs[$key]) {
|
||||
if ($sw['CON_LANG'] === $langs[$key]) {
|
||||
$default = $row;
|
||||
}
|
||||
$this->rowsProcessed ++;
|
||||
}
|
||||
if (count( $langs ) != count( $list )) {
|
||||
$this->checkLanguage( $list, $default );
|
||||
if (count($langs) !== count($list)) {
|
||||
$this->checkLanguage($list, $default);
|
||||
} else {
|
||||
$this->rowsUnchanged = $this->rowsUnchanged + count( $langs );
|
||||
$this->rowsUnchanged += count($langs);
|
||||
}
|
||||
mysql_free_result( $result );
|
||||
mysqli_free_result($result);
|
||||
$total = $this->rowsProcessed + $this->rowsInserted;
|
||||
|
||||
$statement = $connection->prepareStatement( "REPLACE INTO CONTENT
|
||||
$result->close();
|
||||
|
||||
$statement = $connection->prepareStatement("REPLACE INTO CONTENT
|
||||
SELECT CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE
|
||||
FROM CONTENT_BACKUP" );
|
||||
FROM CONTENT_BACKUP");
|
||||
$statement->executeQuery();
|
||||
|
||||
$statement = $connection->prepareStatement( "DROP TABLE CONTENT_BACKUP" );
|
||||
$statement = $connection->prepareStatement("DROP TABLE CONTENT_BACKUP");
|
||||
$statement->executeQuery();
|
||||
|
||||
//close connection
|
||||
$sql = "SELECT * FROM information_schema.processlist WHERE command = 'Sleep' and user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() ORDER BY id;";
|
||||
$stmt = $connection->createStatement();
|
||||
$rs = $stmt->executeQuery( $sql, ResultSet::FETCHMODE_ASSOC );
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
$oStatement = $connection->prepareStatement( "kill ". $row['ID'] );
|
||||
$oStatement = $connection->prepareStatement("kill ". $row['ID']);
|
||||
$oStatement->executeQuery();
|
||||
}
|
||||
|
||||
if (! isset( $_SERVER['SERVER_NAME'] )) {
|
||||
CLI::logging( "Rows Processed ---> $this->rowsProcessed ..... \n" );
|
||||
CLI::logging( "Rows Clustered ---> $this->rowsClustered ..... \n" );
|
||||
CLI::logging( "Rows Unchanged ---> $this->rowsUnchanged ..... \n" );
|
||||
CLI::logging( "Rows Inserted ---> $this->rowsInserted ..... \n" );
|
||||
CLI::logging( "Rows Total ---> $total ..... \n" );
|
||||
if (! isset($_SERVER['SERVER_NAME'])) {
|
||||
CLI::logging("Rows Processed ---> $this->rowsProcessed ..... \n");
|
||||
CLI::logging("Rows Clustered ---> $this->rowsClustered ..... \n");
|
||||
CLI::logging("Rows Unchanged ---> $this->rowsUnchanged ..... \n");
|
||||
CLI::logging("Rows Inserted ---> $this->rowsInserted ..... \n");
|
||||
CLI::logging("Rows Total ---> $total ..... \n");
|
||||
}
|
||||
}
|
||||
|
||||
public function checkLanguage ($content, $default)
|
||||
public function checkLanguage($content, $default)
|
||||
{
|
||||
if (count( $content ) > 0) {
|
||||
if (count($content) > 0) {
|
||||
$langs = $this->langs;
|
||||
$langsAsoc = $this->langsAsoc;
|
||||
//Element default
|
||||
$default = (count( $default ) > 0) ? $default : $content[0];
|
||||
$default = (count($default) > 0) ? $default : $content[0];
|
||||
foreach ($content as $key => $value) {
|
||||
unset( $langsAsoc[$value['CON_LANG']] );
|
||||
unset($langsAsoc[$value['CON_LANG']]);
|
||||
}
|
||||
foreach ($langsAsoc as $key => $value) {
|
||||
$this->rowsInserted ++;
|
||||
$this->fastInsertContent( $default['CON_CATEGORY'], $default['CON_PARENT'], $default['CON_ID'], $value, $default['CON_VALUE'] );
|
||||
$this->fastInsertContent($default['CON_CATEGORY'], $default['CON_PARENT'], $default['CON_ID'], $value, $default['CON_VALUE']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function fastInsertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
public function fastInsertContent($ConCategory, $ConParent, $ConId, $ConLang, $ConValue)
|
||||
{
|
||||
$ConValue = mysql_real_escape_string( $ConValue );
|
||||
$connection = Propel::getConnection( 'workflow' );
|
||||
$statement = $connection->prepareStatement( "INSERT INTO CONTENT_BACKUP (
|
||||
$connection = Propel::getConnection('workflow');
|
||||
$ConValue = mysqli_real_escape_string($connection, $ConValue);
|
||||
$statement = $connection->prepareStatement("INSERT INTO CONTENT_BACKUP (
|
||||
CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE)
|
||||
VALUES ('$ConCategory', '$ConParent', '$ConId', '$ConLang', '$ConValue');" );
|
||||
VALUES ('$ConCategory', '$ConParent', '$ConId', '$ConLang', '$ConValue');");
|
||||
$statement->executeQuery();
|
||||
}
|
||||
|
||||
public function removeLanguageContent ($lanId)
|
||||
public function removeLanguageContent($lanId)
|
||||
{
|
||||
try {
|
||||
$c = new Criteria();
|
||||
$c->addSelectColumn( ContentPeer::CON_CATEGORY );
|
||||
$c->addSelectColumn( ContentPeer::CON_PARENT );
|
||||
$c->addSelectColumn( ContentPeer::CON_ID );
|
||||
$c->addSelectColumn( ContentPeer::CON_LANG );
|
||||
$c->addSelectColumn(ContentPeer::CON_CATEGORY);
|
||||
$c->addSelectColumn(ContentPeer::CON_PARENT);
|
||||
$c->addSelectColumn(ContentPeer::CON_ID);
|
||||
$c->addSelectColumn(ContentPeer::CON_LANG);
|
||||
|
||||
$c->add( ContentPeer::CON_LANG, $lanId );
|
||||
$c->add(ContentPeer::CON_LANG, $lanId);
|
||||
|
||||
$result = ContentPeer::doSelectRS( $c );
|
||||
$result->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$result = ContentPeer::doSelectRS($c);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
$row = $result->getRow();
|
||||
|
||||
while (is_array( $row )) {
|
||||
$content = ContentPeer::retrieveByPK( $row['CON_CATEGORY'], $row['CON_PARENT'], $row['CON_ID'], $lanId );
|
||||
while (is_array($row)) {
|
||||
$content = ContentPeer::retrieveByPK($row['CON_CATEGORY'], $row['CON_PARENT'], $row['CON_ID'], $lanId);
|
||||
|
||||
if ($content !== null) {
|
||||
$content->delete();
|
||||
@@ -491,29 +490,32 @@ class Content extends BaseContent
|
||||
$result->next();
|
||||
$row = $result->getRow();
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
}
|
||||
|
||||
//Added by Enrique at Feb 9th,2011
|
||||
//Gets all Role Names by Role
|
||||
public function getAllContentsByRole ($sys_lang = SYS_LANG)
|
||||
/**
|
||||
* Gets all Role Names by Role
|
||||
*
|
||||
* @param string $sys_lang language
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAllContentsByRole($sys_lang = SYS_LANG)
|
||||
{
|
||||
if (! isset( $sys_lang )) {
|
||||
if (! isset($sys_lang)) {
|
||||
$sys_lang = 'en';
|
||||
}
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->clearSelectColumns();
|
||||
$oCriteria->addSelectColumn( ContentPeer::CON_ID );
|
||||
$oCriteria->addAsColumn( 'ROL_NAME', ContentPeer::CON_VALUE );
|
||||
//$oCriteria->addAsColumn('ROL_UID', ContentPeer::CON_ID);
|
||||
$oCriteria->add( ContentPeer::CON_CATEGORY, 'ROL_NAME' );
|
||||
$oCriteria->add( ContentPeer::CON_LANG, $sys_lang );
|
||||
$oDataset = ContentPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$aRoles = Array ();
|
||||
$oCriteria->addSelectColumn(ContentPeer::CON_ID);
|
||||
$oCriteria->addAsColumn('ROL_NAME', ContentPeer::CON_VALUE);
|
||||
$oCriteria->add(ContentPeer::CON_CATEGORY, 'ROL_NAME');
|
||||
$oCriteria->add(ContentPeer::CON_LANG, $sys_lang);
|
||||
$oDataset = ContentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$aRoles = [];
|
||||
while ($oDataset->next()) {
|
||||
$xRow = $oDataset->getRow();
|
||||
$aRoles[$xRow['CON_ID']] = $xRow['ROL_NAME'];
|
||||
@@ -521,4 +523,3 @@ class Content extends BaseContent
|
||||
return $aRoles;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseDashboardIndicator.php';
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'DASHBOARD_INDICATOR' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
@@ -16,68 +16,75 @@ require_once 'classes/model/om/BaseDashboardIndicator.php';
|
||||
*/
|
||||
class DashboardIndicator extends BaseDashboardIndicator
|
||||
{
|
||||
public function load ($dasIndUid)
|
||||
public function load($dasIndUid)
|
||||
{
|
||||
try {
|
||||
$dashboardIndicator = DashboardIndicatorPeer::retrieveByPK($dasIndUid);
|
||||
$fields = $dashboardIndicator->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$dashboardIndicator->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
||||
$dashboardIndicator->fromArray($fields, BasePeer::TYPE_FIELDNAME);
|
||||
return $fields;
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
function loadbyDasUid ($dasUid, $vcompareDate, $vmeasureDate, $userUid)
|
||||
{
|
||||
|
||||
public function loadbyDasUid($dasUid, $vcompareDate, $vmeasureDate, $userUid)
|
||||
{
|
||||
$calculator = new \IndicatorsCalculator();
|
||||
|
||||
try {
|
||||
$connection = Propel::getConnection('workflow');
|
||||
$qryString = "select * from CONFIGURATION where CFG_UID = 'DASHBOARDS_SETTINGS' and USR_UID = '$userUid'";
|
||||
$qry = $connection->PrepareStatement($qryString);
|
||||
$dataSet = $qry->executeQuery();
|
||||
$dashConfig = array();
|
||||
while ($dataSet->next()) {
|
||||
$row = $dataSet->getRow();
|
||||
$dashConfig = unserialize($row['CFG_VALUE']);
|
||||
}
|
||||
|
||||
$connection = Propel::getConnection('workflow');
|
||||
$qryString = "select * from CONFIGURATION where CFG_UID = 'DASHBOARDS_SETTINGS' and USR_UID = '$userUid'";
|
||||
$qry = $connection->PrepareStatement($qryString);
|
||||
$dataSet = $qry->executeQuery();
|
||||
$dashConfig = array();
|
||||
while ($dataSet->next()){
|
||||
$row = $dataSet->getRow();
|
||||
$dashConfig = unserialize($row['CFG_VALUE']);
|
||||
}
|
||||
|
||||
$criteria = new Criteria( 'workflow' );
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
|
||||
$criteria->add( DashboardIndicatorPeer::DAS_UID, $dasUid, criteria::EQUAL );
|
||||
$criteria->add(DashboardIndicatorPeer::DAS_UID, $dasUid, criteria::EQUAL);
|
||||
|
||||
$rs = DashboardIndicatorPeer::doSelectRS( $criteria );
|
||||
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$rs = DashboardIndicatorPeer::doSelectRS($criteria);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dashboardIndicator = array();
|
||||
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
|
||||
//$currentDate = new DateTime (date("Y-m-d"));
|
||||
$measureDate = new DateTime ($vmeasureDate);
|
||||
$compareDate = new DateTime ($vcompareDate);
|
||||
$uid = ($row['DAS_UID_PROCESS'] == '0' ? null: $row['DAS_UID_PROCESS']) ;
|
||||
switch ($row['DAS_IND_TYPE']) {
|
||||
case '1010':
|
||||
$value = current(reset($calculator->peiHistoric($uid, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$oldValue = current(reset($calculator->peiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$row['DAS_IND_VARIATION'] = $value - $oldValue;
|
||||
$row['DAS_IND_OLD_VALUE'] = $oldValue;
|
||||
$row['DAS_IND_PERCENT_VARIATION'] = $oldValue != 0
|
||||
? round(($value - $oldValue) * 100 / $oldValue)
|
||||
: "--";
|
||||
break;
|
||||
case '1030':
|
||||
$value = current(reset($calculator->ueiHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$oldValue = current(reset($calculator->ueiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$row['DAS_IND_VARIATION'] = $value - $oldValue;
|
||||
$row['DAS_IND_OLD_VALUE'] = $oldValue;
|
||||
$row['DAS_IND_PERCENT_VARIATION'] = $oldValue != 0
|
||||
? round(($value - $oldValue) * 100 / $oldValue)
|
||||
: "--";
|
||||
break;
|
||||
$measureDate = new DateTime($vmeasureDate);
|
||||
$compareDate = new DateTime($vcompareDate);
|
||||
$uid = ($row['DAS_UID_PROCESS'] == '0' ? null : $row['DAS_UID_PROCESS']);
|
||||
switch ($row['DAS_IND_TYPE']) {
|
||||
case '1010':
|
||||
$value = $calculator->peiHistoric($uid, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$value = reset($value);
|
||||
$value = current($value);
|
||||
$oldValue = $calculator->peiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE);
|
||||
$oldValue = reset($oldValue);
|
||||
$oldValue = current($oldValue);
|
||||
$row['DAS_IND_VARIATION'] = $value - $oldValue;
|
||||
$row['DAS_IND_OLD_VALUE'] = $oldValue;
|
||||
$row['DAS_IND_PERCENT_VARIATION'] = $oldValue != 0
|
||||
? round(($value - $oldValue) * 100 / $oldValue)
|
||||
: "--";
|
||||
break;
|
||||
case '1030':
|
||||
$value = $calculator->ueiHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$value = reset($value);
|
||||
$value = current($value);
|
||||
$oldValue = $calculator->ueiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE);
|
||||
$oldValue = reset($oldValue);
|
||||
$oldValue = current($oldValue);
|
||||
$row['DAS_IND_VARIATION'] = $value - $oldValue;
|
||||
$row['DAS_IND_OLD_VALUE'] = $oldValue;
|
||||
$row['DAS_IND_PERCENT_VARIATION'] = $oldValue != 0
|
||||
? round(($value - $oldValue) * 100 / $oldValue)
|
||||
: "--";
|
||||
break;
|
||||
case '1050':
|
||||
$value = $calculator->statusIndicatorGeneral($userUid);
|
||||
$row['OVERDUE'] = 0;
|
||||
@@ -94,41 +101,41 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
|
||||
$total = $row['OVERDUE'] + $row['AT_RISK'] + $row['ON_TIME'];
|
||||
if ($total != 0) {
|
||||
$row['PERCENTAGE_OVERDUE'] = ($row['OVERDUE']*100)/$total;
|
||||
$row['PERCENTAGE_AT_RISK'] = ($row['AT_RISK']*100)/$total;
|
||||
$row['PERCENTAGE_ON_TIME'] = ($row['ON_TIME']*100)/$total;
|
||||
$row['PERCENTAGE_OVERDUE'] = ($row['OVERDUE'] * 100) / $total;
|
||||
$row['PERCENTAGE_AT_RISK'] = ($row['AT_RISK'] * 100) / $total;
|
||||
$row['PERCENTAGE_ON_TIME'] = ($row['ON_TIME'] * 100) / $total;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$arrResult = $calculator->generalIndicatorData($row['DAS_IND_UID'], $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$value = $arrResult[0]['value'];
|
||||
$row['DAS_IND_VARIATION'] = $row['DAS_IND_GOAL'];
|
||||
break;
|
||||
}
|
||||
$row['DAS_IND_VALUE'] = $value;
|
||||
default:
|
||||
$arrResult = $calculator->generalIndicatorData($row['DAS_IND_UID'], $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$value = $arrResult[0]['value'];
|
||||
$row['DAS_IND_VARIATION'] = $row['DAS_IND_GOAL'];
|
||||
break;
|
||||
}
|
||||
$row['DAS_IND_VALUE'] = $value;
|
||||
|
||||
$indId = $row['DAS_IND_UID'];
|
||||
$row['DAS_IND_X'] = 0;
|
||||
$row['DAS_IND_Y'] = 0;
|
||||
$row['DAS_IND_WIDTH'] = 0;
|
||||
$row['DAS_IND_HEIGHT'] = 0;
|
||||
$row['DAS_IND_FAVORITE'] = 0;
|
||||
|
||||
foreach ($dashConfig as $dashId=>$oneDash) {
|
||||
if($dashId == $dasUid && is_array($oneDash['dashData'])) {
|
||||
foreach($oneDash['dashData'] as $graphConfig) {
|
||||
if ($graphConfig['indicatorId'] == $indId) {
|
||||
$row['DAS_IND_X'] = $graphConfig['x'];
|
||||
$row['DAS_IND_Y'] = $graphConfig['y'];
|
||||
$row['DAS_IND_WIDTH'] = $graphConfig['width'];
|
||||
$row['DAS_IND_HEIGHT'] = $graphConfig['height'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$indId = $row['DAS_IND_UID'];
|
||||
$row['DAS_IND_X'] = 0;
|
||||
$row['DAS_IND_Y'] = 0;
|
||||
$row['DAS_IND_WIDTH'] = 0;
|
||||
$row['DAS_IND_HEIGHT'] = 0;
|
||||
$row['DAS_IND_FAVORITE'] = 0;
|
||||
|
||||
$dashboardIndicator[] = $row;
|
||||
foreach ($dashConfig as $dashId => $oneDash) {
|
||||
if ($dashId == $dasUid && is_array($oneDash['dashData'])) {
|
||||
foreach ($oneDash['dashData'] as $graphConfig) {
|
||||
if ($graphConfig['indicatorId'] == $indId) {
|
||||
$row['DAS_IND_X'] = $graphConfig['x'];
|
||||
$row['DAS_IND_Y'] = $graphConfig['y'];
|
||||
$row['DAS_IND_WIDTH'] = $graphConfig['width'];
|
||||
$row['DAS_IND_HEIGHT'] = $graphConfig['height'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dashboardIndicator[] = $row;
|
||||
}
|
||||
return $dashboardIndicator;
|
||||
} catch (Exception $error) {
|
||||
@@ -137,7 +144,6 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function createOrUpdate($data)
|
||||
{
|
||||
$connection = Propel::getConnection(DashboardIndicatorPeer::DATABASE_NAME);
|
||||
@@ -158,10 +164,10 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
$result = $dashboardIndicator->save();
|
||||
$connection->commit();
|
||||
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||
$this->setUser($data['USR_UID']);
|
||||
}
|
||||
G::auditLog($msg, "Dashboard Indicator Name: ".$dashboardIndicator->getDasIndTitle()." Dashboard indicator ID: (".$dashboardIndicator->getDasIndUid() .") ");
|
||||
G::auditLog($msg, "Dashboard Indicator Name: " . $dashboardIndicator->getDasIndTitle() . " Dashboard indicator ID: (" . $dashboardIndicator->getDasIndUid() . ") ");
|
||||
return $dashboardIndicator->getDasIndUid();
|
||||
} else {
|
||||
$message = '';
|
||||
@@ -177,7 +183,7 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
}
|
||||
}
|
||||
|
||||
public function remove($dasIndUid, $userLogged ='')
|
||||
public function remove($dasIndUid, $userLogged = '')
|
||||
{
|
||||
$connection = Propel::getConnection(DashboardIndicatorPeer::DATABASE_NAME);
|
||||
try {
|
||||
@@ -191,10 +197,10 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && $userLogged != '') {
|
||||
$this->setUser($userLogged);
|
||||
}
|
||||
G::auditLog("Delete", "Dashboard Indicator Name: ". $dashboardIndicatorData['DAS_IND_TITLE']." Dashboard Instance ID: (".$dasIndUid.") ");
|
||||
G::auditLog("Delete", "Dashboard Indicator Name: " . $dashboardIndicatorData['DAS_IND_TITLE'] . " Dashboard Instance ID: (" . $dasIndUid . ") ");
|
||||
return $result;
|
||||
} else {
|
||||
throw new Exception('Error trying to delete: The row "' . $dasIndUid. '" does not exist.');
|
||||
throw new Exception('Error trying to delete: The row "' . $dasIndUid . '" does not exist.');
|
||||
}
|
||||
} catch (Exception $error) {
|
||||
$connection->rollback();
|
||||
@@ -202,11 +208,11 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
}
|
||||
}
|
||||
|
||||
public function setUser($usrId) {
|
||||
$user = new Users ();
|
||||
public function setUser($usrId)
|
||||
{
|
||||
$user = new Users();
|
||||
$user = $user->loadDetails($usrId);
|
||||
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
|
||||
$_SESSION['USR_FULLNAME'] = $user['USR_FULLNAME'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -264,7 +264,7 @@ class Route extends BaseRoute
|
||||
$c->add(RoutePeer::ROU_NEXT_TASK, $aData['ROU_NEXT_TASK'], Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$query =$c->toString();
|
||||
$query = $c->toString();
|
||||
$rs = RoutePeer::doSelectRS($c);
|
||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$routes = array();
|
||||
|
||||
@@ -24,41 +24,41 @@ class UsersProperties extends BaseUsersProperties
|
||||
public $usrID = '';
|
||||
public $lang = 'en';
|
||||
|
||||
public function __construct ()
|
||||
public function __construct()
|
||||
{
|
||||
$this->lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
|
||||
$this->lang = defined('SYS_LANG') ? SYS_LANG : 'en';
|
||||
}
|
||||
|
||||
public function UserPropertyExists ($sUserUID)
|
||||
public function UserPropertyExists($sUserUID)
|
||||
{
|
||||
$oUserProperty = UsersPropertiesPeer::retrieveByPk( $sUserUID );
|
||||
if (! is_null( $oUserProperty ) && is_object( $oUserProperty ) && get_class( $oUserProperty ) == 'UsersProperties') {
|
||||
$this->fields = $oUserProperty->toArray( BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray( $this->fields, BasePeer::TYPE_FIELDNAME );
|
||||
$oUserProperty = UsersPropertiesPeer::retrieveByPk($sUserUID);
|
||||
if (! is_null($oUserProperty) && is_object($oUserProperty) && get_class($oUserProperty) == 'UsersProperties') {
|
||||
$this->fields = $oUserProperty->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($this->fields, BasePeer::TYPE_FIELDNAME);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function load ($sUserUID)
|
||||
public function load($sUserUID)
|
||||
{
|
||||
$oUserProperty = UsersPropertiesPeer::retrieveByPK( $sUserUID );
|
||||
if (! is_null( $oUserProperty )) {
|
||||
$aFields = $oUserProperty->toArray( BasePeer::TYPE_FIELDNAME );
|
||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||
$oUserProperty = UsersPropertiesPeer::retrieveByPK($sUserUID);
|
||||
if (! is_null($oUserProperty)) {
|
||||
$aFields = $oUserProperty->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||
return $aFields;
|
||||
} else {
|
||||
throw new Exception( "User with $sUserUID does not exist!" );
|
||||
throw new Exception("User with $sUserUID does not exist!");
|
||||
}
|
||||
}
|
||||
|
||||
public function create ($aData)
|
||||
public function create($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( UsersPropertiesPeer::DATABASE_NAME );
|
||||
$oConnection = Propel::getConnection(UsersPropertiesPeer::DATABASE_NAME);
|
||||
try {
|
||||
$oUserProperty = new UsersProperties();
|
||||
$oUserProperty->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
$oUserProperty->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||
if ($oUserProperty->validate()) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oUserProperty->save();
|
||||
@@ -70,7 +70,7 @@ class UsersProperties extends BaseUsersProperties
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||
}
|
||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||
throw (new Exception('The registry cannot be created!<br />' . $sMessage));
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
@@ -78,13 +78,13 @@ class UsersProperties extends BaseUsersProperties
|
||||
}
|
||||
}
|
||||
|
||||
public function update ($aData)
|
||||
public function update($aData)
|
||||
{
|
||||
$oConnection = Propel::getConnection( UsersPropertiesPeer::DATABASE_NAME );
|
||||
$oConnection = Propel::getConnection(UsersPropertiesPeer::DATABASE_NAME);
|
||||
try {
|
||||
$oUserProperty = UsersPropertiesPeer::retrieveByPK( $aData['USR_UID'] );
|
||||
if (! is_null( $oUserProperty )) {
|
||||
$oUserProperty->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||
$oUserProperty = UsersPropertiesPeer::retrieveByPK($aData['USR_UID']);
|
||||
if (! is_null($oUserProperty)) {
|
||||
$oUserProperty->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||
if ($oUserProperty->validate()) {
|
||||
$oConnection->begin();
|
||||
$iResult = $oUserProperty->save();
|
||||
@@ -96,10 +96,10 @@ class UsersProperties extends BaseUsersProperties
|
||||
foreach ($aValidationFailures as $oValidationFailure) {
|
||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||
}
|
||||
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||
throw (new Exception('The registry cannot be updated!<br />' . $sMessage));
|
||||
}
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
throw (new Exception('This row doesn\'t exist!'));
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
$oConnection->rollback();
|
||||
@@ -107,17 +107,17 @@ class UsersProperties extends BaseUsersProperties
|
||||
}
|
||||
}
|
||||
|
||||
public function loadOrCreateIfNotExists ($sUserUID, $aUserProperty = array())
|
||||
public function loadOrCreateIfNotExists($sUserUID, $aUserProperty = array())
|
||||
{
|
||||
if (! $this->UserPropertyExists( $sUserUID )) {
|
||||
if (! $this->UserPropertyExists($sUserUID)) {
|
||||
$aUserProperty['USR_UID'] = $sUserUID;
|
||||
if (! isset( $aUserProperty['USR_LAST_UPDATE_DATE'] )) {
|
||||
$aUserProperty['USR_LAST_UPDATE_DATE'] = date( 'Y-m-d H:i:s' );
|
||||
if (! isset($aUserProperty['USR_LAST_UPDATE_DATE'])) {
|
||||
$aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
if (! isset( $aUserProperty['USR_LOGGED_NEXT_TIME'] )) {
|
||||
if (! isset($aUserProperty['USR_LOGGED_NEXT_TIME'])) {
|
||||
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 0;
|
||||
}
|
||||
$this->create( $aUserProperty );
|
||||
$this->create($aUserProperty);
|
||||
} else {
|
||||
$aUserProperty = $this->fields;
|
||||
}
|
||||
@@ -125,32 +125,32 @@ class UsersProperties extends BaseUsersProperties
|
||||
return $aUserProperty;
|
||||
}
|
||||
|
||||
public function validatePassword ($sPassword, $sLastUpdate, $iChangePasswordNextTime, $nowLogin = false)
|
||||
public function validatePassword($sPassword, $sLastUpdate, $iChangePasswordNextTime, $nowLogin = false)
|
||||
{
|
||||
if (! defined( 'PPP_MINIMUM_LENGTH' )) {
|
||||
define( 'PPP_MINIMUM_LENGTH', 5 );
|
||||
if (! defined('PPP_MINIMUM_LENGTH')) {
|
||||
define('PPP_MINIMUM_LENGTH', 5);
|
||||
}
|
||||
if (! defined( 'PPP_MAXIMUM_LENGTH' )) {
|
||||
define( 'PPP_MAXIMUM_LENGTH', 20 );
|
||||
if (! defined('PPP_MAXIMUM_LENGTH')) {
|
||||
define('PPP_MAXIMUM_LENGTH', 20);
|
||||
}
|
||||
if (! defined( 'PPP_NUMERICAL_CHARACTER_REQUIRED' )) {
|
||||
define( 'PPP_NUMERICAL_CHARACTER_REQUIRED', 0 );
|
||||
if (! defined('PPP_NUMERICAL_CHARACTER_REQUIRED')) {
|
||||
define('PPP_NUMERICAL_CHARACTER_REQUIRED', 0);
|
||||
}
|
||||
if (! defined( 'PPP_UPPERCASE_CHARACTER_REQUIRED' )) {
|
||||
define( 'PPP_UPPERCASE_CHARACTER_REQUIRED', 0 );
|
||||
if (! defined('PPP_UPPERCASE_CHARACTER_REQUIRED')) {
|
||||
define('PPP_UPPERCASE_CHARACTER_REQUIRED', 0);
|
||||
}
|
||||
if (! defined( 'PPP_SPECIAL_CHARACTER_REQUIRED' )) {
|
||||
define( 'PPP_SPECIAL_CHARACTER_REQUIRED', 0 );
|
||||
if (! defined('PPP_SPECIAL_CHARACTER_REQUIRED')) {
|
||||
define('PPP_SPECIAL_CHARACTER_REQUIRED', 0);
|
||||
}
|
||||
if (! defined( 'PPP_EXPIRATION_IN' )) {
|
||||
define( 'PPP_EXPIRATION_IN', 0 );
|
||||
if (! defined('PPP_EXPIRATION_IN')) {
|
||||
define('PPP_EXPIRATION_IN', 0);
|
||||
}
|
||||
if (function_exists( 'mb_strlen' )) {
|
||||
$iLength = mb_strlen( $sPassword );
|
||||
if (function_exists('mb_strlen')) {
|
||||
$iLength = mb_strlen($sPassword);
|
||||
} else {
|
||||
$iLength = strlen( $sPassword );
|
||||
$iLength = strlen($sPassword);
|
||||
}
|
||||
$aErrors = array ();
|
||||
$aErrors = array();
|
||||
if ($iLength < PPP_MINIMUM_LENGTH || $nowLogin) {
|
||||
$aErrors[] = 'ID_PPP_MINIMUM_LENGTH';
|
||||
}
|
||||
@@ -158,17 +158,17 @@ class UsersProperties extends BaseUsersProperties
|
||||
$aErrors[] = 'ID_PPP_MAXIMUM_LENGTH';
|
||||
}
|
||||
if (PPP_NUMERICAL_CHARACTER_REQUIRED == 1) {
|
||||
if (preg_match_all( '/[0-9]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ) == 0 || $nowLogin) {
|
||||
if (preg_match_all('/[0-9]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) {
|
||||
$aErrors[] = 'ID_PPP_NUMERICAL_CHARACTER_REQUIRED';
|
||||
}
|
||||
}
|
||||
if (PPP_UPPERCASE_CHARACTER_REQUIRED == 1) {
|
||||
if (preg_match_all( '/[A-Z]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ) == 0 || $nowLogin) {
|
||||
if (preg_match_all('/[A-Z]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) {
|
||||
$aErrors[] = 'ID_PPP_UPPERCASE_CHARACTER_REQUIRED';
|
||||
}
|
||||
}
|
||||
if (PPP_SPECIAL_CHARACTER_REQUIRED == 1) {
|
||||
if (preg_match_all( '/[<5B><>\\!|"@<40>#$~%<25>&<26>\/()=\'?<3F><>*+\-_.:,;]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ) == 0 || $nowLogin) {
|
||||
if (preg_match_all('/[<5B><>\\!|"@<40>#$~%<25>&<26>\/()=\'?<3F><>*+\-_.:,;]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) {
|
||||
$aErrors[] = 'ID_PPP_SPECIAL_CHARACTER_REQUIRED';
|
||||
}
|
||||
}
|
||||
@@ -176,11 +176,11 @@ class UsersProperties extends BaseUsersProperties
|
||||
$oCalendar = new Calendar();
|
||||
|
||||
if ($oCalendar->pmCalendarUid == '') {
|
||||
$oCalendar->pmCalendarUid = '00000000000000000000000000000001';
|
||||
$oCalendar->getCalendarData();
|
||||
$oCalendar->pmCalendarUid = '00000000000000000000000000000001';
|
||||
$oCalendar->getCalendarData();
|
||||
}
|
||||
|
||||
$fDays = $oCalendar->calculateDuration( date( 'Y-m-d H:i:s' ), $sLastUpdate );
|
||||
$fDays = $oCalendar->calculateDuration(date('Y-m-d H:i:s'), $sLastUpdate);
|
||||
if ($fDays > (PPP_EXPIRATION_IN * 24) || $nowLogin) {
|
||||
$aErrors[] = 'ID_PPP_EXPIRATION_IN';
|
||||
}
|
||||
@@ -195,24 +195,24 @@ class UsersProperties extends BaseUsersProperties
|
||||
* get user location
|
||||
* defined by precedence plugin->ux->default
|
||||
*/
|
||||
public function redirectTo ($usrID, $lang = '')
|
||||
public function redirectTo($usrID, $lang = '')
|
||||
{
|
||||
$this->usrID = $usrID;
|
||||
$this->lang = empty( $lang ) ? $this->lang : $lang;
|
||||
$this->lang = empty($lang) ? $this->lang : $lang;
|
||||
|
||||
$url = $this->_getPluginLocation();
|
||||
|
||||
if (empty( $url )) {
|
||||
if (empty($url)) {
|
||||
$url = $this->_getUXLocation();
|
||||
}
|
||||
|
||||
$urlUx = $this->_getUXSkinVariant();
|
||||
if (empty( $url ) && ! empty( $urlUx )) {
|
||||
if (empty($url) && ! empty($urlUx)) {
|
||||
$_SESSION['_defaultUserLocation'] = $url;
|
||||
$url = $urlUx;
|
||||
}
|
||||
|
||||
if (empty( $url )) {
|
||||
if (empty($url)) {
|
||||
$url = $this->_getDefaultLocation();
|
||||
}
|
||||
|
||||
@@ -224,19 +224,19 @@ class UsersProperties extends BaseUsersProperties
|
||||
* defined by precedence plugin->default
|
||||
* note that is getting location without User Inbox Simplified varification
|
||||
*/
|
||||
public function getUserLocation ($usrID, $lang = 'en')
|
||||
public function getUserLocation($usrID, $lang = 'en')
|
||||
{
|
||||
$this->usrID = $usrID;
|
||||
$this->lang = empty( $lang ) ? $this->lang : $lang;
|
||||
$this->lang = empty($lang) ? $this->lang : $lang;
|
||||
|
||||
$url = $this->_getPluginLocation();
|
||||
|
||||
if (empty( $url )) {
|
||||
if (empty($url)) {
|
||||
$url = $this->_getDefaultLocation();
|
||||
}
|
||||
|
||||
$urlUx = $this->_getUXSkinVariant();
|
||||
if (! empty( $urlUx )) {
|
||||
if (! empty($urlUx)) {
|
||||
$_SESSION['_defaultUserLocation'] = $url;
|
||||
$url = $urlUx;
|
||||
}
|
||||
@@ -248,13 +248,13 @@ class UsersProperties extends BaseUsersProperties
|
||||
* to verify if the user is using some "ux..." skin variant
|
||||
* if that is the case, the redirection will change to 'main' controller
|
||||
*/
|
||||
public function _getUXSkinVariant ()
|
||||
public function _getUXSkinVariant()
|
||||
{
|
||||
$url = '';
|
||||
|
||||
if (substr( SYS_SKIN, 0, 2 ) == 'ux' && SYS_SKIN != 'uxs') {
|
||||
if (substr(SYS_SKIN, 0, 2) == 'ux' && SYS_SKIN != 'uxs') {
|
||||
if (isset($_COOKIE['workspaceSkin'])) {
|
||||
if (substr( $_COOKIE['workspaceSkin'], 0, 2 ) != 'ux') {
|
||||
if (substr($_COOKIE['workspaceSkin'], 0, 2) != 'ux') {
|
||||
$url = $this->_getDefaultLocation();
|
||||
return $url;
|
||||
} else {
|
||||
@@ -265,8 +265,8 @@ class UsersProperties extends BaseUsersProperties
|
||||
}
|
||||
global $RBAC;
|
||||
$oConf = new Configurations();
|
||||
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
|
||||
if (sizeof( $oConf->aConfig ) > 0) {
|
||||
$oConf->loadConfig($x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '');
|
||||
if (sizeof($oConf->aConfig) > 0) {
|
||||
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') {
|
||||
$oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
|
||||
}
|
||||
@@ -275,27 +275,27 @@ class UsersProperties extends BaseUsersProperties
|
||||
|
||||
switch ($oConf->aConfig['DEFAULT_MENU']) {
|
||||
case 'PM_SETUP':
|
||||
if ($RBAC->userCanAccess( 'PM_SETUP' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_SETUP') == 1) {
|
||||
$getUrl = 'admin';
|
||||
}
|
||||
break;
|
||||
case 'PM_FACTORY':
|
||||
if ($RBAC->userCanAccess( 'PM_FACTORY' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
|
||||
$getUrl = 'designer';
|
||||
}
|
||||
break;
|
||||
case 'PM_CASES':
|
||||
if ($RBAC->userCanAccess( 'PM_CASES' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_CASES') == 1) {
|
||||
$getUrl = 'home';
|
||||
}
|
||||
break;
|
||||
case 'PM_USERS':
|
||||
if ($RBAC->userCanAccess( 'PM_USERS' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_USERS') == 1) {
|
||||
$getUrl = 'admin';
|
||||
}
|
||||
break;
|
||||
case 'PM_DASHBOARD':
|
||||
if ($RBAC->userCanAccess( 'PM_DASHBOARD' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
|
||||
$getUrl = 'dashboard';
|
||||
}
|
||||
break;
|
||||
@@ -311,14 +311,14 @@ class UsersProperties extends BaseUsersProperties
|
||||
* get the plugins, and check if there is redirectLogins
|
||||
* if yes, then redirect goes according his Role
|
||||
*/
|
||||
public function _getPluginLocation ()
|
||||
public function _getPluginLocation()
|
||||
{
|
||||
global $RBAC;
|
||||
$url = '';
|
||||
|
||||
if (class_exists( 'redirectDetail' )) {
|
||||
if (class_exists('redirectDetail')) {
|
||||
//to do: complete the validation
|
||||
if (isset( $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'] )) {
|
||||
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
|
||||
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
|
||||
}
|
||||
|
||||
@@ -347,10 +347,10 @@ class UsersProperties extends BaseUsersProperties
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
*/
|
||||
public function _getUXLocation ()
|
||||
public function _getUXLocation()
|
||||
{
|
||||
require_once 'classes/model/Users.php';
|
||||
$u = UsersPeer::retrieveByPK( $this->usrID );
|
||||
$u = UsersPeer::retrieveByPK($this->usrID);
|
||||
$url = '';
|
||||
|
||||
$uxType = $u->getUsrUx();
|
||||
@@ -360,7 +360,7 @@ class UsersProperties extends BaseUsersProperties
|
||||
if ($uxType == '' || $uxType == 'NORMAL') {
|
||||
require_once 'classes/model/GroupUser.php';
|
||||
$gu = new GroupUser();
|
||||
$ugList = $gu->getAllUserGroups( $this->usrID );
|
||||
$ugList = $gu->getAllUserGroups($this->usrID);
|
||||
|
||||
foreach ($ugList as $row) {
|
||||
if ($row['GRP_UX'] != 'NORMAL' && $row['GRP_UX'] != '') {
|
||||
@@ -387,11 +387,11 @@ class UsersProperties extends BaseUsersProperties
|
||||
* get user preferences for default redirect
|
||||
* verifying if it has any preferences on configurations table
|
||||
*/
|
||||
public function _getDefaultLocation ()
|
||||
public function _getDefaultLocation()
|
||||
{
|
||||
global $RBAC;
|
||||
$oConf = new Configurations();
|
||||
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
|
||||
$oConf->loadConfig($x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '');
|
||||
|
||||
if (isset($_COOKIE['workspaceSkin'])) {
|
||||
$baseUrl = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/';
|
||||
@@ -400,7 +400,7 @@ class UsersProperties extends BaseUsersProperties
|
||||
}
|
||||
$url = '';
|
||||
|
||||
if (sizeof( $oConf->aConfig ) > 0) {
|
||||
if (sizeof($oConf->aConfig) > 0) {
|
||||
// this user has a configuration record
|
||||
// backward compatibility, because now, we don't have user and dashboard menu.
|
||||
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') {
|
||||
@@ -409,34 +409,34 @@ class UsersProperties extends BaseUsersProperties
|
||||
|
||||
switch ($oConf->aConfig['DEFAULT_MENU']) {
|
||||
case 'PM_SETUP':
|
||||
if ($RBAC->userCanAccess( 'PM_SETUP' ) == 1 || $RBAC->userCanAccess('PM_USERS') == 1) {
|
||||
if ($RBAC->userCanAccess('PM_SETUP') == 1 || $RBAC->userCanAccess('PM_USERS') == 1) {
|
||||
$url = 'setup/main';
|
||||
}
|
||||
break;
|
||||
case 'PM_FACTORY':
|
||||
if ($RBAC->userCanAccess( 'PM_FACTORY' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
|
||||
$url = 'processes/main';
|
||||
}
|
||||
break;
|
||||
case 'PM_CASES':
|
||||
if ($RBAC->userCanAccess( 'PM_CASES' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_CASES') == 1) {
|
||||
$url = 'cases/main';
|
||||
}
|
||||
break;
|
||||
case 'PM_USERS':
|
||||
if ($RBAC->userCanAccess( 'PM_USERS' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_USERS') == 1) {
|
||||
$url = 'setup/main';
|
||||
}
|
||||
break;
|
||||
case 'PM_DASHBOARD':
|
||||
if ($RBAC->userCanAccess( 'PM_DASHBOARD' ) == 1) {
|
||||
if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
|
||||
$url = 'dashboard/main';
|
||||
}
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'PM_STRATEGIC_DASHBOARD':
|
||||
$licensedFeatures = & PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=') && $RBAC->userCanAccess( 'PM_SETUP' ) == 1) {
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=') && $RBAC->userCanAccess('PM_SETUP') == 1) {
|
||||
$url = 'strategicDashboard/main';
|
||||
}
|
||||
break;
|
||||
@@ -444,16 +444,16 @@ class UsersProperties extends BaseUsersProperties
|
||||
}
|
||||
}
|
||||
|
||||
if (empty( $url )) {
|
||||
if ($RBAC->userCanAccess( 'PM_FACTORY' ) == 1) {
|
||||
if (empty($url)) {
|
||||
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
|
||||
$url = 'processes/main';
|
||||
} elseif ($RBAC->userCanAccess( 'PM_SETUP' ) == 1) {
|
||||
} elseif ($RBAC->userCanAccess('PM_SETUP') == 1) {
|
||||
$url = 'setup/main';
|
||||
} elseif ($RBAC->userCanAccess( 'PM_CASES' ) == 1) {
|
||||
} elseif ($RBAC->userCanAccess('PM_CASES') == 1) {
|
||||
$url = 'cases/main';
|
||||
} elseif ($RBAC->userCanAccess( 'PM_USERS' ) == 1) {
|
||||
} elseif ($RBAC->userCanAccess('PM_USERS') == 1) {
|
||||
$url = 'setup/main';
|
||||
} elseif ($RBAC->userCanAccess( 'PM_DASHBOARD' ) == 1) {
|
||||
} elseif ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
|
||||
$url = 'dashboard/dashboard';
|
||||
} else {
|
||||
$url = 'users/myInfo';
|
||||
@@ -463,4 +463,3 @@ class UsersProperties extends BaseUsersProperties
|
||||
return $baseUrl . $url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user