HOR-4527
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
parent
abe71a6ffe
commit
0d533e19d9
@@ -1704,7 +1704,9 @@ class AppSolr
|
||||
$UnSerializedCaseData = unserialize($documentData ['APP_DATA']);
|
||||
|
||||
if ($UnSerializedCaseData === false) {
|
||||
$UnSerializedCaseData = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $documentData ['APP_DATA']); // utf8_encode
|
||||
$UnSerializedCaseData = preg_replace_callback('!s:(\d+):"(.*?)";!', function ($m) {
|
||||
return 's:' . strlen($m[2]) . ':"' . $m[2] . '";';
|
||||
}, $documentData ['APP_DATA']); // utf8_encode
|
||||
$UnSerializedCaseData = unserialize($UnSerializedCaseData);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
|
||||
class Applications
|
||||
{
|
||||
/**
|
||||
@@ -88,7 +87,7 @@ class Applications
|
||||
$sqlData .= " LEFT JOIN USERS ON (APP_DELEGATION.USR_ID = USERS.USR_ID)";
|
||||
$sqlData .= " LEFT JOIN PROCESS ON (APP_DELEGATION.PRO_ID = PROCESS.PRO_ID)";
|
||||
|
||||
$sqlData .= " WHERE TASK.TAS_TYPE NOT IN ('" . implode("','",$arrayTaskTypeToExclude) . "')";
|
||||
$sqlData .= " WHERE TASK.TAS_TYPE NOT IN ('" . implode("','", $arrayTaskTypeToExclude) . "')";
|
||||
switch ($status) {
|
||||
case 1: //DRAFT
|
||||
$sqlData .= " AND APP_DELEGATION.DEL_THREAD_STATUS='OPEN'";
|
||||
@@ -126,7 +125,7 @@ class Applications
|
||||
}
|
||||
|
||||
if (!empty($category)) {
|
||||
$category = mysql_real_escape_string($category);
|
||||
$category = mysqli_real_escape_string($con->getResource(), $category);
|
||||
$sqlData .= " AND PROCESS.PRO_CATEGORY = '{$category}'";
|
||||
}
|
||||
|
||||
@@ -166,7 +165,6 @@ class Applications
|
||||
if ($columnSearch === 'TAS_TITLE') {
|
||||
$sqlData .= " AND TASK.TAS_TITLE LIKE '%{$search}%' ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!empty($dateFrom)) {
|
||||
@@ -199,7 +197,7 @@ class Applications
|
||||
}
|
||||
|
||||
//Define the number of records by return
|
||||
if(empty($limit)) {
|
||||
if (empty($limit)) {
|
||||
$limit = 25;
|
||||
}
|
||||
if (!empty($start) && empty($search)) {
|
||||
@@ -209,18 +207,18 @@ class Applications
|
||||
}
|
||||
|
||||
$oDataset = $stmt->executeQuery($sqlData);
|
||||
$result = array ();
|
||||
$result = [];
|
||||
//By performance enable always the pagination
|
||||
$result['totalCount'] = $start + $limit + 1;
|
||||
$rows = array();
|
||||
$aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
$result['totalCount'] = intval($start) + intval($limit) + 1;
|
||||
$rows = [];
|
||||
$aPriorities = array('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
while ($oDataset->next()) {
|
||||
$aRow = $oDataset->getRow();
|
||||
if (isset( $aRow['APP_STATUS'] )) {
|
||||
$aRow['APP_STATUS_LABEL'] = G::LoadTranslation( "ID_{$aRow['APP_STATUS']}" );
|
||||
if (isset($aRow['APP_STATUS'])) {
|
||||
$aRow['APP_STATUS_LABEL'] = G::LoadTranslation("ID_{$aRow['APP_STATUS']}");
|
||||
}
|
||||
if (isset( $aRow['DEL_PRIORITY'] )) {
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}" );
|
||||
if (isset($aRow['DEL_PRIORITY'])) {
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation("ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}");
|
||||
}
|
||||
$aRow["APP_CURRENT_USER"] = $aRow["USR_LASTNAME"].' '.$aRow["USR_FIRSTNAME"];
|
||||
$aRow["APPDELCR_APP_TAS_TITLE"] = '';
|
||||
@@ -347,8 +345,8 @@ class Applications
|
||||
$Criteria = $oAppCache->getCompletedListCriteria($userUid);
|
||||
$CriteriaCount = $oAppCache->getCompletedCountCriteria($userUid);
|
||||
|
||||
$Criteria->add (AppCacheViewPeer::DEL_LAST_INDEX,"1");
|
||||
$CriteriaCount->add (AppCacheViewPeer::DEL_LAST_INDEX,"1");
|
||||
$Criteria->add(AppCacheViewPeer::DEL_LAST_INDEX, "1");
|
||||
$CriteriaCount->add(AppCacheViewPeer::DEL_LAST_INDEX, "1");
|
||||
break;
|
||||
default:
|
||||
//All status
|
||||
@@ -366,8 +364,8 @@ class Applications
|
||||
$CriteriaCount = $oAppCache->getToReviseCountCriteria($userUid);
|
||||
break;
|
||||
case "to_reassign":
|
||||
GLOBAL $RBAC;
|
||||
if($RBAC->userCanAccess('PM_REASSIGNCASE') == 1){
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) {
|
||||
$Criteria = $oAppCache->getToReassignListCriteria($userUid);
|
||||
$CriteriaCount = $oAppCache->getToReassignCountCriteria($userUid);
|
||||
} else {
|
||||
@@ -406,19 +404,19 @@ class Applications
|
||||
$CriteriaCount->addJoin(AppCacheViewPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
|
||||
$CriteriaCount->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
|
||||
|
||||
$Criteria->addAlias( 'CU', 'USERS' );
|
||||
$Criteria->addJoin( AppCacheViewPeer::USR_UID, 'CU.USR_UID', Criteria::LEFT_JOIN );
|
||||
$Criteria->addAsColumn( 'USR_UID', 'CU.USR_UID' );
|
||||
$Criteria->addAsColumn( 'USR_FIRSTNAME', 'CU.USR_FIRSTNAME' );
|
||||
$Criteria->addAsColumn( 'USR_LASTNAME', 'CU.USR_LASTNAME' );
|
||||
$Criteria->addAsColumn( 'USR_USERNAME', 'CU.USR_USERNAME' );
|
||||
$Criteria->addAlias('CU', 'USERS');
|
||||
$Criteria->addJoin(AppCacheViewPeer::USR_UID, 'CU.USR_UID', Criteria::LEFT_JOIN);
|
||||
$Criteria->addAsColumn('USR_UID', 'CU.USR_UID');
|
||||
$Criteria->addAsColumn('USR_FIRSTNAME', 'CU.USR_FIRSTNAME');
|
||||
$Criteria->addAsColumn('USR_LASTNAME', 'CU.USR_LASTNAME');
|
||||
$Criteria->addAsColumn('USR_USERNAME', 'CU.USR_USERNAME');
|
||||
|
||||
$CriteriaCount->addAlias( 'CU', 'USERS' );
|
||||
$CriteriaCount->addJoin( AppCacheViewPeer::USR_UID, 'CU.USR_UID', Criteria::LEFT_JOIN );
|
||||
$CriteriaCount->addAsColumn( 'USR_UID', 'CU.USR_UID' );
|
||||
$CriteriaCount->addAsColumn( 'USR_FIRSTNAME', 'CU.USR_FIRSTNAME' );
|
||||
$CriteriaCount->addAsColumn( 'USR_LASTNAME', 'CU.USR_LASTNAME' );
|
||||
$CriteriaCount->addAsColumn( 'USR_USERNAME', 'CU.USR_USERNAME' );
|
||||
$CriteriaCount->addAlias('CU', 'USERS');
|
||||
$CriteriaCount->addJoin(AppCacheViewPeer::USR_UID, 'CU.USR_UID', Criteria::LEFT_JOIN);
|
||||
$CriteriaCount->addAsColumn('USR_UID', 'CU.USR_UID');
|
||||
$CriteriaCount->addAsColumn('USR_FIRSTNAME', 'CU.USR_FIRSTNAME');
|
||||
$CriteriaCount->addAsColumn('USR_LASTNAME', 'CU.USR_LASTNAME');
|
||||
$CriteriaCount->addAsColumn('USR_USERNAME', 'CU.USR_USERNAME');
|
||||
|
||||
//Current delegation
|
||||
$appdelcrTableName = AppCacheViewPeer::TABLE_NAME;
|
||||
@@ -456,13 +454,13 @@ class Applications
|
||||
$CriteriaCount->addAlias("APPDELCR", $appdelcrTableName);
|
||||
$CriteriaCount->addAlias("USRCR", UsersPeer::TABLE_NAME);
|
||||
|
||||
$arrayCondition = array();
|
||||
$arrayCondition = [];
|
||||
$arrayCondition[] = array(AppCacheViewPeer::APP_UID, "APPDELCR.APP_UID");
|
||||
$arrayCondition[] = array("APPDELCR.DEL_LAST_INDEX", 1);
|
||||
$Criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
||||
$CriteriaCount->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
||||
|
||||
$arrayCondition = array();
|
||||
$arrayCondition = [];
|
||||
$arrayCondition[] = array("APPDELCR.USR_UID", "USRCR.USR_UID");
|
||||
$Criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
||||
$CriteriaCount->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
||||
@@ -470,17 +468,17 @@ class Applications
|
||||
//Previous user
|
||||
|
||||
if (($action == "todo" || $action == "selfservice" || $action == "unassigned" || $action == "paused" || $action == "to_revise" || $action == "sent") || ($status == "TO_DO" || $status == "DRAFT" || $status == "PAUSED" || $status == "CANCELLED" || $status == "COMPLETED")) {
|
||||
$Criteria->addAlias( 'PU', 'USERS' );
|
||||
$Criteria->addJoin( AppCacheViewPeer::PREVIOUS_USR_UID, 'PU.USR_UID', Criteria::LEFT_JOIN );
|
||||
$Criteria->addAsColumn( 'PREVIOUS_USR_FIRSTNAME', 'PU.USR_FIRSTNAME' );
|
||||
$Criteria->addAsColumn( 'PREVIOUS_USR_LASTNAME', 'PU.USR_LASTNAME' );
|
||||
$Criteria->addAsColumn( 'PREVIOUS_USR_USERNAME', 'PU.USR_USERNAME' );
|
||||
$Criteria->addAlias('PU', 'USERS');
|
||||
$Criteria->addJoin(AppCacheViewPeer::PREVIOUS_USR_UID, 'PU.USR_UID', Criteria::LEFT_JOIN);
|
||||
$Criteria->addAsColumn('PREVIOUS_USR_FIRSTNAME', 'PU.USR_FIRSTNAME');
|
||||
$Criteria->addAsColumn('PREVIOUS_USR_LASTNAME', 'PU.USR_LASTNAME');
|
||||
$Criteria->addAsColumn('PREVIOUS_USR_USERNAME', 'PU.USR_USERNAME');
|
||||
|
||||
$CriteriaCount->addAlias( 'PU', 'USERS' );
|
||||
$CriteriaCount->addJoin( AppCacheViewPeer::PREVIOUS_USR_UID, 'PU.USR_UID', Criteria::LEFT_JOIN );
|
||||
$CriteriaCount->addAsColumn( 'PREVIOUS_USR_FIRSTNAME', 'PU.USR_FIRSTNAME' );
|
||||
$CriteriaCount->addAsColumn( 'PREVIOUS_USR_LASTNAME', 'PU.USR_LASTNAME' );
|
||||
$CriteriaCount->addAsColumn( 'PREVIOUS_USR_USERNAME', 'PU.USR_USERNAME' );
|
||||
$CriteriaCount->addAlias('PU', 'USERS');
|
||||
$CriteriaCount->addJoin(AppCacheViewPeer::PREVIOUS_USR_UID, 'PU.USR_UID', Criteria::LEFT_JOIN);
|
||||
$CriteriaCount->addAsColumn('PREVIOUS_USR_FIRSTNAME', 'PU.USR_FIRSTNAME');
|
||||
$CriteriaCount->addAsColumn('PREVIOUS_USR_LASTNAME', 'PU.USR_LASTNAME');
|
||||
$CriteriaCount->addAsColumn('PREVIOUS_USR_USERNAME', 'PU.USR_USERNAME');
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -534,34 +532,36 @@ class Applications
|
||||
$dateTo = $dateTo . " 23:59:59";
|
||||
}
|
||||
|
||||
$Criteria->add( $Criteria->getNewCriterion( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL )->addAnd( $Criteria->getNewCriterion( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ) ) );
|
||||
$CriteriaCount->add( $CriteriaCount->getNewCriterion( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL )->addAnd( $CriteriaCount->getNewCriterion( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL ) ) );
|
||||
$Criteria->add($Criteria->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL)->addAnd($Criteria->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL)));
|
||||
$CriteriaCount->add($CriteriaCount->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL)->addAnd($CriteriaCount->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL)));
|
||||
} else {
|
||||
$dateFrom = $dateFrom . " 00:00:00";
|
||||
|
||||
$Criteria->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL );
|
||||
$CriteriaCount->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL );
|
||||
$Criteria->add(AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL);
|
||||
$CriteriaCount->add(AppCacheViewPeer::DEL_DELEGATE_DATE, $dateFrom, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
} elseif ($dateTo != "") {
|
||||
$dateTo = $dateTo . " 23:59:59";
|
||||
|
||||
$Criteria->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL );
|
||||
$CriteriaCount->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL );
|
||||
$Criteria->add(AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL);
|
||||
$CriteriaCount->add(AppCacheViewPeer::DEL_DELEGATE_DATE, $dateTo, Criteria::LESS_EQUAL);
|
||||
}
|
||||
|
||||
if ($newerThan != '') {
|
||||
if ($oldestThan != '') {
|
||||
$Criteria->add(
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $newerThan, Criteria::GREATER_THAN)->addAnd(
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $oldestThan, Criteria::LESS_THAN))
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $oldestThan, Criteria::LESS_THAN)
|
||||
)
|
||||
);
|
||||
$CriteriaCount->add(
|
||||
$CriteriaCount->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $newerThan, Criteria::GREATER_THAN)->addAnd(
|
||||
$CriteriaCount->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $oldestThan, Criteria::LESS_THAN))
|
||||
$CriteriaCount->getNewCriterion(AppCacheViewPeer::DEL_DELEGATE_DATE, $oldestThan, Criteria::LESS_THAN)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$Criteria->add(AppCacheViewPeer::DEL_DELEGATE_DATE, $newerThan, Criteria::GREATER_THAN);
|
||||
$CriteriaCount->add( AppCacheViewPeer::DEL_DELEGATE_DATE, $newerThan, Criteria::GREATER_THAN);
|
||||
$CriteriaCount->add(AppCacheViewPeer::DEL_DELEGATE_DATE, $newerThan, Criteria::GREATER_THAN);
|
||||
}
|
||||
} else {
|
||||
if ($oldestThan != '') {
|
||||
@@ -574,20 +574,20 @@ class Applications
|
||||
if ($filter != '') {
|
||||
switch ($filter) {
|
||||
case 'read':
|
||||
$Criteria->add( AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL );
|
||||
$CriteriaCount->add( AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL );
|
||||
$Criteria->add(AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL);
|
||||
$CriteriaCount->add(AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL);
|
||||
break;
|
||||
case 'unread':
|
||||
$Criteria->add( AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNULL );
|
||||
$CriteriaCount->add( AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNULL );
|
||||
$Criteria->add(AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNULL);
|
||||
$CriteriaCount->add(AppCacheViewPeer::DEL_INIT_DATE, null, Criteria::ISNULL);
|
||||
break;
|
||||
case 'started':
|
||||
$Criteria->add( AppCacheViewPeer::DEL_INDEX, 1, Criteria::EQUAL );
|
||||
$CriteriaCount->add( AppCacheViewPeer::DEL_INDEX, 1, Criteria::EQUAL );
|
||||
$Criteria->add(AppCacheViewPeer::DEL_INDEX, 1, Criteria::EQUAL);
|
||||
$CriteriaCount->add(AppCacheViewPeer::DEL_INDEX, 1, Criteria::EQUAL);
|
||||
break;
|
||||
case 'completed':
|
||||
$Criteria->add( AppCacheViewPeer::APP_STATUS, 'COMPLETED', Criteria::EQUAL );
|
||||
$CriteriaCount->add( AppCacheViewPeer::APP_STATUS, 'COMPLETED', Criteria::EQUAL );
|
||||
$Criteria->add(AppCacheViewPeer::APP_STATUS, 'COMPLETED', Criteria::EQUAL);
|
||||
$CriteriaCount->add(AppCacheViewPeer::APP_STATUS, 'COMPLETED', Criteria::EQUAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -610,7 +610,7 @@ class Applications
|
||||
$additionalTable = new AdditionalTables();
|
||||
$tableData = $additionalTable->load($additionalTableUid, true);
|
||||
|
||||
$tableField = array();
|
||||
$tableField = [];
|
||||
|
||||
foreach ($tableData["FIELDS"] as $arrayField) {
|
||||
$tableField[] = $arrayField["FLD_NAME"];
|
||||
@@ -646,14 +646,21 @@ class Applications
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::APP_UID, $search, Criteria::EQUAL)->addOr(
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::EQUAL)->addOr(
|
||||
$oTmpCriteria
|
||||
)))));
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$Criteria->add(
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE)->addOr(
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE)->addOr(
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::APP_UID, $search, Criteria::EQUAL)->addOr(
|
||||
$Criteria->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::EQUAL)
|
||||
))));
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// the count query needs to be the normal criteria query if there are defined PM Table Fields in the cases list
|
||||
@@ -665,7 +672,10 @@ class Applications
|
||||
$CriteriaCount->getNewCriterion(AppCacheViewPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE)->addOr(
|
||||
$CriteriaCount->getNewCriterion(AppCacheViewPeer::APP_UID, $search, Criteria::EQUAL)->addOr(
|
||||
$CriteriaCount->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::EQUAL)
|
||||
))));
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,17 +702,17 @@ class Applications
|
||||
|
||||
// first check if there is a PMTable defined within the list,
|
||||
// the issue that brokes the normal criteria query seems to be fixed
|
||||
if (isset( $oAppCache->confCasesList['PMTable'] ) && ! empty( $oAppCache->confCasesList['PMTable'] )) {
|
||||
if (isset($oAppCache->confCasesList['PMTable']) && ! empty($oAppCache->confCasesList['PMTable'])) {
|
||||
// then
|
||||
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK( $oAppCache->confCasesList['PMTable'] );
|
||||
$oAdditionalTables = AdditionalTablesPeer::retrieveByPK($oAppCache->confCasesList['PMTable']);
|
||||
$tableName = $oAdditionalTables->getAddTabName();
|
||||
$tableNameAux = $tableName;
|
||||
$tableName = strtolower( $tableName );
|
||||
$tableNameArray = explode( '_', $tableName );
|
||||
$tableName = strtolower($tableName);
|
||||
$tableNameArray = explode('_', $tableName);
|
||||
foreach ($tableNameArray as $item) {
|
||||
$newTableName[] = ucfirst( $item );
|
||||
$newTableName[] = ucfirst($item);
|
||||
}
|
||||
$tableName = implode( '', $newTableName );
|
||||
$tableName = implode('', $newTableName);
|
||||
// so the pm table class can be invoqued from the pm table model clases
|
||||
if (! class_exists( $tableName )) {
|
||||
require_once (PATH_DB . config("system.workspace") . PATH_SEP . "classes" . PATH_SEP . $tableName . ".php");
|
||||
@@ -729,7 +739,7 @@ class Applications
|
||||
}
|
||||
}
|
||||
|
||||
if (isset( $oAppCache->confCasesList['PMTable'] ) && ! empty( $oAppCache->confCasesList['PMTable'] ) && $tableNameAux != '') {
|
||||
if (isset($oAppCache->confCasesList['PMTable']) && ! empty($oAppCache->confCasesList['PMTable']) && $tableNameAux != '') {
|
||||
$sortTable = explode(".", $sortBk);
|
||||
|
||||
$additionalTableUid = $oAppCache->confCasesList["PMTable"];
|
||||
@@ -780,18 +790,18 @@ class Applications
|
||||
}
|
||||
|
||||
//limit the results according the interface
|
||||
$Criteria->setLimit( $limit );
|
||||
$Criteria->setOffset( $start );
|
||||
$Criteria->setLimit($limit);
|
||||
$Criteria->setOffset($start);
|
||||
|
||||
//execute the query
|
||||
$oDataset = AppCacheViewPeer::doSelectRS( $Criteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset = AppCacheViewPeer::doSelectRS($Criteria, Propel::getDbConnection('workflow_ro'));
|
||||
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$result = array ();
|
||||
$result = [];
|
||||
$result['totalCount'] = $totalCount;
|
||||
$rows = array ();
|
||||
$aPriorities = array ('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
$rows = [];
|
||||
$aPriorities = array('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH');
|
||||
$index = $start;
|
||||
|
||||
while ($oDataset->next()) {
|
||||
@@ -813,18 +823,18 @@ class Applications
|
||||
}
|
||||
|
||||
//Unassigned user
|
||||
if (! isset( $aRow['APP_CURRENT_USER'] )) {
|
||||
if (! isset($aRow['APP_CURRENT_USER'])) {
|
||||
$aRow['APP_CURRENT_USER'] = "[" . strtoupper(G::LoadTranslation("ID_UNASSIGNED")) . "]";
|
||||
}
|
||||
|
||||
// replacing the status data with their respective translation
|
||||
if (isset( $aRow['APP_STATUS'] )) {
|
||||
$aRow['APP_STATUS_LABEL'] = G::LoadTranslation( "ID_{$aRow['APP_STATUS']}" );
|
||||
if (isset($aRow['APP_STATUS'])) {
|
||||
$aRow['APP_STATUS_LABEL'] = G::LoadTranslation("ID_{$aRow['APP_STATUS']}");
|
||||
}
|
||||
|
||||
// replacing the priority data with their respective translation
|
||||
if (isset( $aRow['DEL_PRIORITY'] )) {
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}" );
|
||||
if (isset($aRow['DEL_PRIORITY'])) {
|
||||
$aRow['DEL_PRIORITY'] = G::LoadTranslation("ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}");
|
||||
}
|
||||
|
||||
$rows[] = $aRow;
|
||||
@@ -841,67 +851,66 @@ class Applications
|
||||
*
|
||||
* @return Array $fields
|
||||
*/
|
||||
public function setDefaultFields ()
|
||||
public function setDefaultFields()
|
||||
{
|
||||
$fields = array ();
|
||||
$fields['APP_NUMBER'] = array ('name' => 'APP_NUMBER','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_NUMBER' ),'width' => 40,'align' => 'left'
|
||||
$fields = [];
|
||||
$fields['APP_NUMBER'] = array('name' => 'APP_NUMBER','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_NUMBER'),'width' => 40,'align' => 'left'
|
||||
);
|
||||
$fields['APP_UID'] = array ('name' => 'APP_UID','fieldType' => 'key','label' => G::loadTranslation( 'ID_CASESLIST_APP_UID' ),'width' => 80,'align' => 'left'
|
||||
$fields['APP_UID'] = array('name' => 'APP_UID','fieldType' => 'key','label' => G::loadTranslation('ID_CASESLIST_APP_UID'),'width' => 80,'align' => 'left'
|
||||
);
|
||||
$fields['DEL_INDEX'] = array ('name' => 'DEL_INDEX','fieldType' => 'key','label' => G::loadTranslation( 'ID_CASESLIST_DEL_INDEX' ),'width' => 50,'align' => 'left'
|
||||
$fields['DEL_INDEX'] = array('name' => 'DEL_INDEX','fieldType' => 'key','label' => G::loadTranslation('ID_CASESLIST_DEL_INDEX'),'width' => 50,'align' => 'left'
|
||||
);
|
||||
$fields['TAS_UID'] = array ('name' => 'TAS_UID','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_TAS_UID' ),'width' => 80,'align' => 'left'
|
||||
$fields['TAS_UID'] = array('name' => 'TAS_UID','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_TAS_UID'),'width' => 80,'align' => 'left'
|
||||
);
|
||||
$fields['USR_UID'] = array ('name' => 'USR_UID','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_USR_UID' ),'width' => 80,'align' => 'left','hidden' => true
|
||||
$fields['USR_UID'] = array('name' => 'USR_UID','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_USR_UID'),'width' => 80,'align' => 'left','hidden' => true
|
||||
);
|
||||
$fields['PREVIOUS_USR_UID'] = array ('name' => 'PREVIOUS_USR_UID','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_PREVIOUS_USR_UID' ),'width' => 80,'align' => 'left','hidden' => true
|
||||
$fields['PREVIOUS_USR_UID'] = array('name' => 'PREVIOUS_USR_UID','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_PREVIOUS_USR_UID'),'width' => 80,'align' => 'left','hidden' => true
|
||||
);
|
||||
$fields['APP_TITLE'] = array ('name' => 'APP_TITLE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_TITLE' ),'width' => 140,'align' => 'left'
|
||||
$fields['APP_TITLE'] = array('name' => 'APP_TITLE','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_TITLE'),'width' => 140,'align' => 'left'
|
||||
);
|
||||
$fields['APP_PRO_TITLE'] = array ('name' => 'APP_PRO_TITLE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_PRO_TITLE' ),'width' => 140,'align' => 'left'
|
||||
$fields['APP_PRO_TITLE'] = array('name' => 'APP_PRO_TITLE','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_PRO_TITLE'),'width' => 140,'align' => 'left'
|
||||
);
|
||||
$fields['APP_TAS_TITLE'] = array ('name' => 'APP_TAS_TITLE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_TAS_TITLE' ),'width' => 140,'align' => 'left'
|
||||
$fields['APP_TAS_TITLE'] = array('name' => 'APP_TAS_TITLE','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_TAS_TITLE'),'width' => 140,'align' => 'left'
|
||||
);
|
||||
$fields['APP_DEL_PREVIOUS_USER'] = array ('name' => 'APP_DEL_PREVIOUS_USER','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DEL_PREVIOUS_USER' ),'width' => 120,'align' => 'left'
|
||||
$fields['APP_DEL_PREVIOUS_USER'] = array('name' => 'APP_DEL_PREVIOUS_USER','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_DEL_PREVIOUS_USER'),'width' => 120,'align' => 'left'
|
||||
);
|
||||
$fields['APP_CURRENT_USER'] = array ('name' => 'APP_CURRENT_USER','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_CURRENT_USER' ),'width' => 120,'align' => 'left'
|
||||
$fields['APP_CURRENT_USER'] = array('name' => 'APP_CURRENT_USER','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_CURRENT_USER'),'width' => 120,'align' => 'left'
|
||||
);
|
||||
$fields['USR_FIRSTNAME'] = array ('name' => 'USR_FIRSTNAME','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_CURRENT_USER' ),'width' => 120,'align' => 'left'
|
||||
$fields['USR_FIRSTNAME'] = array('name' => 'USR_FIRSTNAME','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_CURRENT_USER'),'width' => 120,'align' => 'left'
|
||||
);
|
||||
$fields['USR_LASTNAME'] = array ('name' => 'USR_LASTNAME','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_CURRENT_USER' ),'width' => 120,'align' => 'left'
|
||||
$fields['USR_LASTNAME'] = array('name' => 'USR_LASTNAME','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_CURRENT_USER'),'width' => 120,'align' => 'left'
|
||||
);
|
||||
$fields['DEL_TASK_DUE_DATE'] = array ('name' => 'DEL_TASK_DUE_DATE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_DEL_TASK_DUE_DATE' ),'width' => 100,'align' => 'left'
|
||||
$fields['DEL_TASK_DUE_DATE'] = array('name' => 'DEL_TASK_DUE_DATE','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_DEL_TASK_DUE_DATE'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_UPDATE_DATE'] = array ('name' => 'APP_UPDATE_DATE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_UPDATE_DATE' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_UPDATE_DATE'] = array('name' => 'APP_UPDATE_DATE','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_UPDATE_DATE'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['DEL_PRIORITY'] = array ('name' => 'DEL_PRIORITY','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_DEL_PRIORITY' ),'width' => 80,'align' => 'left'
|
||||
$fields['DEL_PRIORITY'] = array('name' => 'DEL_PRIORITY','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_DEL_PRIORITY'),'width' => 80,'align' => 'left'
|
||||
);
|
||||
$fields['APP_STATUS'] = array ('name' => 'APP_STATUS','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_STATUS' ),'width' => 80,'align' => 'left'
|
||||
$fields['APP_STATUS'] = array('name' => 'APP_STATUS','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_STATUS'),'width' => 80,'align' => 'left'
|
||||
);
|
||||
$fields['APP_FINISH_DATE'] = array ('name' => 'APP_FINISH_DATE','fieldType' => 'case field','label' => G::loadTranslation( 'ID_CASESLIST_APP_FINISH_DATE' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_FINISH_DATE'] = array('name' => 'APP_FINISH_DATE','fieldType' => 'case field','label' => G::loadTranslation('ID_CASESLIST_APP_FINISH_DATE'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_DELAY_UID'] = array ('name' => 'APP_DELAY_UID','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DELAY_UID' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_DELAY_UID'] = array('name' => 'APP_DELAY_UID','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_DELAY_UID'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_THREAD_INDEX'] = array ('name' => 'APP_THREAD_INDEX','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_THREAD_INDEX' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_THREAD_INDEX'] = array('name' => 'APP_THREAD_INDEX','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_THREAD_INDEX'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_DEL_INDEX'] = array ('name' => 'APP_DEL_INDEX','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DEL_INDEX' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_DEL_INDEX'] = array('name' => 'APP_DEL_INDEX','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_DEL_INDEX'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_TYPE'] = array ('name' => 'APP_TYPE','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_TYPE' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_TYPE'] = array('name' => 'APP_TYPE','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_TYPE'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_DELEGATION_USER'] = array ('name' => 'APP_DELEGATION_USER','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DELEGATION_USER' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_DELEGATION_USER'] = array('name' => 'APP_DELEGATION_USER','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_DELEGATION_USER'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_ENABLE_ACTION_USER'] = array ('name' => 'APP_ENABLE_ACTION_USER','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_ENABLE_ACTION_USER' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_ENABLE_ACTION_USER'] = array('name' => 'APP_ENABLE_ACTION_USER','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_ENABLE_ACTION_USER'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_ENABLE_ACTION_DATE'] = array ('name' => 'APP_ENABLE_ACTION_DATE','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_AAPP_ENABLE_ACTION_DATE' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_ENABLE_ACTION_DATE'] = array('name' => 'APP_ENABLE_ACTION_DATE','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_AAPP_ENABLE_ACTION_DATE'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_DISABLE_ACTION_USER'] = array ('name' => 'APP_DISABLE_ACTION_USER','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DISABLE_ACTION_USER' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_DISABLE_ACTION_USER'] = array('name' => 'APP_DISABLE_ACTION_USER','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_DISABLE_ACTION_USER'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_DISABLE_ACTION_DATE'] = array ('name' => 'APP_DISABLE_ACTION_DATE','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_DISABLE_ACTION_DATE' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_DISABLE_ACTION_DATE'] = array('name' => 'APP_DISABLE_ACTION_DATE','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_DISABLE_ACTION_DATE'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
$fields['APP_AUTOMATIC_DISABLED_DATE'] = array ('name' => 'APP_AUTOMATIC_DISABLED_DATE','fieldType' => 'delay field','label' => G::loadTranslation( 'ID_CASESLIST_APP_AUTOMATIC_DISABLED_DATE' ),'width' => 100,'align' => 'left'
|
||||
$fields['APP_AUTOMATIC_DISABLED_DATE'] = array('name' => 'APP_AUTOMATIC_DISABLED_DATE','fieldType' => 'delay field','label' => G::loadTranslation('ID_CASESLIST_APP_AUTOMATIC_DISABLED_DATE'),'width' => 100,'align' => 'left'
|
||||
);
|
||||
return $fields;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -910,9 +919,9 @@ class Applications
|
||||
* @param $action
|
||||
* @return an array with the default fields for an specific case list (action)
|
||||
*/
|
||||
public function getDefaultFields ($action)
|
||||
public function getDefaultFields($action)
|
||||
{
|
||||
$rows = array ();
|
||||
$rows = [];
|
||||
switch ($action) {
|
||||
case 'todo': // #, Case, task, process, sent by, due date, Last Modify, Priority
|
||||
$fields = $this->setDefaultFields();
|
||||
@@ -1090,34 +1099,34 @@ class Applications
|
||||
* @param array $second
|
||||
* @return $response a json string
|
||||
*/
|
||||
public function genericJsonResponse ($pmtable, $first, $second, $rowsperpage, $dateFormat)
|
||||
public function genericJsonResponse($pmtable, $first, $second, $rowsperpage, $dateFormat)
|
||||
{
|
||||
$firstGrid['totalCount'] = count( $first );
|
||||
$firstGrid['totalCount'] = count($first);
|
||||
$firstGrid['data'] = $first;
|
||||
$secondGrid['totalCount'] = count( $second );
|
||||
$secondGrid['totalCount'] = count($second);
|
||||
$secondGrid['data'] = $second;
|
||||
$result = array ();
|
||||
$result = [];
|
||||
$result['first'] = $firstGrid;
|
||||
$result['second'] = $secondGrid;
|
||||
$result['PMTable'] = isset( $pmtable ) ? $pmtable : '';
|
||||
$result['rowsperpage'] = isset( $rowsperpage ) ? $rowsperpage : 20;
|
||||
$result['dateformat'] = isset( $dateFormat ) && $dateFormat != '' ? $dateFormat : 'M d, Y';
|
||||
$result['PMTable'] = isset($pmtable) ? $pmtable : '';
|
||||
$result['rowsperpage'] = isset($rowsperpage) ? $rowsperpage : 20;
|
||||
$result['dateformat'] = isset($dateFormat) && $dateFormat != '' ? $dateFormat : 'M d, Y';
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getSteps ($appUid, $index, $tasUid, $proUid)
|
||||
public function getSteps($appUid, $index, $tasUid, $proUid)
|
||||
{
|
||||
$steps = Array ();
|
||||
$steps = [];
|
||||
$case = new Cases();
|
||||
$step = new Step();
|
||||
$appDocument = new AppDocument();
|
||||
|
||||
$caseSteps = $step->getAllCaseSteps( $proUid, $tasUid, $appUid );
|
||||
$caseSteps = $step->getAllCaseSteps($proUid, $tasUid, $appUid);
|
||||
|
||||
//getting externals steps
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$eSteps = $oPluginRegistry->getSteps();
|
||||
$externalSteps = array ();
|
||||
$externalSteps = [];
|
||||
/** @var \ProcessMaker\Plugins\Interfaces\StepDetail $externalStep */
|
||||
foreach ($eSteps as $externalStep) {
|
||||
$externalSteps[$externalStep->getStepId()] = $externalStep;
|
||||
@@ -1125,17 +1134,17 @@ class Applications
|
||||
|
||||
//getting the case record
|
||||
if ($appUid) {
|
||||
$caseData = $case->loadCase( $appUid );
|
||||
$caseData = $case->loadCase($appUid);
|
||||
$pmScript = new PMScript();
|
||||
$pmScript->setFields( $caseData['APP_DATA'] );
|
||||
$pmScript->setFields($caseData['APP_DATA']);
|
||||
}
|
||||
|
||||
$externalStepCount = 0;
|
||||
|
||||
foreach ($caseSteps as $caseStep) {
|
||||
// if it has a condition
|
||||
if (trim( $caseStep->getStepCondition() ) != '') {
|
||||
$pmScript->setScript( $caseStep->getStepCondition() );
|
||||
if (trim($caseStep->getStepCondition()) != '') {
|
||||
$pmScript->setScript($caseStep->getStepCondition());
|
||||
|
||||
if (! $pmScript->evaluate()) {
|
||||
//evaluated false, jump & continue with the others steps
|
||||
@@ -1147,21 +1156,21 @@ class Applications
|
||||
$stepType = $caseStep->getStepTypeObj();
|
||||
$stepPosition = $caseStep->getStepPosition();
|
||||
|
||||
$stepItem = array ();
|
||||
$stepItem = [];
|
||||
$stepItem['id'] = $stepUid;
|
||||
$stepItem['type'] = $stepType;
|
||||
|
||||
switch ($stepType) {
|
||||
case 'DYNAFORM':
|
||||
$oDocument = DynaformPeer::retrieveByPK( $stepUid );
|
||||
$oDocument = DynaformPeer::retrieveByPK($stepUid);
|
||||
|
||||
$stepItem['title'] = $oDocument->getDynTitle();
|
||||
$stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=EDIT";
|
||||
$stepItem['version'] = $oDocument->getDynVersion();
|
||||
break;
|
||||
case 'OUTPUT_DOCUMENT':
|
||||
$oDocument = OutputDocumentPeer::retrieveByPK( $caseStep->getStepUidObj() );
|
||||
$outputDoc = $appDocument->getObject( $appUid, $index, $caseStep->getStepUidObj(), 'OUTPUT' );
|
||||
$oDocument = OutputDocumentPeer::retrieveByPK($caseStep->getStepUidObj());
|
||||
$outputDoc = $appDocument->getObject($appUid, $index, $caseStep->getStepUidObj(), 'OUTPUT');
|
||||
$stepItem['title'] = $oDocument->getOutDocTitle();
|
||||
|
||||
if ($outputDoc['APP_DOC_UID']) {
|
||||
@@ -1171,7 +1180,7 @@ class Applications
|
||||
}
|
||||
break;
|
||||
case 'INPUT_DOCUMENT':
|
||||
$oDocument = InputDocumentPeer::retrieveByPK( $stepUid );
|
||||
$oDocument = InputDocumentPeer::retrieveByPK($stepUid);
|
||||
$stepItem['title'] = $oDocument->getInpDocTitle();
|
||||
$stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=ATTACH";
|
||||
break;
|
||||
@@ -1189,10 +1198,10 @@ class Applications
|
||||
}
|
||||
|
||||
//last, assign task
|
||||
$stepItem = array ();
|
||||
$stepItem = [];
|
||||
$stepItem['id'] = '-1';
|
||||
$stepItem['type'] = '';
|
||||
$stepItem['title'] = G::LoadTranslation( 'ID_ASSIGN_TASK' );
|
||||
$stepItem['title'] = G::LoadTranslation('ID_ASSIGN_TASK');
|
||||
$stepItem['url'] = "cases/cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN";
|
||||
|
||||
$steps[] = $stepItem;
|
||||
|
||||
@@ -7116,7 +7116,9 @@ class Cases
|
||||
|
||||
// BUG 8134, FIX!// for single/double quote troubles // Unserialize with utf8 content get trouble
|
||||
if ($unserializedData === false) {
|
||||
$unserializedData = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $data);
|
||||
$unserializedData = preg_replace_callback('!s:(\d+):"(.*?)";!', function ($m) {
|
||||
return 's:' . strlen($m[2]) . ':"' . $m[2] . '";';
|
||||
}, $data);
|
||||
$unserializedData = @unserialize($unserializedData);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class DbConnections
|
||||
{
|
||||
@@ -18,7 +19,7 @@ class DbConnections
|
||||
* @param string $pPRO_UID
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($pPRO_UID = null)
|
||||
public function __construct($pPRO_UID = null)
|
||||
{
|
||||
$this->errno = 0;
|
||||
$this->errstr = "";
|
||||
@@ -32,36 +33,36 @@ class DbConnections
|
||||
*
|
||||
* @return Array $connections
|
||||
*/
|
||||
public function getAllConnections ()
|
||||
public function getAllConnections()
|
||||
{
|
||||
if (isset( $this->PRO_UID )) {
|
||||
if (isset($this->PRO_UID)) {
|
||||
$oDBSource = new DbSource();
|
||||
$oContent = new Content();
|
||||
$connections = Array ();
|
||||
$types = Array ();
|
||||
$connections = array ();
|
||||
$types = array ();
|
||||
$this->have_any_connectios = false;
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_UID );
|
||||
$c->addSelectColumn( DbSourcePeer::PRO_UID );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_TYPE );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_SERVER );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_DATABASE_NAME );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_USERNAME );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_PASSWORD );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_PORT );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_ENCODE );
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_UID);
|
||||
$c->addSelectColumn(DbSourcePeer::PRO_UID);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_TYPE);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_SERVER);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_DATABASE_NAME);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_USERNAME);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_PASSWORD);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_PORT);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_ENCODE);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_CONNECTION_TYPE);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_TNS);
|
||||
$c->addSelectColumn( ContentPeer::CON_VALUE );
|
||||
$c->addSelectColumn(ContentPeer::CON_VALUE);
|
||||
|
||||
$c->add( DbSourcePeer::PRO_UID, $this->PRO_UID );
|
||||
$c->add( ContentPeer::CON_CATEGORY, 'DBS_DESCRIPTION' );
|
||||
$c->addJoin( DbSourcePeer::DBS_UID, ContentPeer::CON_ID );
|
||||
$c->add(DbSourcePeer::PRO_UID, $this->PRO_UID);
|
||||
$c->add(ContentPeer::CON_CATEGORY, 'DBS_DESCRIPTION');
|
||||
$c->addJoin(DbSourcePeer::DBS_UID, ContentPeer::CON_ID);
|
||||
|
||||
$result = DbSourcePeer::doSelectRS( $c );
|
||||
$result = DbSourcePeer::doSelectRS($c);
|
||||
$result->next();
|
||||
$row = $result->getRow();
|
||||
|
||||
@@ -82,7 +83,7 @@ class DbConnections
|
||||
|
||||
$result->next();
|
||||
}
|
||||
if (! in_array( $row[2], $types )) {
|
||||
if (! in_array($row[2], $types)) {
|
||||
$types[] = $row[2];
|
||||
}
|
||||
$this->connections = $connections;
|
||||
@@ -96,20 +97,19 @@ class DbConnections
|
||||
* @param string $pType
|
||||
* @return Array $connections
|
||||
*/
|
||||
public function getConnections ($pType)
|
||||
public function getConnections($pType)
|
||||
{
|
||||
$connections = Array ();
|
||||
$connections = array ();
|
||||
foreach ($this->connections as $c) {
|
||||
if (trim( $pType ) == trim( $c['DBS_TYPE'] )) {
|
||||
if (trim($pType) == trim($c['DBS_TYPE'])) {
|
||||
$connections[] = $c;
|
||||
}
|
||||
}
|
||||
if (count( $connections ) > 0) {
|
||||
if (count($connections) > 0) {
|
||||
return $connections;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,27 +121,27 @@ class DbConnections
|
||||
* @param string $only
|
||||
* @return Array $connections
|
||||
*/
|
||||
public function getConnectionsProUid ($pProUid, $only = array())
|
||||
public function getConnectionsProUid($pProUid, $only = array())
|
||||
{
|
||||
$connections = Array ();
|
||||
$connections = array ();
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_UID );
|
||||
$c->addSelectColumn( DbSourcePeer::PRO_UID );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_TYPE );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_SERVER );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_DATABASE_NAME );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_CONNECTION_TYPE );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_TNS );
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_UID);
|
||||
$c->addSelectColumn(DbSourcePeer::PRO_UID);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_TYPE);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_SERVER);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_DATABASE_NAME);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_CONNECTION_TYPE);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_TNS);
|
||||
|
||||
$result = DbSourcePeer::doSelectRS( $c );
|
||||
$result = DbSourcePeer::doSelectRS($c);
|
||||
$result->next();
|
||||
$row = $result->getRow();
|
||||
|
||||
$sw = count($only) > 0;
|
||||
while ($row = $result->getRow()) {
|
||||
if ((trim( $pProUid ) == trim( $row[1] )) && ( $sw ? in_array($row[2], $only) : true )) {
|
||||
if ((trim($pProUid) == trim($row[1])) && ( $sw ? in_array($row[2], $only) : true )) {
|
||||
$dbUid = $row[0];
|
||||
|
||||
$dbDescription = '';
|
||||
@@ -171,22 +171,80 @@ class DbConnections
|
||||
$result->next();
|
||||
}
|
||||
|
||||
if (count( $connections ) > 0) {
|
||||
if (count($connections) > 0) {
|
||||
return $connections;
|
||||
} else {
|
||||
return Array ();
|
||||
return array ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* loadAdditionalConnections
|
||||
*
|
||||
* @param $force boolean Determines if we should force load additional connections, even if lastProcessId is the same as active process
|
||||
* @return void
|
||||
*/
|
||||
public function loadAdditionalConnections ()
|
||||
public static function loadAdditionalConnections($force = false)
|
||||
{
|
||||
PROPEL::Init( PATH_METHODS . 'dbConnections/genericDbConnections.php' );
|
||||
// $lastProcessId determines what was the last process ID we processed. If it was the same, we'll continue to
|
||||
static $lastProcessId = null;
|
||||
// We need to rebuild the Propel configuration, but this time, bring in any additional configuration for the active process
|
||||
if ($force || (isset($_SESSION['PROCESS']) && $_SESSION['PROCESS'] != $lastProcessId)) {
|
||||
// Get our current configuration
|
||||
$conf = Propel::getConfiguration();
|
||||
// Iterate through the datasources of configuration, and only care about workflow, rbac or rp. Remove anything else.
|
||||
foreach ($conf['datasources'] as $key => $val) {
|
||||
if (!in_array($key, ['workflow', 'rbac', 'rp'])) {
|
||||
unset($conf['datasources'][$key]);
|
||||
}
|
||||
}
|
||||
// Now, let's fetch all external database connections for this process from cache
|
||||
$externalDbs = Cache::get('proc-' . $_SESSION['PROCESS'] . '-extdbs', function () {
|
||||
// Use explicit DbSource in the model namespace to ignore the global DbSource which is propel built
|
||||
// @todo Eventually remove the global DbSource and remove explicit namespace path
|
||||
return \ProcessMaker\Model\DbSource::where('PRO_UID', $_SESSION['PROCESS'])->get();
|
||||
});
|
||||
foreach ($externalDbs as $externalDb) {
|
||||
$conf['datasources'][$externalDb->DBS_UID] = [];
|
||||
$flagTns = ($externalDb->DBS_TYPE == "oracle" && $externalDb->DBS_CONNECTION_TYPE == "TNS")? 1 : 0;
|
||||
// Build the appropriate items to add to our Propel configuration
|
||||
// Let's grab the decrypted password
|
||||
$passw = '';
|
||||
if ($externalDb->DBS_PASSWORD != '') {
|
||||
$aPassw = explode('_', $externalDb->DBS_PASSWORD);
|
||||
$passw = $aPassw[0];
|
||||
|
||||
if (sizeof($aPassw) > 1 && $flagTns === 0) {
|
||||
$passw = ($passw == "none")? "" : G::decrypt($passw, $externalDb->DBS_DATABASE_NAME);
|
||||
} else {
|
||||
$passw = ($passw == "none")? "" : G::decrypt($passw, $externalDb->DBS_TNS);
|
||||
}
|
||||
}
|
||||
// Check for TNS for Oracle
|
||||
if ($flagTns == 0) {
|
||||
// Not TNS, build a standard configuration
|
||||
$dbsPort = ($externalDb->DBS_PORT == '') ? ('') : (':' . $externalDb->DBS_PORT);
|
||||
$encoding = (trim($externalDb->DBS_ENCODE) == '') ? '' : '?encoding=' . $externalDb->DBS_ENCODE;
|
||||
if (strpos($externalDb->DBS_SERVER, "\\") && $externalDb->DBS_TYPE == 'mssql') {
|
||||
// This is a microsoft SQL server which is using a netbios connection string
|
||||
$conf['datasources'][$externalDb->DBS_UID]['connection'] = $externalDb->DBS_TYPE . '://'
|
||||
. $externalDb->DBS_USERNAME . ':' . $passw . '@' . $externalDb->DBS_SERVER . '/'
|
||||
. $externalDb->DBS_DATABASE_NAME . $encoding;
|
||||
} else {
|
||||
$conf['datasources'][$externalDb->DBS_UID]['connection'] = $externalDb->DBS_TYPE . '://'
|
||||
. $externalDb->DBS_USERNAME . ':' . $passw . '@' . $externalDb->DBS_SERVER . $dbsPort . '/'
|
||||
. $externalDb->DBS_DATABASE_NAME . $encoding;
|
||||
}
|
||||
} else {
|
||||
// Is oracle and TNS, let's provide a TNS based DSN
|
||||
$conf["datasources"][$externalDb->DBS_UID]["connection"] = $externalDb->DBS_TYPE . "://"
|
||||
. $externalDb->DBS_USERNAME . ":" . $passw . "@" . $externalDb->DBS_TNS;
|
||||
}
|
||||
$conf['datasources'][$externalDb->DBS_UID]['adapter'] = $externalDb->DBS_TYPE;
|
||||
}
|
||||
Propel::initConfiguration($conf);
|
||||
$lastProcessId = $_SESSION['PROCESS'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,14 +252,14 @@ class DbConnections
|
||||
*
|
||||
* @return array $servicesAvailables
|
||||
*/
|
||||
public function getDbServicesAvailables ()
|
||||
public function getDbServicesAvailables()
|
||||
{
|
||||
$servicesAvailables = Array ();
|
||||
$servicesAvailables = array ();
|
||||
|
||||
$dbServices = Array ('mysql' => Array ('id' => 'mysql','command' => 'mysql_connect','name' => 'MySql'
|
||||
),'pgsql' => Array ('id' => 'pgsql','command' => 'pg_connect','name' => 'PostgreSql'
|
||||
),'mssql' => Array ('id' => 'mssql','command' => 'mssql_connect','name' => 'Microsoft SQL Server'
|
||||
),'oracle' => Array ('id' => 'oracle','command' => 'oci_connect','name' => 'Oracle'
|
||||
$dbServices = array ('mysql' => array ('id' => 'mysql','command' => 'mysqli_connect','name' => 'MySql'
|
||||
),'pgsql' => array ('id' => 'pgsql','command' => 'pg_connect','name' => 'PostgreSql'
|
||||
),'mssql' => array ('id' => 'mssql','command' => 'mssql_connect','name' => 'Microsoft SQL Server'
|
||||
),'oracle' => array ('id' => 'oracle','command' => 'oci_connect','name' => 'Oracle'
|
||||
)
|
||||
);
|
||||
/*,
|
||||
@@ -218,7 +276,7 @@ class DbConnections
|
||||
*/
|
||||
|
||||
foreach ($dbServices as $service) {
|
||||
if (@function_exists( $service['command'] )) {
|
||||
if (@function_exists($service['command'])) {
|
||||
$servicesAvailables[] = $service;
|
||||
}
|
||||
}
|
||||
@@ -230,7 +288,7 @@ class DbConnections
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showMsg ()
|
||||
public function showMsg()
|
||||
{
|
||||
if ($this->errno != 0) {
|
||||
$msg = "
|
||||
@@ -254,91 +312,91 @@ class DbConnections
|
||||
* @param string $engine
|
||||
* @return $this->ordx($this->encodesList);
|
||||
*/
|
||||
public function getEncondeList ($engine = '')
|
||||
public function getEncondeList($engine = '')
|
||||
{
|
||||
switch ($engine) {
|
||||
default:
|
||||
case 'mysql':
|
||||
$encodes = Array (Array ('big5','big5 - Big5 Traditional Chinese'
|
||||
),Array ('dec8','dec8 - DEC West European'
|
||||
),Array ('cp850','cp850 - DOS West European'
|
||||
),Array ('hp8','hp8 - HP West European'
|
||||
),Array ('koi8r','koi8r - KOI8-R Relcom Russian'
|
||||
),Array ('latin1','latin1 - cp1252 West European'
|
||||
),Array ('latin2','latin2 - ISO 8859-2 Central European'
|
||||
),Array ('swe7','swe7 - 7bit Swedish'
|
||||
),Array ('ascii','ascii - US ASCII'
|
||||
),Array ('ujis','ujis - EUC-JP Japanese'
|
||||
),Array ('sjis','sjis - Shift-JIS Japanese'
|
||||
),Array ('hebrew','hebrew - ISO 8859-8 Hebrew'
|
||||
),Array ('tis620','tis620 - TIS620 Thai'
|
||||
),Array ('euckr','euckr - EUC-KR Korean'
|
||||
),Array ('koi8u','koi8u - KOI8-U Ukrainian'
|
||||
),Array ('gb2312','gb2312 - GB2312 Simplified Chinese'
|
||||
),Array ('greek','greek - ISO 8859-7 Greek'
|
||||
),Array ('cp1250','cp1250 - Windows Central European'
|
||||
),Array ('gbk','gbk - GBK Simplified Chinese'
|
||||
),Array ('latin5','latin5 - ISO 8859-9 Turkish'
|
||||
),Array ('armscii8','armscii8 - ARMSCII-8 Armenian'
|
||||
),Array ('utf8','utf8 - UTF-8 Unicode'
|
||||
),Array ('ucs2','ucs2 - UCS-2 Unicode'
|
||||
),Array ('cp866','cp866 - DOS Russian'
|
||||
),Array ('keybcs2','keybcs2 - DOS Kamenicky Czech-Slovak'
|
||||
),Array ('macce','macce - Mac Central European'
|
||||
),Array ('macroman','macroman - Mac West European'
|
||||
),Array ('cp852','cp852 - DOS Central European'
|
||||
),Array ('latin7','atin7 - ISO 8859-13 Baltic'
|
||||
),Array ('cp1251','cp1251 - Windows Cyrillic'
|
||||
),Array ('cp1256','cp1256 - Windows Arabic'
|
||||
),Array ('cp1257','cp1257 - Windows Baltic'
|
||||
),Array ('binary','binary - Binary pseudo charset'
|
||||
),Array ('geostd8','geostd8 - GEOSTD8 Georgian'
|
||||
),Array ('cp932','cp932] - SJIS for Windows Japanese'
|
||||
),Array ('eucjpms','eucjpms - UJIS for Windows Japanese'
|
||||
$encodes = array (array ('big5','big5 - Big5 Traditional Chinese'
|
||||
),array ('dec8','dec8 - DEC West European'
|
||||
),array ('cp850','cp850 - DOS West European'
|
||||
),array ('hp8','hp8 - HP West European'
|
||||
),array ('koi8r','koi8r - KOI8-R Relcom Russian'
|
||||
),array ('latin1','latin1 - cp1252 West European'
|
||||
),array ('latin2','latin2 - ISO 8859-2 Central European'
|
||||
),array ('swe7','swe7 - 7bit Swedish'
|
||||
),array ('ascii','ascii - US ASCII'
|
||||
),array ('ujis','ujis - EUC-JP Japanese'
|
||||
),array ('sjis','sjis - Shift-JIS Japanese'
|
||||
),array ('hebrew','hebrew - ISO 8859-8 Hebrew'
|
||||
),array ('tis620','tis620 - TIS620 Thai'
|
||||
),array ('euckr','euckr - EUC-KR Korean'
|
||||
),array ('koi8u','koi8u - KOI8-U Ukrainian'
|
||||
),array ('gb2312','gb2312 - GB2312 Simplified Chinese'
|
||||
),array ('greek','greek - ISO 8859-7 Greek'
|
||||
),array ('cp1250','cp1250 - Windows Central European'
|
||||
),array ('gbk','gbk - GBK Simplified Chinese'
|
||||
),array ('latin5','latin5 - ISO 8859-9 Turkish'
|
||||
),array ('armscii8','armscii8 - ARMSCII-8 Armenian'
|
||||
),array ('utf8','utf8 - UTF-8 Unicode'
|
||||
),array ('ucs2','ucs2 - UCS-2 Unicode'
|
||||
),array ('cp866','cp866 - DOS Russian'
|
||||
),array ('keybcs2','keybcs2 - DOS Kamenicky Czech-Slovak'
|
||||
),array ('macce','macce - Mac Central European'
|
||||
),array ('macroman','macroman - Mac West European'
|
||||
),array ('cp852','cp852 - DOS Central European'
|
||||
),array ('latin7','atin7 - ISO 8859-13 Baltic'
|
||||
),array ('cp1251','cp1251 - Windows Cyrillic'
|
||||
),array ('cp1256','cp1256 - Windows Arabic'
|
||||
),array ('cp1257','cp1257 - Windows Baltic'
|
||||
),array ('binary','binary - Binary pseudo charset'
|
||||
),array ('geostd8','geostd8 - GEOSTD8 Georgian'
|
||||
),array ('cp932','cp932] - SJIS for Windows Japanese'
|
||||
),array ('eucjpms','eucjpms - UJIS for Windows Japanese'
|
||||
)
|
||||
);
|
||||
|
||||
break;
|
||||
case 'pgsql':
|
||||
$encodes = Array (Array ("BIG5","BIG5"
|
||||
),Array ("EUC_CN","EUC_CN"
|
||||
),Array ("EUC_JP","EUC_JP"
|
||||
),Array ("EUC_KR","EUC_KR"
|
||||
),Array ("EUC_TW","EUC_TW"
|
||||
),Array ("GB18030","GB18030"
|
||||
),Array ("GBK","GBK"
|
||||
),Array ("ISO_8859_5","ISO_8859_5"
|
||||
),Array ("ISO_8859_6","ISO_8859_6"
|
||||
),Array ("ISO_8859_7","ISO_8859_7"
|
||||
),Array ("ISO_8859_8","ISO_8859_8"
|
||||
),Array ("JOHAB","JOHAB"
|
||||
),Array ("KOI8","KOI8"
|
||||
),Array ("selected","LATIN1"
|
||||
),Array ("LATIN2","LATIN2"
|
||||
),Array ("LATIN3","LATIN3"
|
||||
),Array ("LATIN4","LATIN4"
|
||||
),Array ("LATIN5","LATIN5"
|
||||
),Array ("LATIN6","LATIN6"
|
||||
),Array ("LATIN7","LATIN7"
|
||||
),Array ("LATIN8","LATIN8"
|
||||
),Array ("LATIN9","LATIN9"
|
||||
),Array ("LATIN10","LATIN10"
|
||||
),Array ("SJIS","SJIS"
|
||||
),Array ("SQL_ASCII","SQL_ASCII"
|
||||
),Array ("UHC","UHC"
|
||||
),Array ("UTF8","UTF8"
|
||||
),Array ("WIN866","WIN866"
|
||||
),Array ("WIN874","WIN874"
|
||||
),Array ("WIN1250","WIN1250"
|
||||
),Array ("WIN1251","WIN1251"
|
||||
),Array ("WIN1252","WIN1252"
|
||||
),Array ("WIN1256","WIN1256"
|
||||
),Array ("WIN1258","WIN1258"
|
||||
$encodes = array (array ("BIG5","BIG5"
|
||||
),array ("EUC_CN","EUC_CN"
|
||||
),array ("EUC_JP","EUC_JP"
|
||||
),array ("EUC_KR","EUC_KR"
|
||||
),array ("EUC_TW","EUC_TW"
|
||||
),array ("GB18030","GB18030"
|
||||
),array ("GBK","GBK"
|
||||
),array ("ISO_8859_5","ISO_8859_5"
|
||||
),array ("ISO_8859_6","ISO_8859_6"
|
||||
),array ("ISO_8859_7","ISO_8859_7"
|
||||
),array ("ISO_8859_8","ISO_8859_8"
|
||||
),array ("JOHAB","JOHAB"
|
||||
),array ("KOI8","KOI8"
|
||||
),array ("selected","LATIN1"
|
||||
),array ("LATIN2","LATIN2"
|
||||
),array ("LATIN3","LATIN3"
|
||||
),array ("LATIN4","LATIN4"
|
||||
),array ("LATIN5","LATIN5"
|
||||
),array ("LATIN6","LATIN6"
|
||||
),array ("LATIN7","LATIN7"
|
||||
),array ("LATIN8","LATIN8"
|
||||
),array ("LATIN9","LATIN9"
|
||||
),array ("LATIN10","LATIN10"
|
||||
),array ("SJIS","SJIS"
|
||||
),array ("SQL_ASCII","SQL_ASCII"
|
||||
),array ("UHC","UHC"
|
||||
),array ("UTF8","UTF8"
|
||||
),array ("WIN866","WIN866"
|
||||
),array ("WIN874","WIN874"
|
||||
),array ("WIN1250","WIN1250"
|
||||
),array ("WIN1251","WIN1251"
|
||||
),array ("WIN1252","WIN1252"
|
||||
),array ("WIN1256","WIN1256"
|
||||
),array ("WIN1258","WIN1258"
|
||||
)
|
||||
);
|
||||
break;
|
||||
case 'mssql':
|
||||
$encodes = Array (Array ('utf8','utf8 - UTF-8 Unicode'
|
||||
$encodes = array (array ('utf8','utf8 - UTF-8 Unicode'
|
||||
)
|
||||
);
|
||||
break;
|
||||
@@ -353,7 +411,7 @@ class DbConnections
|
||||
}
|
||||
|
||||
$this->encodesList = $encodes;
|
||||
return $this->ordx( $this->encodesList );
|
||||
return $this->ordx($this->encodesList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,7 +419,7 @@ class DbConnections
|
||||
*
|
||||
* @return integer $errno
|
||||
*/
|
||||
public function getErrno ()
|
||||
public function getErrno()
|
||||
{
|
||||
return $this->errno;
|
||||
}
|
||||
@@ -371,7 +429,7 @@ class DbConnections
|
||||
*
|
||||
* @return string errstr
|
||||
*/
|
||||
public function getErrmsg ()
|
||||
public function getErrmsg()
|
||||
{
|
||||
return $this->errstr;
|
||||
}
|
||||
@@ -382,19 +440,19 @@ class DbConnections
|
||||
* @param array $m
|
||||
* @return array $aRet
|
||||
*/
|
||||
public function ordx ($m)
|
||||
public function ordx($m)
|
||||
{
|
||||
$aTmp = Array ();
|
||||
$aRet = Array ();
|
||||
for ($i = 0; $i < count( $m ); $i ++) {
|
||||
array_push( $aTmp, $m[$i][0] . '|' . $m[$i][1] );
|
||||
$aTmp = array ();
|
||||
$aRet = array ();
|
||||
for ($i = 0; $i < count($m); $i ++) {
|
||||
array_push($aTmp, $m[$i][0] . '|' . $m[$i][1]);
|
||||
}
|
||||
usort( $aTmp, "strnatcasecmp" );
|
||||
usort($aTmp, "strnatcasecmp");
|
||||
|
||||
for ($i = 0; $i < count( $aTmp ); $i ++) {
|
||||
$x = explode( '|', $aTmp[$i] );
|
||||
array_push( $aRet, Array ($x[0],$x[1]
|
||||
) );
|
||||
for ($i = 0; $i < count($aTmp); $i ++) {
|
||||
$x = explode('|', $aTmp[$i]);
|
||||
array_push($aRet, array ($x[0],$x[1]
|
||||
));
|
||||
}
|
||||
return $aRet;
|
||||
}
|
||||
@@ -407,30 +465,30 @@ class DbConnections
|
||||
* @param string proUid
|
||||
* @return void
|
||||
*/
|
||||
public function encryptThepassw ($proUid)
|
||||
public function encryptThepassw($proUid)
|
||||
{
|
||||
$oDBSource = new DbSource();
|
||||
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_UID );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_DATABASE_NAME );
|
||||
$c->addSelectColumn( DbSourcePeer::DBS_PASSWORD );
|
||||
$c->add( DbSourcePeer::PRO_UID, $proUid );
|
||||
$result = DbSourcePeer::doSelectRS( $c );
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_UID);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_DATABASE_NAME);
|
||||
$c->addSelectColumn(DbSourcePeer::DBS_PASSWORD);
|
||||
$c->add(DbSourcePeer::PRO_UID, $proUid);
|
||||
$result = DbSourcePeer::doSelectRS($c);
|
||||
$result->next();
|
||||
$row = $result->getRow();
|
||||
while ($row = $result->getRow()) {
|
||||
if ($row[2] != '') {
|
||||
$aPass = explode( '_', $row[2] );
|
||||
if (count( $aPass ) == 1) {
|
||||
$passEncrypt = G::encrypt( $row[2], $row[1] );
|
||||
$aPass = explode('_', $row[2]);
|
||||
if (count($aPass) == 1) {
|
||||
$passEncrypt = G::encrypt($row[2], $row[1]);
|
||||
$passEncrypt .= "_2NnV3ujj3w";
|
||||
$c2 = new Criteria( 'workflow' );
|
||||
$c2->add( DbSourcePeer::DBS_PASSWORD, $passEncrypt );
|
||||
$c3 = new Criteria( 'workflow' );
|
||||
$c3->add( DbSourcePeer::DBS_UID, $row[0] );
|
||||
BasePeer::doUpdate( $c3, $c2, Propel::getConnection( 'workflow' ) );
|
||||
$c2 = new Criteria('workflow');
|
||||
$c2->add(DbSourcePeer::DBS_PASSWORD, $passEncrypt);
|
||||
$c3 = new Criteria('workflow');
|
||||
$c3->add(DbSourcePeer::DBS_UID, $row[0]);
|
||||
BasePeer::doUpdate($c3, $c2, Propel::getConnection('workflow'));
|
||||
}
|
||||
}
|
||||
$result->next();
|
||||
@@ -446,11 +504,11 @@ class DbConnections
|
||||
* @param string passw
|
||||
* @return string
|
||||
*/
|
||||
public function getPassWithoutEncrypt ($aInfoCon)
|
||||
public function getPassWithoutEncrypt($aInfoCon)
|
||||
{
|
||||
$passw = '';
|
||||
if ($aInfoCon['DBS_PASSWORD'] != '') {
|
||||
$aPassw = explode( '_', $aInfoCon['DBS_PASSWORD'] );
|
||||
$aPassw = explode('_', $aInfoCon['DBS_PASSWORD']);
|
||||
$passw = $aPassw[0];
|
||||
|
||||
$flagTns = ($aInfoCon["DBS_TYPE"] == "oracle" && $aInfoCon["DBS_CONNECTION_TYPE"] == "TNS")? 1 : 0;
|
||||
|
||||
@@ -18,10 +18,13 @@ class DynaFormField extends DBTable
|
||||
/**
|
||||
* Function SetTo
|
||||
*
|
||||
* @param string $objConnection
|
||||
* @param object $objConnection connection string
|
||||
* @param string $strTable Table name defaultValue=''
|
||||
* @param array $arrKeys table keys defaultValue=UID
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function SetTo($objConnection)
|
||||
public function SetTo($objConnection, $strTable = "", $arrKeys = array('UID'))
|
||||
{
|
||||
DBTable::SetTo($objConnection, 'dynaForm', array('XMLNODE_NAME'
|
||||
));
|
||||
@@ -33,7 +36,7 @@ class DynaFormField extends DBTable
|
||||
* @param string $sUID
|
||||
* @return void
|
||||
*/
|
||||
public function Load($sUID)
|
||||
public function Load($sUID = null)
|
||||
{
|
||||
parent::Load($sUID);
|
||||
if (is_array($this->Fields)) {
|
||||
@@ -51,7 +54,7 @@ class DynaFormField extends DBTable
|
||||
* @param string $uid
|
||||
* @return void
|
||||
*/
|
||||
public function Delete($uid)
|
||||
public function Delete($uid=null)
|
||||
{
|
||||
$this->Fields['XMLNODE_NAME'] = $uid;
|
||||
parent::Delete();
|
||||
@@ -65,7 +68,7 @@ class DynaFormField extends DBTable
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
public function Save($Fields, $labels = array(), $options = array())
|
||||
public function Save($Fields=null, $labels = array(), $options = array())
|
||||
{
|
||||
|
||||
if ($Fields['TYPE'] === 'javascript') {
|
||||
|
||||
@@ -1,294 +1,275 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created on 21/12/2007
|
||||
* Dynaform - Dynaform
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class DynaformEditor extends WebResource
|
||||
{
|
||||
|
||||
private $isOldCopy = false;
|
||||
public $file = '';
|
||||
public $title = 'New Dynaform';
|
||||
public $dyn_uid = '';
|
||||
public $dyn_type = '';
|
||||
public $home = '';
|
||||
|
||||
/**
|
||||
* Other Options for Editor:
|
||||
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
|
||||
* top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))',
|
||||
* height: '3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)',
|
||||
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))'
|
||||
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))'
|
||||
*
|
||||
* Other Options for Toolbar:
|
||||
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
|
||||
* top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))',
|
||||
*/
|
||||
public $defaultConfig = array('Editor' => array('left' => '0', 'top' => '0', 'width' => 'document.body.clientWidth-4', 'height' => 'document.body.clientHeight-4'),
|
||||
'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7', 'top' => '52'),
|
||||
'FieldsList' => array('left' => '4+toolbar.clientWidth+24', 'top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', 'width' => 244, 'height' => 400)
|
||||
);
|
||||
public $panelConf = array('style' => array('title' => array('textAlign' => 'center')),
|
||||
'width' => 700, 'height' => 600, 'tabWidth' => 120, 'modal' => true, 'drag' => false, 'resize' => false, 'blinkToFront' => false
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor of the class dynaformEditor
|
||||
*
|
||||
* @param string $get
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($get)
|
||||
{
|
||||
$this->panelConf = array_merge($this->panelConf, $this->defaultConfig['Editor']);
|
||||
//'title' => G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$this->title.']',
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the xml form default
|
||||
*
|
||||
* @param string $filename
|
||||
* @return void
|
||||
*/
|
||||
public function _createDefaultXmlForm($fileName)
|
||||
{
|
||||
//Create the default Dynaform
|
||||
$sampleForm = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||
$sampleForm .= '<dynaForm type="' . $this->dyn_type . '" name="" width="500" enabletemplate="0" mode="edit">' . "\n";
|
||||
switch ($this->dyn_type) {
|
||||
case "xmlform":
|
||||
/* $sampleForm.='<title type="title" enablehtml="0">' . "\n" .
|
||||
' <en>Sample form</en>' . "\n" .
|
||||
'</title>'."\n";
|
||||
$sampleForm.='<submit type="submit" enablehtml="0" onclick="">' . "\n" .
|
||||
' <en>Submit</en>' . "\n" .
|
||||
'</submit>'."\n"; */
|
||||
break;
|
||||
case "grid":
|
||||
/* $sampleForm.='<fieldA type="text" >' . "\n" .
|
||||
'<en>A</en>' . "\n" .
|
||||
'</fieldA>'."\n";
|
||||
$sampleForm.='<fieldB type="text" >' . "\n" .
|
||||
'<en>B</en>' . "\n" .
|
||||
'</fieldB>'."\n"; */
|
||||
break;
|
||||
}
|
||||
$sampleForm .= '</dynaForm>';
|
||||
G::verifyPath(dirname($fileName), true);
|
||||
$fp = fopen($fileName, 'w');
|
||||
$sampleForm = str_replace('name=""', 'name="' . $this->_getFilename($this->file) . '"', $sampleForm);
|
||||
fwrite($fp, $sampleForm);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the DynaformEditor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _render()
|
||||
{
|
||||
global $G_PUBLISH;
|
||||
$script = '';
|
||||
|
||||
/* Start Block: Load (Create if doesn't exist) the xmlform */
|
||||
$Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor
|
||||
);
|
||||
$_SESSION['Current_Dynafom']['Parameters'] = $Parameters;
|
||||
|
||||
$XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '' //$openDoc->getXml()
|
||||
);
|
||||
$JSEditor = array('URL' => G::encrypt($this->file, URL_KEY)
|
||||
);
|
||||
|
||||
$A = G::encrypt($this->file, URL_KEY);
|
||||
|
||||
try {
|
||||
$openDoc = new Xml_Document();
|
||||
$fileName = $this->home . $this->file . '.xml';
|
||||
if (file_exists($fileName)) {
|
||||
$openDoc->parseXmlFile($fileName);
|
||||
} else {
|
||||
$this->_createDefaultXmlForm($fileName);
|
||||
$openDoc->parseXmlFile($fileName);
|
||||
}
|
||||
//$form = new Form( $this->file , $this->home, SYS_LANG, true );
|
||||
$Properties = DynaformEditorAjax::get_properties($A, $this->dyn_uid);
|
||||
/* Start Block: Prepare the XMLDB connection */
|
||||
define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml');
|
||||
define('DB_XMLDB_USER', '');
|
||||
define('DB_XMLDB_PASS', '');
|
||||
define('DB_XMLDB_NAME', '');
|
||||
define('DB_XMLDB_TYPE', 'myxml');
|
||||
/* Start Block: Prepare the dynaformEditor */
|
||||
$G_PUBLISH = new Publisher();
|
||||
$sName = 'dynaformEditor';
|
||||
$G_PUBLISH->publisherId = $sName;
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']);
|
||||
$G_PUBLISH->AddContent('blank');
|
||||
$this->panelConf['title'] = '';
|
||||
$G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf);
|
||||
if ($Properties['DYN_TYPE'] == 'xmlform') {
|
||||
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', '');
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', '');
|
||||
}
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', '');
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', '');
|
||||
$G_PUBLISH->AddContent('blank');
|
||||
$i = 0;
|
||||
$aFields = array();
|
||||
$aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char'
|
||||
);
|
||||
$oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml'));
|
||||
$oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
|
||||
$iMaximun = $oDataset->count();
|
||||
while ($aRow = $oDataset->Read()) {
|
||||
$aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), 'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : ''), 'row__' => ($i + 1)
|
||||
);
|
||||
$i++;
|
||||
break;
|
||||
}
|
||||
global $_DBArray;
|
||||
$_DBArray['fields'] = $aFields;
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
$oCriteria = new Criteria('dbarray');
|
||||
$oCriteria->setDBArrayTable('fields');
|
||||
/**
|
||||
* *@Erik-> this is deprecated,.
|
||||
* (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');**
|
||||
*/
|
||||
$G_PUBLISH->AddContent('blank');
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', '');
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', '');
|
||||
//for showHide tab option @Neyek
|
||||
$G_PUBLISH->AddContent('blank');
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView');
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView');
|
||||
if ($Properties['DYN_TYPE'] != 'grid') {
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView');
|
||||
}
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView');
|
||||
if ($Properties["DYN_TYPE"] != "grid") {
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView');
|
||||
}
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView');
|
||||
|
||||
//for showHide tab option @Neyek
|
||||
if ($Properties["DYN_TYPE"] != "grid") {
|
||||
$G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide");
|
||||
}
|
||||
|
||||
$G_PUBLISH->AddContent('panel-close');
|
||||
$oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js",2);
|
||||
$oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js');
|
||||
|
||||
$oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js',1);
|
||||
|
||||
$oHeadPublisher->addScriptFile('/js/grid/core/grid.js');
|
||||
$oHeadPublisher->addScriptCode('
|
||||
var DYNAFORM_URL="' . $Parameters['URL'] . '";
|
||||
leimnud.event.add(window,"load",function(){ loadEditor(); });
|
||||
');
|
||||
$oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLoggedDE__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";');
|
||||
|
||||
$arrayParameterAux = $Parameters;
|
||||
$arrayParameterAux["DYNAFORM_NAME"] = base64_encode($arrayParameterAux["DYNAFORM_NAME"]);
|
||||
$oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($arrayParameterAux) . '\';');
|
||||
|
||||
G::RenderPage("publish", 'blank');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename
|
||||
*
|
||||
* @param string $file
|
||||
* @return string
|
||||
*/
|
||||
public function _getFilename($file)
|
||||
{
|
||||
return (strcasecmp(substr($file, - 5), '_tmp0') == 0) ? substr($file, 0, strlen($file) - 5) : $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the temporal copy
|
||||
*
|
||||
* @param string $onOff
|
||||
* @return void
|
||||
*/
|
||||
public function _setUseTemporalCopy($onOff)
|
||||
{
|
||||
$file = self::_getFilename($this->file);
|
||||
if ($onOff) {
|
||||
$this->file = $file . '_tmp0';
|
||||
self::_setTmpData(array('useTmpCopy' => true ));
|
||||
if (!file_exists(PATH_DYNAFORM . $file . '.xml')) {
|
||||
$this->_createDefaultXmlForm(PATH_DYNAFORM . $file . '.xml');
|
||||
}
|
||||
//Creates a copy if it doesn't exist, else, use the old copy
|
||||
if (!file_exists(PATH_DYNAFORM . $this->file . '.xml')) {
|
||||
self::_copyFile(PATH_DYNAFORM . $file . '.xml', PATH_DYNAFORM . $this->file . '.xml');
|
||||
}
|
||||
if (!file_exists(PATH_DYNAFORM . $this->file . '.html') && file_exists(PATH_DYNAFORM . $file . '.html')) {
|
||||
self::_copyFile(PATH_DYNAFORM . $file . '.html', PATH_DYNAFORM . $this->file . '.html');
|
||||
}
|
||||
} else {
|
||||
$this->file = $file;
|
||||
self::_setTmpData(array());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set temporal data
|
||||
*
|
||||
* @param $data
|
||||
* @return void
|
||||
*/
|
||||
public function _setTmpData($data)
|
||||
{
|
||||
G::verifyPath(PATH_C . 'dynEditor/', true);
|
||||
$fp = fopen(PATH_C . 'dynEditor/' . session_id() . '.php', 'w');
|
||||
fwrite($fp, '$tmpData=unserialize(\'' . addcslashes(serialize($data), '\\\'') . '\');');
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get temporal data
|
||||
*
|
||||
* @param string $filename
|
||||
* @return array
|
||||
*/
|
||||
public function _getTmpData()
|
||||
{
|
||||
$tmpData = array();
|
||||
$file = PATH_C . 'dynEditor/' . session_id() . '.php';
|
||||
if (file_exists($file)) {
|
||||
eval(implode('', file($file)));
|
||||
}
|
||||
return $tmpData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy files
|
||||
*
|
||||
* @param file $from
|
||||
* @param file $to
|
||||
* @return void
|
||||
*/
|
||||
public function _copyFile($from, $to)
|
||||
{
|
||||
$copy = implode('', file($from));
|
||||
$fcopy = fopen($to, "w");
|
||||
fwrite($fcopy, $copy);
|
||||
fclose($fcopy);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created on 21/12/2007
|
||||
* Dynaform - Dynaform
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
class DynaformEditor extends WebResource
|
||||
{
|
||||
private $isOldCopy = false;
|
||||
public $file = '';
|
||||
public $title = 'New Dynaform';
|
||||
public $dyn_uid = '';
|
||||
public $dyn_type = '';
|
||||
public $home = '';
|
||||
|
||||
/**
|
||||
* Other Options for Editor:
|
||||
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
|
||||
* top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))',
|
||||
* height: '3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)',
|
||||
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))'
|
||||
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))'
|
||||
*
|
||||
* Other Options for Toolbar:
|
||||
* left: 'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
|
||||
* top: 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))',
|
||||
*/
|
||||
public $defaultConfig = array('Editor' => array('left' => '0', 'top' => '0', 'width' => 'document.body.clientWidth-4', 'height' => 'document.body.clientHeight-4'),
|
||||
'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7', 'top' => '52'),
|
||||
'FieldsList' => array('left' => '4+toolbar.clientWidth+24', 'top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))', 'width' => 244, 'height' => 400)
|
||||
);
|
||||
public $panelConf = array('style' => array('title' => array('textAlign' => 'center')),
|
||||
'width' => 700, 'height' => 600, 'tabWidth' => 120, 'modal' => true, 'drag' => false, 'resize' => false, 'blinkToFront' => false
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor of the class dynaformEditor
|
||||
*
|
||||
* @param string $get
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($get)
|
||||
{
|
||||
$this->panelConf = array_merge($this->panelConf, $this->defaultConfig['Editor']);
|
||||
//'title' => G::LoadTranslation('ID_DYNAFORM_EDITOR').' - ['.$this->title.']',
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the xml form default
|
||||
*
|
||||
* @param string $filename
|
||||
* @return void
|
||||
*/
|
||||
public function _createDefaultXmlForm($fileName)
|
||||
{
|
||||
//Create the default Dynaform
|
||||
$sampleForm = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||
$sampleForm .= '<dynaForm type="' . $this->dyn_type . '" name="" width="500" enabletemplate="0" mode="edit">' . "\n";
|
||||
|
||||
$sampleForm .= '</dynaForm>';
|
||||
G::verifyPath(dirname($fileName), true);
|
||||
$fp = fopen($fileName, 'w');
|
||||
$sampleForm = str_replace('name=""', 'name="' . $this->_getFilename($this->file) . '"', $sampleForm);
|
||||
fwrite($fp, $sampleForm);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the DynaformEditor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function _render()
|
||||
{
|
||||
global $G_PUBLISH;
|
||||
$script = '';
|
||||
|
||||
/* Start Block: Load (Create if doesn't exist) the xmlform */
|
||||
$Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor
|
||||
);
|
||||
$_SESSION['Current_Dynafom']['Parameters'] = $Parameters;
|
||||
|
||||
$XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '' //$openDoc->getXml()
|
||||
);
|
||||
$JSEditor = array('URL' => G::encrypt($this->file, URL_KEY)
|
||||
);
|
||||
|
||||
$A = G::encrypt($this->file, URL_KEY);
|
||||
|
||||
try {
|
||||
$openDoc = new Xml_Document();
|
||||
$fileName = $this->home . $this->file . '.xml';
|
||||
if (file_exists($fileName)) {
|
||||
$openDoc->parseXmlFile($fileName);
|
||||
} else {
|
||||
$this->_createDefaultXmlForm($fileName);
|
||||
$openDoc->parseXmlFile($fileName);
|
||||
}
|
||||
//$form = new Form( $this->file , $this->home, SYS_LANG, true );
|
||||
$Properties = DynaformEditorAjax::get_properties($A, $this->dyn_uid);
|
||||
/* Start Block: Prepare the XMLDB connection */
|
||||
define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml');
|
||||
define('DB_XMLDB_USER', '');
|
||||
define('DB_XMLDB_PASS', '');
|
||||
define('DB_XMLDB_NAME', '');
|
||||
define('DB_XMLDB_TYPE', 'myxml');
|
||||
/* Start Block: Prepare the dynaformEditor */
|
||||
$G_PUBLISH = new Publisher();
|
||||
$sName = 'dynaformEditor';
|
||||
$G_PUBLISH->publisherId = $sName;
|
||||
$oHeadPublisher = headPublisher::getSingleton();
|
||||
$oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']);
|
||||
$G_PUBLISH->AddContent('blank');
|
||||
$this->panelConf['title'] = '';
|
||||
$G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf);
|
||||
if ($Properties['DYN_TYPE'] == 'xmlform') {
|
||||
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', '');
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', '');
|
||||
}
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', '');
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', '');
|
||||
$G_PUBLISH->AddContent('blank');
|
||||
$i = 0;
|
||||
$aFields = array();
|
||||
$aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char'
|
||||
);
|
||||
$oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml'));
|
||||
$oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
|
||||
$iMaximun = $oDataset->count();
|
||||
while ($aRow = $oDataset->Read()) {
|
||||
$aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''), 'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : ''), 'row__' => ($i + 1)
|
||||
);
|
||||
$i++;
|
||||
break;
|
||||
}
|
||||
global $_DBArray;
|
||||
$_DBArray['fields'] = $aFields;
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
$oCriteria = new Criteria('dbarray');
|
||||
$oCriteria->setDBArrayTable('fields');
|
||||
/**
|
||||
* *@Erik-> this is deprecated,.
|
||||
* (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');**
|
||||
*/
|
||||
$G_PUBLISH->AddContent('blank');
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', '');
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', '');
|
||||
//for showHide tab option @Neyek
|
||||
$G_PUBLISH->AddContent('blank');
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView');
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView');
|
||||
if ($Properties['DYN_TYPE'] != 'grid') {
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView');
|
||||
}
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView');
|
||||
if ($Properties["DYN_TYPE"] != "grid") {
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView');
|
||||
}
|
||||
$G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView');
|
||||
|
||||
//for showHide tab option @Neyek
|
||||
if ($Properties["DYN_TYPE"] != "grid") {
|
||||
$G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide");
|
||||
}
|
||||
|
||||
$G_PUBLISH->AddContent('panel-close');
|
||||
$oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js", 2);
|
||||
$oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js');
|
||||
|
||||
$oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js', 1);
|
||||
|
||||
$oHeadPublisher->addScriptFile('/js/grid/core/grid.js');
|
||||
$oHeadPublisher->addScriptCode('
|
||||
var DYNAFORM_URL="' . $Parameters['URL'] . '";
|
||||
leimnud.event.add(window,"load",function(){ loadEditor(); });
|
||||
');
|
||||
$oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLoggedDE__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";');
|
||||
|
||||
$arrayParameterAux = $Parameters;
|
||||
$arrayParameterAux["DYNAFORM_NAME"] = base64_encode($arrayParameterAux["DYNAFORM_NAME"]);
|
||||
$oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($arrayParameterAux) . '\';');
|
||||
|
||||
G::RenderPage("publish", 'blank');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename
|
||||
*
|
||||
* @param string $file
|
||||
* @return string
|
||||
*/
|
||||
public function _getFilename($file)
|
||||
{
|
||||
return (strcasecmp(substr($file, - 5), '_tmp0') == 0) ? substr($file, 0, strlen($file) - 5) : $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the temporal copy
|
||||
*
|
||||
* @param string $onOff
|
||||
* @return void
|
||||
*/
|
||||
public function _setUseTemporalCopy($onOff)
|
||||
{
|
||||
$file = self::_getFilename($this->file);
|
||||
if ($onOff) {
|
||||
$this->file = $file . '_tmp0';
|
||||
self::_setTmpData(array('useTmpCopy' => true ));
|
||||
if (!file_exists(PATH_DYNAFORM . $file . '.xml')) {
|
||||
$this->_createDefaultXmlForm(PATH_DYNAFORM . $file . '.xml');
|
||||
}
|
||||
//Creates a copy if it doesn't exist, else, use the old copy
|
||||
if (!file_exists(PATH_DYNAFORM . $this->file . '.xml')) {
|
||||
self::_copyFile(PATH_DYNAFORM . $file . '.xml', PATH_DYNAFORM . $this->file . '.xml');
|
||||
}
|
||||
if (!file_exists(PATH_DYNAFORM . $this->file . '.html') && file_exists(PATH_DYNAFORM . $file . '.html')) {
|
||||
self::_copyFile(PATH_DYNAFORM . $file . '.html', PATH_DYNAFORM . $this->file . '.html');
|
||||
}
|
||||
} else {
|
||||
$this->file = $file;
|
||||
self::_setTmpData(array());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set temporal data
|
||||
*
|
||||
* @param $data
|
||||
* @return void
|
||||
*/
|
||||
public function _setTmpData($data)
|
||||
{
|
||||
G::verifyPath(PATH_C . 'dynEditor/', true);
|
||||
$fp = fopen(PATH_C . 'dynEditor/' . session_id() . '.php', 'w');
|
||||
fwrite($fp, '$tmpData=unserialize(\'' . addcslashes(serialize($data), '\\\'') . '\');');
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get temporal data
|
||||
*
|
||||
* @param string $filename
|
||||
* @return array
|
||||
*/
|
||||
public function _getTmpData()
|
||||
{
|
||||
$tmpData = array();
|
||||
$file = PATH_C . 'dynEditor/' . session_id() . '.php';
|
||||
if (file_exists($file)) {
|
||||
eval(implode('', file($file)));
|
||||
}
|
||||
return $tmpData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy files
|
||||
*
|
||||
* @param file $from
|
||||
* @param file $to
|
||||
* @return void
|
||||
*/
|
||||
public function _copyFile($from, $to)
|
||||
{
|
||||
$copy = implode('', file($from));
|
||||
$fcopy = fopen($to, "w");
|
||||
fwrite($fcopy, $copy);
|
||||
fclose($fcopy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class EnterpriseClass extends PMPlugin
|
||||
if (count(glob(PATH_DATA_SITE . 'license/*.dat')) == 0) {
|
||||
return;
|
||||
}
|
||||
require_once ("classes/model/Users.php");
|
||||
require_once("classes/model/Users.php");
|
||||
$user = $data;
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
@@ -45,26 +45,9 @@ class EnterpriseClass extends PMPlugin
|
||||
$sw = 0;
|
||||
|
||||
if (UsersPeer::doCount($criteria) > 0) {
|
||||
//if ($rsSQLUSR->getRecordCount() > 0) {
|
||||
$sw = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
$cnn = Propel::getConnection("workflow");
|
||||
$stmt = $cnn->createStatement();
|
||||
|
||||
$sql = "SELECT USR.USR_UID
|
||||
FROM USERS AS USR
|
||||
WHERE USR.USR_USERNAME = '" . $user->lName . "' AND USR.USR_ROLE = 'PROCESSMAKER_ADMIN'";
|
||||
$rsSQLUSR = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$sw = 0;
|
||||
|
||||
if ($rsSQLUSR->getRecordCount() > 0) {
|
||||
$sw = 1;
|
||||
}
|
||||
*/
|
||||
|
||||
if ($sw == 1) {
|
||||
//Upgrade available
|
||||
$swUpgrade = 0;
|
||||
@@ -78,7 +61,8 @@ class EnterpriseClass extends PMPlugin
|
||||
|
||||
foreach ($addon as $index => $value) {
|
||||
if ($addon[$index]["id"] == "processmaker") {
|
||||
if (version_compare($pmVersion . "", (EnterpriseUtils::pmVersion($addon[$index]["version"])) . "", "<")) {
|
||||
if (version_compare($pmVersion . "",
|
||||
(EnterpriseUtils::pmVersion($addon[$index]["version"])) . "", "<")) {
|
||||
$swUpgrade = 1;
|
||||
break;
|
||||
}
|
||||
@@ -99,23 +83,23 @@ class EnterpriseClass extends PMPlugin
|
||||
|
||||
public function enterpriseLimitCreateUser()
|
||||
{
|
||||
$oServerConf = &ServerConf::getSingleton();
|
||||
$infoLicense =$oServerConf->getProperty('LICENSE_INFO');
|
||||
$oServerConf = ServerConf::getSingleton();
|
||||
$infoLicense = $oServerConf->getProperty('LICENSE_INFO');
|
||||
if (isset($infoLicense[config("system.workspace")]['LIMIT_USERS'])) {
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
|
||||
$count = UsersPeer::doCount($criteria);
|
||||
if ($count >= $infoLicense[config("system.workspace")]['LIMIT_USERS'] ) {
|
||||
if ($count >= $infoLicense[config("system.workspace")]['LIMIT_USERS']) {
|
||||
throw new Exception("You can\'t add more users to the System, this reach the limit of allowed users by license that it has installed now");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setHashPassword ($object)
|
||||
public function setHashPassword($object)
|
||||
{
|
||||
$type = array('md5', 'sha256');
|
||||
if (!in_array($object->hash, $type)) {
|
||||
throw new Exception( 'Type: ' . $object->hash. ' No valid.');
|
||||
throw new Exception('Type: ' . $object->hash . ' No valid.');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,7 +122,7 @@ class EnterpriseClass extends PMPlugin
|
||||
$criteria->add(RbacUsersPeer::USR_STATUS, 0, Criteria::NOT_EQUAL);
|
||||
$dataset = RbacUsersPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
|
||||
while ($dataset->next()) {
|
||||
$row = $dataset->getRow();
|
||||
$property = $userProperty->loadOrCreateIfNotExists($row['USR_UID'], array());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -144,8 +144,8 @@ class LdapAdvanced
|
||||
/**
|
||||
* Set User to this Authentication Source
|
||||
*
|
||||
* @param string $userUid UID of User
|
||||
* @param array $arrayUserLdap User LDAP data
|
||||
* @param string $userUid UID of User
|
||||
* @param array $arrayUserLdap User LDAP data
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
@@ -296,8 +296,8 @@ class LdapAdvanced
|
||||
public function progressBar($total, $count)
|
||||
{
|
||||
try {
|
||||
$p = (int) (($count * 100) / $total);
|
||||
$n = (int) ($p / 2);
|
||||
$p = (int)(($count * 100) / $total);
|
||||
$n = (int)($p / 2);
|
||||
|
||||
return "[" . str_repeat("|", $n) . str_repeat(" ", 50 - $n) . "] $p%";
|
||||
} catch (Exception $e) {
|
||||
@@ -309,7 +309,7 @@ class LdapAdvanced
|
||||
* Show front end
|
||||
*
|
||||
* @param string $option Option
|
||||
* @param string $data Data string
|
||||
* @param string $data Data string
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
@@ -587,14 +587,14 @@ class LdapAdvanced
|
||||
/**
|
||||
* Get Users from Department (Search result identifier)
|
||||
*
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param resource $searchResult Search result identifier
|
||||
* @param string $option Option (GET, SYNCHRONIZE)
|
||||
* @param string $dn DN
|
||||
* @param string $uidUserIdentifier User identifier
|
||||
* @param int $totalUser Total users
|
||||
* @param int $countUser User counter
|
||||
* @param array $arrayData Data
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param resource $searchResult Search result identifier
|
||||
* @param string $option Option (GET, SYNCHRONIZE)
|
||||
* @param string $dn DN
|
||||
* @param string $uidUserIdentifier User identifier
|
||||
* @param int $totalUser Total users
|
||||
* @param int $countUser User counter
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return an array data
|
||||
*/
|
||||
@@ -663,9 +663,9 @@ class LdapAdvanced
|
||||
/**
|
||||
* Get Users from Department
|
||||
*
|
||||
* @param string $option Option (GET, SYNCHRONIZE)
|
||||
* @param string $dn DN of Department
|
||||
* @param array $arrayData Data
|
||||
* @param string $option Option (GET, SYNCHRONIZE)
|
||||
* @param string $dn DN of Department
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return an array with data Users or array data
|
||||
*/
|
||||
@@ -681,7 +681,7 @@ class LdapAdvanced
|
||||
|
||||
//Set variables
|
||||
$dn = trim($dn);
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->authSourcesObj)) {
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
@@ -792,12 +792,12 @@ class LdapAdvanced
|
||||
/**
|
||||
* Synchronize Group's members
|
||||
*
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param array $arrayAuthSourceData Authentication Source Data
|
||||
* @param string $groupUid Unique id of Group
|
||||
* @param array $arrayGroupLdap LDAP Group
|
||||
* @param string $memberAttribute Member attribute
|
||||
* @param array $arrayData Data
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param array $arrayAuthSourceData Authentication Source Data
|
||||
* @param string $groupUid Unique id of Group
|
||||
* @param array $arrayGroupLdap LDAP Group
|
||||
* @param string $memberAttribute Member attribute
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* @return array Return array data
|
||||
*/
|
||||
@@ -812,7 +812,7 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
$uidUserIdentifier = (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'])) ?
|
||||
$arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : 'uid';
|
||||
$arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : 'uid';
|
||||
|
||||
$filterUsers = trim($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_USERS_FILTER']);
|
||||
|
||||
@@ -843,18 +843,21 @@ class LdapAdvanced
|
||||
|
||||
$username = (isset($arrayUserLdap[$uidUserIdentifier])) ? $arrayUserLdap[$uidUserIdentifier] : '';
|
||||
|
||||
$arrayData['countUser'] ++;
|
||||
$arrayData['countUser']++;
|
||||
|
||||
if ((is_array($username) && !empty($username)) || trim($username) != '') {
|
||||
$arrayData = $this->groupSynchronizeUser(
|
||||
$groupUid, $this->getUserDataFromAttribute($username, $arrayUserLdap), $arrayData
|
||||
$groupUid,
|
||||
$this->getUserDataFromAttribute($username, $arrayUserLdap),
|
||||
$arrayData
|
||||
);
|
||||
}
|
||||
|
||||
//Progress bar
|
||||
$this->frontEndShow(
|
||||
'BAR', 'Groups: ' . $arrayData['i'] . '/' . $arrayData['n'] . ' ' .
|
||||
$this->progressBar($arrayData['totalUser'], $arrayData['countUser'])
|
||||
'BAR',
|
||||
'Groups: ' . $arrayData['i'] . '/' . $arrayData['n'] . ' ' .
|
||||
$this->progressBar($arrayData['totalUser'], $arrayData['countUser'])
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -872,9 +875,9 @@ class LdapAdvanced
|
||||
/**
|
||||
* Get Users from Group
|
||||
*
|
||||
* @param string $option Option (SYNCHRONIZE)
|
||||
* @param array $arrayGroupData Group data
|
||||
* @param array $arrayData Data
|
||||
* @param string $option Option (SYNCHRONIZE)
|
||||
* @param array $arrayGroupData Group data
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return array data
|
||||
*/
|
||||
@@ -889,7 +892,7 @@ class LdapAdvanced
|
||||
|
||||
//Set variables
|
||||
$dn = trim($arrayGroupData["GRP_LDAP_DN"]);
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->authSourcesObj)) {
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
@@ -944,7 +947,12 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
$arrayData = $this->__ldapGroupSynchronizeMembers(
|
||||
$ldapcnn, $arrayAuthenticationSourceData, $arrayGroupData['GRP_UID'], $arrayGroupLdap, $memberAttribute2, array_merge($arrayData, ['totalUser' => $totalUser, 'countUser' => $countUser])
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData,
|
||||
$arrayGroupData['GRP_UID'],
|
||||
$arrayGroupLdap,
|
||||
$memberAttribute2,
|
||||
array_merge($arrayData, ['totalUser' => $totalUser, 'countUser' => $countUser])
|
||||
);
|
||||
|
||||
$totalUser = $arrayData['totalUser'];
|
||||
@@ -977,7 +985,12 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
$arrayData = $this->__ldapGroupSynchronizeMembers(
|
||||
$ldapcnn, $arrayAuthenticationSourceData, $arrayGroupData['GRP_UID'], $arrayGroupLdap, $memberAttribute2, array_merge($arrayData, ['totalUser' => $totalUser, 'countUser' => $countUser])
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData,
|
||||
$arrayGroupData['GRP_UID'],
|
||||
$arrayGroupLdap,
|
||||
$memberAttribute2,
|
||||
array_merge($arrayData, ['totalUser' => $totalUser, 'countUser' => $countUser])
|
||||
);
|
||||
|
||||
$totalUser = $arrayData['totalUser'];
|
||||
@@ -1008,9 +1021,8 @@ class LdapAdvanced
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
|
||||
* @param string $strUser UserId (user login)
|
||||
* @param string $strPass Password
|
||||
* @param string $strUser UserId (user login)
|
||||
* @param string $strPass Password
|
||||
* @return
|
||||
* -1: user doesn"t exists / no existe usuario
|
||||
* -2: wrong password / password errado
|
||||
@@ -1040,7 +1052,7 @@ class LdapAdvanced
|
||||
$validUserPass = 1;
|
||||
|
||||
try {
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->authSourcesObj)) {
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
@@ -1055,7 +1067,7 @@ class LdapAdvanced
|
||||
$setAttributes = 0;
|
||||
|
||||
if (isset($arrayAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_SHOWGRID']) &&
|
||||
$arrayAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_SHOWGRID'] == 'on'
|
||||
$arrayAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_SHOWGRID'] == 'on'
|
||||
) {
|
||||
$setAttributes = 1;
|
||||
}
|
||||
@@ -1096,7 +1108,10 @@ class LdapAdvanced
|
||||
$arrayUserData = $user->getUserRecordByPk($usrUid, [], false);
|
||||
|
||||
$result = $this->__ldapUserUpdateByDnAndData(
|
||||
$this->ldapcnn, $arrayAuthSource, $userDn, [$arrayUserData['USR_USERNAME'] => $arrayUserData]
|
||||
$this->ldapcnn,
|
||||
$arrayAuthSource,
|
||||
$userDn,
|
||||
[$arrayUserData['USR_USERNAME'] => $arrayUserData]
|
||||
);
|
||||
|
||||
//Update DN
|
||||
@@ -1125,15 +1140,17 @@ class LdapAdvanced
|
||||
|
||||
$ldapcnn = $this->ldapConnection($arrayAuthSource);
|
||||
$flagUpdate = false;
|
||||
switch (ldap_errno($ldapcnn)) {
|
||||
case '0x00':
|
||||
switch (hexdec(ldap_errno($ldapcnn))) {
|
||||
case 0:
|
||||
//0x00
|
||||
$flagUpdate = true;
|
||||
$statusRbac = 1;
|
||||
$statusUser = 'ACTIVE';
|
||||
break;
|
||||
case '0x34':
|
||||
case '0x58':
|
||||
case '0x5e':
|
||||
case 52:
|
||||
case 88:
|
||||
case 94:
|
||||
//0x34, 0x58, 0x5e
|
||||
//LDAP_UNAVAILABLE
|
||||
//LDAP_USER_CANCELLED
|
||||
//LDAP_NO_RESULTS_RETURNED
|
||||
@@ -1192,7 +1209,7 @@ class LdapAdvanced
|
||||
/**
|
||||
* Get data of a User from attribute
|
||||
*
|
||||
* @param mixed $username Username
|
||||
* @param mixed $username Username
|
||||
* @param array $arrayAttributes Attributes
|
||||
*
|
||||
* return array Return an array with data User
|
||||
@@ -1231,7 +1248,7 @@ class LdapAdvanced
|
||||
|
||||
$paged = !is_null($start) && !is_null($limit);
|
||||
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->authSourcesObj)) {
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
@@ -1392,7 +1409,7 @@ class LdapAdvanced
|
||||
$arrayUserData = array();
|
||||
|
||||
//Set variables
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->authSourcesObj)) {
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
@@ -1499,7 +1516,7 @@ class LdapAdvanced
|
||||
|
||||
public function automaticRegister($aAuthSource, $strUser, $strPass)
|
||||
{
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if ($rbac->userObj == null) {
|
||||
$rbac->userObj = new RbacUsers();
|
||||
@@ -1593,7 +1610,7 @@ class LdapAdvanced
|
||||
$arrayDepartment = [];
|
||||
|
||||
//Set variables
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->authSourcesObj)) {
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
@@ -1698,7 +1715,7 @@ class LdapAdvanced
|
||||
$dFilter = "(&(" . $this->arrayObjectClassFilter["department"] . ")(ou=" . $departmentName . "))";
|
||||
|
||||
$aUsers = array();
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
$aAuthSource = $rbac->authSourcesObj->load($this->sAuthSource);
|
||||
@@ -1805,6 +1822,7 @@ class LdapAdvanced
|
||||
|
||||
return $terminated;
|
||||
}
|
||||
|
||||
/* activate an user previously deactivated
|
||||
if user is now in another department, we need the second parameter, the depUid
|
||||
|
||||
@@ -1888,7 +1906,7 @@ class LdapAdvanced
|
||||
public function getTerminatedOu()
|
||||
{
|
||||
if (trim($this->sAuthSource) != '') {
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
$aAuthSource = $rbac->authSourcesObj->load($this->sAuthSource);
|
||||
$attributes = $aAuthSource['AUTH_SOURCE_DATA'];
|
||||
$this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU']) ? $attributes['AUTH_SOURCE_RETIRED_OU'] : '';
|
||||
@@ -1898,11 +1916,11 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
get all authsource for this plugin ( ldapAdvanced plugin, because other authsources are not needed )
|
||||
this function is used only by cron
|
||||
returns only AUTH_SOURCE_PROVIDER = ldapAdvanced
|
||||
|
||||
@return array with authsources with type = ldap
|
||||
* get all authsource for this plugin ( ldapAdvanced plugin, because other authsources are not needed )
|
||||
* this function is used only by cron
|
||||
* returns only AUTH_SOURCE_PROVIDER = ldapAdvanced
|
||||
*
|
||||
* @return array with authsources with type = ldap
|
||||
*/
|
||||
public function getAuthSources()
|
||||
{
|
||||
@@ -1930,15 +1948,15 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
function to get departments from the array previously obtained from LDAP
|
||||
we are calling registered departments
|
||||
it is a recursive function, in the first call with an array with first top level departments from PM
|
||||
then go thru all departments and obtain a list of departments already created in PM and pass that array
|
||||
to next function to synchronize All users for each department
|
||||
this function is used in cron only
|
||||
|
||||
@param array departments obtained from LDAP/Active Directory
|
||||
@param array of departments, first call have only top level departments
|
||||
* function to get departments from the array previously obtained from LDAP
|
||||
* we are calling registered departments
|
||||
* it is a recursive function, in the first call with an array with first top level departments from PM
|
||||
* then go thru all departments and obtain a list of departments already created in PM and pass that array
|
||||
* to next function to synchronize All users for each department
|
||||
* this function is used in cron only
|
||||
*
|
||||
* @param array departments obtained from LDAP/Active Directory
|
||||
* @param array of departments, first call have only top level departments
|
||||
*/
|
||||
public function getRegisteredDepartments(array $arrayLdapDepartment, array $arrayDbDepartment)
|
||||
{
|
||||
@@ -1961,8 +1979,8 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
select departments but it is not recursive, only returns departments in this level
|
||||
@param string $DepParent the DEP_UID for parent department
|
||||
* select departments but it is not recursive, only returns departments in this level
|
||||
* @param string $DepParent the DEP_UID for parent department
|
||||
*/
|
||||
public function getDepartments($DepParent)
|
||||
{
|
||||
@@ -2009,11 +2027,11 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
function to get users from USERS table in wf_workflow and filter by department
|
||||
this function is used in cron only
|
||||
|
||||
@param string department UID ( DEP_UID value )
|
||||
@return array of users
|
||||
* function to get users from USERS table in wf_workflow and filter by department
|
||||
* this function is used in cron only
|
||||
*
|
||||
* @param string department UID ( DEP_UID value )
|
||||
* @return array of users
|
||||
*/
|
||||
public function getUserFromPM($username)
|
||||
{
|
||||
@@ -2040,11 +2058,11 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
get all user (UID, USERNAME) moved to Removed OU
|
||||
this function is used in cron only
|
||||
|
||||
@param array authSource row, in this fuction we are validating if Removed OU is defined or not
|
||||
@return array of users
|
||||
* get all user (UID, USERNAME) moved to Removed OU
|
||||
* this function is used in cron only
|
||||
*
|
||||
* @param array authSource row, in this fuction we are validating if Removed OU is defined or not
|
||||
* @return array of users
|
||||
*/
|
||||
public function getUsersFromRemovedOu($aAuthSource)
|
||||
{
|
||||
@@ -2060,12 +2078,12 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
set STATUS=0 for all users in the array $aUsers
|
||||
this functin is used to deactivate an array of users ( usually used for Removed OU )
|
||||
this function is used in cron only
|
||||
|
||||
@param array authSource row, in this fuction we are validating if Removed OU is defined or not
|
||||
@return array of users
|
||||
* set STATUS=0 for all users in the array $aUsers
|
||||
* this functin is used to deactivate an array of users ( usually used for Removed OU )
|
||||
* this function is used in cron only
|
||||
*
|
||||
* @param array authSource row, in this fuction we are validating if Removed OU is defined or not
|
||||
* @return array of users
|
||||
*/
|
||||
public function deactiveArrayOfUsers($aUsers)
|
||||
{
|
||||
@@ -2108,17 +2126,17 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
creates an users using the data send in the array $aUsers
|
||||
and then add the user to specific department
|
||||
this function is used in cron only
|
||||
|
||||
@param array $aUser info taken from ldap
|
||||
@param string $depUid the department UID
|
||||
@return boolean
|
||||
* creates an users using the data send in the array $aUsers
|
||||
* and then add the user to specific department
|
||||
* this function is used in cron only
|
||||
*
|
||||
* @param array $aUser info taken from ldap
|
||||
* @param string $depUid the department UID
|
||||
* @return boolean
|
||||
*/
|
||||
public function createUserAndActivate($aUser, $depUid)
|
||||
{
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if ($rbac->userObj == null) {
|
||||
$rbac->userObj = new RbacUsers();
|
||||
@@ -2218,7 +2236,7 @@ class LdapAdvanced
|
||||
$arrayGroup = [];
|
||||
|
||||
//Set variables
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->authSourcesObj)) {
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
@@ -2354,7 +2372,7 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
select groups but it is not recursive, only returns groups in this level
|
||||
* select groups but it is not recursive, only returns groups in this level
|
||||
*/
|
||||
public function getGroups()
|
||||
{
|
||||
@@ -2380,15 +2398,15 @@ class LdapAdvanced
|
||||
}
|
||||
|
||||
/**
|
||||
function to get groups from the array previously obtained from LDAP
|
||||
we are calling registered groups
|
||||
it is a recursive function, in the first call with an array with first top level groups from PM
|
||||
then go thru all groups and obtain a list of groups already created in PM and pass that array
|
||||
to next function to synchronize All users for each group
|
||||
this function is used in cron only
|
||||
|
||||
@param array groups obtained from LDAP/Active Directory
|
||||
@param array of groups, first call have only top level groups
|
||||
* function to get groups from the array previously obtained from LDAP
|
||||
* we are calling registered groups
|
||||
* it is a recursive function, in the first call with an array with first top level groups from PM
|
||||
* then go thru all groups and obtain a list of groups already created in PM and pass that array
|
||||
* to next function to synchronize All users for each group
|
||||
* this function is used in cron only
|
||||
*
|
||||
* @param array groups obtained from LDAP/Active Directory
|
||||
* @param array of groups, first call have only top level groups
|
||||
*/
|
||||
public function getRegisteredGroups(array $arrayLdapGroup, array $arrayDbGroup)
|
||||
{
|
||||
@@ -2436,7 +2454,9 @@ class LdapAdvanced
|
||||
unset($result['count']);
|
||||
|
||||
foreach ($result as $key => $value) {
|
||||
$result[$key] = addcslashes(preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $value), '<>,"');
|
||||
$result[$key] = addcslashes(preg_replace_callback("/\\\([0-9A-Fa-f]{2})/", function ($m) {
|
||||
return chr(hexdec($m[1]));
|
||||
}, $value), '<>,"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2447,8 +2467,8 @@ class LdapAdvanced
|
||||
* Synchronize User for this Department
|
||||
*
|
||||
* @param string $departmentUid UID of Department
|
||||
* @param array $arrayUserLdap User LDAP data
|
||||
* @param array $arrayData Data
|
||||
* @param array $arrayUserLdap User LDAP data
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data
|
||||
*/
|
||||
@@ -2469,7 +2489,7 @@ class LdapAdvanced
|
||||
$userUid = $arrayUserData["USR_UID"];
|
||||
$found = true;
|
||||
|
||||
$arrayData["already"] ++;
|
||||
$arrayData["already"]++;
|
||||
$arrayData["alreadyUsers"] .= $arrayUserData["USR_USERNAME"] . " ";
|
||||
}
|
||||
|
||||
@@ -2497,7 +2517,7 @@ class LdapAdvanced
|
||||
|
||||
$this->activateUser($arrayUserData["USR_UID"], $arrayNewUserData["sDN"], $departmentUid);
|
||||
|
||||
$arrayData["moved"] ++;
|
||||
$arrayData["moved"]++;
|
||||
$arrayData["movedUsers"] .= $arrayUserData["USR_USERNAME"] . " ";
|
||||
|
||||
$this->setArrayAuthenticationSourceUser($userUid, $arrayNewUserData); //INITIALIZE DATA //Update User
|
||||
@@ -2509,14 +2529,14 @@ class LdapAdvanced
|
||||
//Impossible
|
||||
$userUid = $arrayUserData["USR_UID"];
|
||||
|
||||
$arrayData["impossible"] ++;
|
||||
$arrayData["impossible"]++;
|
||||
$arrayData["impossibleUsers"] .= $arrayUserData["USR_USERNAME"] . " ";
|
||||
} else {
|
||||
//User not exists
|
||||
//Create User
|
||||
$userUid = $this->createUserAndActivate($arrayNewUserData, $departmentUid);
|
||||
|
||||
$arrayData["created"] ++;
|
||||
$arrayData["created"]++;
|
||||
$arrayData["createdUsers"] .= $arrayNewUserData["sUsername"] . " ";
|
||||
|
||||
$this->setArrayAuthenticationSourceUser($userUid, $arrayNewUserData); //INITIALIZE DATA //Add User
|
||||
@@ -2549,9 +2569,9 @@ class LdapAdvanced
|
||||
/**
|
||||
* Synchronize User for this Group
|
||||
*
|
||||
* @param string $groupUid UID of Group
|
||||
* @param array $arrayUserLdap User LDAP data
|
||||
* @param array $arrayData Data
|
||||
* @param string $groupUid UID of Group
|
||||
* @param array $arrayUserLdap User LDAP data
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data
|
||||
*/
|
||||
@@ -2574,7 +2594,7 @@ class LdapAdvanced
|
||||
$userUid = $arrayUserData["USR_UID"];
|
||||
$found = true;
|
||||
|
||||
$arrayData["already"] ++;
|
||||
$arrayData["already"]++;
|
||||
$arrayData["alreadyUsers"] .= $arrayUserData["USR_USERNAME"] . " ";
|
||||
}
|
||||
|
||||
@@ -2596,7 +2616,7 @@ class LdapAdvanced
|
||||
|
||||
$group->addUserToGroup($groupUid, $userUid);
|
||||
|
||||
$arrayData["moved"] ++;
|
||||
$arrayData["moved"]++;
|
||||
$arrayData["movedUsers"] .= $arrayUserData["USR_USERNAME"] . " ";
|
||||
|
||||
$this->setArrayAuthenticationSourceUser($userUid, $arrayNewUserData); //INITIALIZE DATA //Update User
|
||||
@@ -2608,7 +2628,7 @@ class LdapAdvanced
|
||||
//Impossible
|
||||
$userUid = $arrayUserData["USR_UID"];
|
||||
|
||||
$arrayData["impossible"] ++;
|
||||
$arrayData["impossible"]++;
|
||||
$arrayData["impossibleUsers"] .= $arrayUserData["USR_USERNAME"] . " ";
|
||||
} else {
|
||||
//User not exists
|
||||
@@ -2617,7 +2637,7 @@ class LdapAdvanced
|
||||
|
||||
$group->addUserToGroup($groupUid, $userUid);
|
||||
|
||||
$arrayData["created"] ++;
|
||||
$arrayData["created"]++;
|
||||
$arrayData["createdUsers"] .= $arrayNewUserData["sUsername"] . " ";
|
||||
|
||||
$this->setArrayAuthenticationSourceUser($userUid, $arrayNewUserData); //INITIALIZE DATA //Add User
|
||||
@@ -2650,10 +2670,10 @@ class LdapAdvanced
|
||||
/**
|
||||
* Update User data based on the LDAP Server
|
||||
*
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param array $arrayAuthSourceData Authentication Source Data
|
||||
* @param string $userDn User DN
|
||||
* @param array $arrayUser Users
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param array $arrayAuthSourceData Authentication Source Data
|
||||
* @param string $userDn User DN
|
||||
* @param array $arrayUser Users
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -2661,7 +2681,7 @@ class LdapAdvanced
|
||||
{
|
||||
try {
|
||||
//Set variables
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->userObj)) {
|
||||
$rbac->userObj = new RbacUsers();
|
||||
@@ -2679,7 +2699,7 @@ class LdapAdvanced
|
||||
];
|
||||
|
||||
if (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE']) &&
|
||||
!empty($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'])
|
||||
!empty($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'])
|
||||
) {
|
||||
foreach ($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'] as $value) {
|
||||
$arrayAttributesToSync[$value['attributeUser']] = $value['attributeLdap'];
|
||||
@@ -2688,7 +2708,7 @@ class LdapAdvanced
|
||||
|
||||
//Search User from LDAP Server
|
||||
$uidUserIdentifier = (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'])) ?
|
||||
$arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : 'uid';
|
||||
$arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : 'uid';
|
||||
|
||||
$arrayAttribute = array_merge($this->arrayAttributesForUser, array_values($arrayAttributesToSync));
|
||||
|
||||
@@ -2750,7 +2770,8 @@ class LdapAdvanced
|
||||
}
|
||||
} else {
|
||||
$this->log(
|
||||
$ldapcnn, 'User is repeated: Username "' . $username . '", DN "' . $arrayUserLdap['dn'] . '"'
|
||||
$ldapcnn,
|
||||
'User is repeated: Username "' . $username . '", DN "' . $arrayUserLdap['dn'] . '"'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2770,11 +2791,11 @@ class LdapAdvanced
|
||||
/**
|
||||
* Update Users data based on the LDAP Server
|
||||
*
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param array $arrayAuthSourceData Authentication Source Data
|
||||
* @param string $filterUsers Filter
|
||||
* @param array $arrayUserUid UID of Users
|
||||
* @param array $arrayData Data
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param array $arrayAuthSourceData Authentication Source Data
|
||||
* @param string $filterUsers Filter
|
||||
* @param array $arrayUserUid UID of Users
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -2815,14 +2836,18 @@ class LdapAdvanced
|
||||
|
||||
do {
|
||||
if ($this->__ldapUserUpdateByDnAndData(
|
||||
$ldapcnn, $arrayAuthSourceData, ldap_get_dn($ldapcnn, $entry), $arrayUser
|
||||
)
|
||||
$ldapcnn,
|
||||
$arrayAuthSourceData,
|
||||
ldap_get_dn($ldapcnn, $entry),
|
||||
$arrayUser
|
||||
)
|
||||
) {
|
||||
$countUser++;
|
||||
|
||||
//Progress bar
|
||||
$this->frontEndShow(
|
||||
'BAR', 'Update Users data: ' . $countUser . '/' . $totalUser . ' ' . $this->progressBar($totalUser, $countUser)
|
||||
'BAR',
|
||||
'Update Users data: ' . $countUser . '/' . $totalUser . ' ' . $this->progressBar($totalUser, $countUser)
|
||||
);
|
||||
}
|
||||
} while ($entry = ldap_next_entry($ldapcnn, $entry));
|
||||
@@ -2849,7 +2874,7 @@ class LdapAdvanced
|
||||
$countUser = 0;
|
||||
|
||||
//Set variables
|
||||
$rbac = &RBAC::getSingleton();
|
||||
$rbac = RBAC::getSingleton();
|
||||
|
||||
if (is_null($rbac->authSourcesObj)) {
|
||||
$rbac->authSourcesObj = new AuthenticationSource();
|
||||
@@ -2880,7 +2905,11 @@ class LdapAdvanced
|
||||
|
||||
if ($count == $limit) {
|
||||
list($totalUser, $countUser) = $this->__ldapUsersUpdateData(
|
||||
$ldapcnn, $arrayAuthenticationSourceData, $filterUsers, $arrayUserUid, ['totalUser' => $totalUser, 'countUser' => $countUser]
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData,
|
||||
$filterUsers,
|
||||
$arrayUserUid,
|
||||
['totalUser' => $totalUser, 'countUser' => $countUser]
|
||||
);
|
||||
|
||||
$count = 0;
|
||||
@@ -2892,7 +2921,11 @@ class LdapAdvanced
|
||||
|
||||
if ($count > 0) {
|
||||
list($totalUser, $countUser) = $this->__ldapUsersUpdateData(
|
||||
$ldapcnn, $arrayAuthenticationSourceData, $filterUsers, $arrayUserUid, ['totalUser' => $totalUser, 'countUser' => $countUser]
|
||||
$ldapcnn,
|
||||
$arrayAuthenticationSourceData,
|
||||
$filterUsers,
|
||||
$arrayUserUid,
|
||||
['totalUser' => $totalUser, 'countUser' => $countUser]
|
||||
);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
@@ -2920,7 +2953,7 @@ class LdapAdvanced
|
||||
* Get page size limit for a search result
|
||||
*
|
||||
* @param resource $ldapcnn LDAP link identifier
|
||||
* @param string $baseDn The base DN for the directory
|
||||
* @param string $baseDn The base DN for the directory
|
||||
*
|
||||
* @return int Returns the page size limit for a search result
|
||||
*/
|
||||
|
||||
@@ -409,7 +409,7 @@ class license_application extends Padl
|
||||
$DATA['RESULT'] = 'TMINUS';
|
||||
}
|
||||
# the license has expired
|
||||
if ($DATA['DATE']['END'] - time() < 0 && $DATA['DATE']['SPAN'] != 'NEVER' && $DATA['DATE']['SPAN'] != '~') {
|
||||
if (intval($DATA['DATE']['END']) - time() < 0 && $DATA['DATE']['SPAN'] !== 'NEVER' && $DATA['DATE']['SPAN'] !== '~') {
|
||||
$DATA['RESULT'] = 'EXPIRED';
|
||||
}
|
||||
$DATA['DATE']['HUMAN']['START'] = date($this->DATE_STRING, $DATA['DATE']['START']);
|
||||
|
||||
@@ -196,11 +196,11 @@ class MultipleFilesBackup
|
||||
list($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||
|
||||
CLI::logging("> Connecting to system database in '$dbHost'\n");
|
||||
$link = mysql_connect($dbHost, $dbUser, $dbPass);
|
||||
@mysql_query("SET NAMES 'utf8';");
|
||||
@mysql_query("SET FOREIGN_KEY_CHECKS=0;");
|
||||
$link = mysqli_connect($dbHost, $dbUser, $dbPass);
|
||||
mysqli_query($link, "SET NAMES 'utf8';");
|
||||
mysqli_query($link, "SET FOREIGN_KEY_CHECKS=0;");
|
||||
if (!$link) {
|
||||
throw new Exception('Could not connect to system database: ' . mysql_error());
|
||||
throw new Exception('Could not connect to system database: ' . mysqli_error($link));
|
||||
}
|
||||
|
||||
if (strpos($metadata->DB_RBAC_NAME, 'rb_') === false) {
|
||||
@@ -215,12 +215,12 @@ class MultipleFilesBackup
|
||||
foreach ($metadata->databases as $db) {
|
||||
$dbName = $newDBNames[$db->name];
|
||||
CLI::logging("+> Restoring database {$db->name} to $dbName\n");
|
||||
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql", $aParameters);
|
||||
$workspace->createDBUser($dbName, $db->pass, "localhost", $dbName);
|
||||
$workspace->createDBUser($dbName, $db->pass, "%", $dbName);
|
||||
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql", $aParameters, 1, $link);
|
||||
$workspace->createDBUser($dbName, $db->pass, "localhost", $dbName, $link);
|
||||
$workspace->createDBUser($dbName, $db->pass, "%", $dbName, $link);
|
||||
}
|
||||
$workspace->upgradeCacheView(false);
|
||||
mysql_close($link);
|
||||
mysqli_close($link);
|
||||
}
|
||||
CLI::logging("Removing temporary files\n");
|
||||
G::rm_dir($tempDirectory);
|
||||
|
||||
@@ -79,7 +79,7 @@ class Net
|
||||
}
|
||||
if ($this->is_ipaddress($ipHost)) {
|
||||
$this->ip = $ipHost;
|
||||
if (! $this->hostname = @gethostbyaddr($ipHost)) {
|
||||
if (!$this->hostname = @gethostbyaddr($ipHost)) {
|
||||
$this->errno = 2000;
|
||||
$this->errstr = "NET::Host down";
|
||||
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
|
||||
@@ -87,7 +87,7 @@ class Net
|
||||
} else {
|
||||
$ip = @gethostbyname($ipHost);
|
||||
$long = ip2long($ip);
|
||||
if ($long == - 1 || $long === false) {
|
||||
if ($long == -1 || $long === false) {
|
||||
$this->errno = 2000;
|
||||
$this->errstr = "NET::Host down";
|
||||
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
|
||||
@@ -134,8 +134,8 @@ class Net
|
||||
#if have a ip address format
|
||||
if (count($tmp) == 4) {
|
||||
#if a correct ip address
|
||||
for ($i = 0; $i < count($tmp); $i ++) {
|
||||
if (! is_int($tmp[$i])) {
|
||||
for ($i = 0; $i < count($tmp); $i++) {
|
||||
if (!is_int($tmp[$i])) {
|
||||
$key = false;
|
||||
break;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class Net
|
||||
$cmd = "ping -w $pTTL $this->ip";
|
||||
$output = exec($cmd, $a, $a1);
|
||||
$this->errstr = "";
|
||||
for ($i = 0; $i < count($a); $i ++) {
|
||||
for ($i = 0; $i < count($a); $i++) {
|
||||
$this->errstr += $a[$i];
|
||||
}
|
||||
$this->errno = $a1;
|
||||
@@ -193,7 +193,7 @@ class Net
|
||||
* This function tries to connect to server
|
||||
*
|
||||
* @param string $pDbDriver
|
||||
* @param array $arrayServerData
|
||||
* @param array $arrayServerData
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -212,24 +212,26 @@ class Net
|
||||
|
||||
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
|
||||
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
|
||||
$flagTns=1;
|
||||
$flagTns = 1;
|
||||
} else {
|
||||
$flagTns=0;
|
||||
$flagTns = 0;
|
||||
}
|
||||
} else {
|
||||
$flagTns=0;
|
||||
$flagTns = 0;
|
||||
}
|
||||
|
||||
if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) {
|
||||
switch ($pDbDriver) {
|
||||
case 'mysql':
|
||||
// Note, we suppress warnings on the connection calls because we want to avoid displaying warning
|
||||
// When utilizing this code in an API call. Otherwise it will return invalid JSON overall.
|
||||
if ($this->db_passwd == '') {
|
||||
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user);
|
||||
$link = @mysqli_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_sourcename);
|
||||
} else {
|
||||
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd);
|
||||
$link = @mysqli_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd, $this->db_sourcename);
|
||||
}
|
||||
if ($link) {
|
||||
if (@mysql_ping($link)) {
|
||||
if (mysqli_ping($link)) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
$this->errno = 0;
|
||||
@@ -279,7 +281,7 @@ class Net
|
||||
case 'oracle':
|
||||
try {
|
||||
if ($flagTns == 0) {
|
||||
$this->db_port = ($this->db_port == "" || $this->db_port == 0)? "1521" : $this->db_port;
|
||||
$this->db_port = ($this->db_port == "" || $this->db_port == 0) ? "1521" : $this->db_port;
|
||||
|
||||
$cnn = @oci_connect($this->db_user, $this->db_passwd, "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) (HOST=$this->ip) (PORT=$this->db_port) )) (CONNECT_DATA=(SERVICE_NAME=$this->db_sourcename)))", $dbsEncode);
|
||||
} else {
|
||||
@@ -315,7 +317,7 @@ class Net
|
||||
* This function tries to open to the DB
|
||||
*
|
||||
* @param string $pDbDriver
|
||||
* @param array $arrayServerData
|
||||
* @param array $arrayServerData
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -336,41 +338,39 @@ class Net
|
||||
|
||||
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
|
||||
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
|
||||
$flagTns=1;
|
||||
$flagTns = 1;
|
||||
} else {
|
||||
$flagTns=0;
|
||||
$flagTns = 0;
|
||||
}
|
||||
} else {
|
||||
$flagTns=0;
|
||||
$flagTns = 0;
|
||||
}
|
||||
|
||||
if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) {
|
||||
switch ($pDbDriver) {
|
||||
case 'mysql':
|
||||
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd);
|
||||
$db = @mysql_select_db($this->db_sourcename);
|
||||
$link = mysqli_connect($this->ip . (($this->db_port !== '') && ($this->db_port !== 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd, $this->db_sourcename);
|
||||
$db = mysqli_select_db($link, $this->db_sourcename);
|
||||
$this->error = 'MySql connection refused!';
|
||||
$this->errstr = 'NET::MYSQL->The connection was refused';
|
||||
$this->errno = 10001;
|
||||
|
||||
if ($link) {
|
||||
$this->error = 'The $this->db_sourcename data base does\'n exist!';
|
||||
$this->errstr = 'NET::MYSQL->Select data base failed';
|
||||
$this->errno = 10011;
|
||||
if ($db) {
|
||||
$result = @mysql_query("show tables;");
|
||||
$result = mysqli_query($link, 'show tables;');
|
||||
$this->error = 'the user $this->db_user doesn\'t have privileges to run queries!';
|
||||
$this->errstr = 'NET::MYSQL->Test query failed';
|
||||
$this->errno = 10100;
|
||||
if ($result) {
|
||||
$stat->status = 'SUCCESS';
|
||||
$this->errstr = "";
|
||||
$this->errstr = '';
|
||||
$this->errno = 0;
|
||||
@mysql_free_result($result);
|
||||
} else {
|
||||
$this->error = "the user $this->db_user doesn't have privileges to run queries!";
|
||||
$this->errstr = "NET::MYSQL->Test query failed";
|
||||
$this->errno = 10100;
|
||||
mysqli_free_result($result);
|
||||
}
|
||||
} else {
|
||||
$this->error = "The $this->db_sourcename data base does'n exist!";
|
||||
$this->errstr = "NET::MYSQL->Select data base failed";
|
||||
$this->errno = 10011;
|
||||
}
|
||||
} else {
|
||||
$this->error = "MySql connection refused!";
|
||||
$this->errstr = "NET::MYSQL->The connection was refused";
|
||||
$this->errno = 10001;
|
||||
}
|
||||
break;
|
||||
case 'pgsql':
|
||||
@@ -393,8 +393,6 @@ class Net
|
||||
}
|
||||
break;
|
||||
case 'mssql':
|
||||
// $str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":".$this->db_port;
|
||||
// $link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
|
||||
if ($this->db_instance != "") {
|
||||
$str_port = "";
|
||||
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
|
||||
@@ -421,7 +419,7 @@ class Net
|
||||
break;
|
||||
case 'oracle':
|
||||
if ($flagTns == 0) {
|
||||
$this->db_port = ($this->db_port == "" || $this->db_port == 0)? "1521" : $this->db_port;
|
||||
$this->db_port = ($this->db_port == "" || $this->db_port == 0) ? "1521" : $this->db_port;
|
||||
|
||||
$cnn = @oci_connect($this->db_user, $this->db_passwd, "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) (HOST=$this->ip) (PORT=$this->db_port) )) (CONNECT_DATA=(SERVICE_NAME=$this->db_sourcename)))", $dbsEncode);
|
||||
} else {
|
||||
@@ -466,13 +464,13 @@ class Net
|
||||
*/
|
||||
public function getDbServerVersion($driver)
|
||||
{
|
||||
if (! isset($this->ip)) {
|
||||
if (!isset($this->ip)) {
|
||||
$this->ip = getenv('HTTP_CLIENT_IP');
|
||||
}
|
||||
|
||||
if (isset($this->ip) && isset($this->db_user) && isset($this->db_passwd)) {
|
||||
try {
|
||||
if (! isset($this->db_sourcename)) {
|
||||
if (!isset($this->db_sourcename)) {
|
||||
$this->db_sourcename = DB_NAME;
|
||||
}
|
||||
$value = 'none';
|
||||
@@ -540,7 +538,7 @@ class Net
|
||||
</div>
|
||||
</fieldset>
|
||||
<center>";
|
||||
print($msg) ;
|
||||
print($msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,7 +200,6 @@ class PMPluginRegistry
|
||||
if (array_key_exists($detail->sNamespace, $this->_restServiceEnabled)
|
||||
&& $this->_restServiceEnabled[$detail->sNamespace] == true
|
||||
) {
|
||||
|
||||
$oPlugin->registerRestService();
|
||||
}
|
||||
|
||||
@@ -372,7 +371,6 @@ class PMPluginRegistry
|
||||
*/
|
||||
public function installPluginArchive($filename, $pluginName)
|
||||
{
|
||||
|
||||
$tar = new Archive_Tar($filename);
|
||||
$files = $tar->listContent();
|
||||
$plugins = array();
|
||||
@@ -399,40 +397,6 @@ class PMPluginRegistry
|
||||
//$pluginName = $plugins[0];
|
||||
$pluginFile = "$pluginName.php";
|
||||
|
||||
/*
|
||||
$oldPluginStatus = $this->getStatusPlugin($pluginFile);
|
||||
|
||||
if ($pluginStatus != 0) {
|
||||
$oldDetails = $this->getPluginDetails($pluginFile);
|
||||
$oldVersion = $oldDetails->iVersion;
|
||||
} else {
|
||||
$oldDetails = NULL;
|
||||
$oldVersion = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
//$pluginIni = $tar->extractInString("$pluginName.ini");
|
||||
//$pluginConfig = parse_ini_string($pluginIni);
|
||||
/*
|
||||
if (!empty($oClass->aDependences)) {
|
||||
foreach ($oClass->aDependences as $aDependence) {
|
||||
if (file_exists(PATH_PLUGINS . $aDependence['sClassName'] . '.php')) {
|
||||
require_once PATH_PLUGINS . $aDependence['sClassName'] . '.php';
|
||||
if (!$oPluginRegistry->getPluginDetails($aDependence['sClassName'] . '.php')) {
|
||||
throw new Exception('This plugin needs "' . $aDependence['sClassName'] . '" plugin');
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Exception('This plugin needs "' . $aDependence['sClassName'] . '" plugin');
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($oClass);
|
||||
if ($fVersionOld > $fVersionNew) {
|
||||
throw new Exception('A recent version of this plugin was already installed.');
|
||||
}
|
||||
*/
|
||||
|
||||
$res = $tar->extract(PATH_PLUGINS);
|
||||
if (!file_exists(PATH_PLUGINS . $pluginFile)) {
|
||||
throw (new Exception("File \"$pluginFile\" doesn't exist"));
|
||||
@@ -509,8 +473,7 @@ class PMPluginRegistry
|
||||
$wsPathDataSite = PATH_DATA . "sites" . PATH_SEP . $ws->name . PATH_SEP;
|
||||
|
||||
if (file_exists($wsPathDataSite . "plugin.singleton")) {
|
||||
|
||||
$pluginRegistry = &PMPluginRegistry::getSingleton();
|
||||
$pluginRegistry = PMPluginRegistry::getSingleton();
|
||||
$pluginRegistry->unSerializeInstance(file_get_contents($wsPathDataSite . "plugin.singleton"));
|
||||
|
||||
///////
|
||||
@@ -551,7 +514,6 @@ class PMPluginRegistry
|
||||
G::RenderPage('publish');
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -633,7 +595,6 @@ class PMPluginRegistry
|
||||
*/
|
||||
public function registerJavascript($sNamespace, $sCoreJsFile, $pluginJsFile)
|
||||
{
|
||||
|
||||
foreach ($this->_aJavascripts as $i => $js) {
|
||||
if ($sCoreJsFile == $js->sCoreJsFile && $sNamespace == $js->sNamespace) {
|
||||
if (is_string($pluginJsFile)) {
|
||||
@@ -652,7 +613,7 @@ class PMPluginRegistry
|
||||
$js = new StdClass();
|
||||
$js->sNamespace = $sNamespace;
|
||||
$js->sCoreJsFile = $sCoreJsFile;
|
||||
$js->pluginJsFile = Array();
|
||||
$js->pluginJsFile = array();
|
||||
|
||||
if (is_string($pluginJsFile)) {
|
||||
$js->pluginJsFile[] = $pluginJsFile;
|
||||
@@ -930,7 +891,6 @@ class PMPluginRegistry
|
||||
*/
|
||||
public function executeTriggers($triggerId, $oData)
|
||||
{
|
||||
|
||||
foreach ($this->_aTriggers as $row => $detail) {
|
||||
if ($triggerId == $detail->sTriggerId) {
|
||||
//review all folders registered for this namespace
|
||||
@@ -979,7 +939,6 @@ class PMPluginRegistry
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $found;
|
||||
@@ -1051,8 +1010,8 @@ class PMPluginRegistry
|
||||
require_once($sFilename);
|
||||
}
|
||||
$sClassName = $aDetails[0];
|
||||
$oPlugin =& new $sClassName($sFilename);
|
||||
$this->_aPlugins[$sNamespace] =& $oPlugin;
|
||||
$oPlugin = new $sClassName($sFilename);
|
||||
$this->_aPlugins[$sNamespace] = $oPlugin;
|
||||
return $oPlugin;
|
||||
*/
|
||||
return $oPlugin;
|
||||
@@ -1102,9 +1061,9 @@ class PMPluginRegistry
|
||||
{
|
||||
try {
|
||||
$iPlugins = 0;
|
||||
$oServerConf = ServerConf::getSingleton();
|
||||
$oServerConf->addPlugin(config("system.workspace"), $this->_aPluginDetails);
|
||||
|
||||
$oServerConf = & ServerConf::getSingleton();
|
||||
$oServerConf->addPlugin( config("system.workspace"), $this->_aPluginDetails );
|
||||
foreach ($this->_aPluginDetails as $namespace => $detail) {
|
||||
if (isset($detail->enabled) && $detail->enabled) {
|
||||
if (!empty($detail->sFilename) && file_exists($detail->sFilename)) {
|
||||
@@ -1210,7 +1169,7 @@ class PMPluginRegistry
|
||||
//Found a License
|
||||
if (class_exists('pmLicenseManager')) {
|
||||
$sSerializedFile = PATH_DATA_SITE . 'lmn.singleton';
|
||||
$pmLicenseManagerO = &PmLicenseManager::getSingleton();
|
||||
$pmLicenseManagerO = PmLicenseManager::getSingleton();
|
||||
if (file_exists($sSerializedFile)) {
|
||||
$pmLicenseManagerO->unSerializeInstance(file_get_contents($sSerializedFile));
|
||||
}
|
||||
@@ -1504,7 +1463,7 @@ class PMPluginRegistry
|
||||
* @param string $sNamespace
|
||||
* @param bool $enable
|
||||
*/
|
||||
function enableRestService($sNamespace, $enable)
|
||||
public function enableRestService($sNamespace, $enable)
|
||||
{
|
||||
$this->_restServiceEnabled[$sNamespace] = $enable;
|
||||
}
|
||||
@@ -1541,7 +1500,7 @@ class PMPluginRegistry
|
||||
//Update plugin attributes
|
||||
require_once(PATH_PLUGINS . $pluginFileName);
|
||||
|
||||
$pmPluginRegistry = &PMPluginRegistry::getSingleton();
|
||||
$pmPluginRegistry = PMPluginRegistry::getSingleton();
|
||||
|
||||
$pluginDetails = $pmPluginRegistry->getPluginDetails($pluginFileName);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class PmDynaform
|
||||
$this->context = \Bootstrap::getDefaultContextLog();
|
||||
$this->dataSources = array("database", "dataVariable");
|
||||
$this->pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css';
|
||||
$this->serverConf = &ServerConf::getSingleton();
|
||||
$this->serverConf = ServerConf::getSingleton();
|
||||
$this->isRTL = ($this->serverConf->isRtl(SYS_LANG)) ? 'true' : 'false';
|
||||
$this->fields = $fields;
|
||||
$this->propertiesToExclude = array('dataVariable');
|
||||
@@ -541,7 +541,7 @@ class PmDynaform
|
||||
$json->data->label = $io->label;
|
||||
}
|
||||
}
|
||||
$_SESSION["TRIGGER_DEBUG"]["DATA"][] = Array("key" => $json->name . "_label", "value" => $json->data->label);
|
||||
$_SESSION["TRIGGER_DEBUG"]["DATA"][] = array("key" => $json->name . "_label", "value" => $json->data->label);
|
||||
}
|
||||
}
|
||||
if ($key === "type" && ($value === "checkgroup")) {
|
||||
@@ -549,8 +549,9 @@ class PmDynaform
|
||||
$dataValue = array();
|
||||
$dataLabel = array();
|
||||
$dv = array();
|
||||
if (isset($this->fields["APP_DATA"][$json->name]))
|
||||
if (isset($this->fields["APP_DATA"][$json->name])) {
|
||||
$dv = $this->fields["APP_DATA"][$json->name];
|
||||
}
|
||||
if (!is_array($dv)) {
|
||||
$dv = explode(",", $dv);
|
||||
}
|
||||
@@ -570,13 +571,13 @@ class PmDynaform
|
||||
}
|
||||
$json->data->value = $dataValue;
|
||||
$json->data->label = G::json_encode($dataLabel);
|
||||
$_SESSION["TRIGGER_DEBUG"]["DATA"][] = Array("key" => $json->name . "_label", "value" => $json->data->label);
|
||||
$_SESSION["TRIGGER_DEBUG"]["DATA"][] = array("key" => $json->name . "_label", "value" => $json->data->label);
|
||||
}
|
||||
}
|
||||
if ($key === "type" && ($value === "datetime")) {
|
||||
if (isset($this->fields["APP_DATA"]["__VAR_CHANGED__"]) && in_array($json->name, explode(",", $this->fields["APP_DATA"]["__VAR_CHANGED__"]))) {
|
||||
$json->data->label = $json->data->value;
|
||||
$_SESSION["TRIGGER_DEBUG"]["DATA"][] = Array("key" => $json->name . "_label", "value" => $json->data->label);
|
||||
$_SESSION["TRIGGER_DEBUG"]["DATA"][] = array("key" => $json->name . "_label", "value" => $json->data->label);
|
||||
}
|
||||
}
|
||||
//clear optionsSql
|
||||
@@ -1127,12 +1128,15 @@ class PmDynaform
|
||||
$msg = "";
|
||||
if (isset($_SESSION['G_MESSAGE_TYPE']) && isset($_SESSION['G_MESSAGE'])) {
|
||||
$color = "green";
|
||||
if ($_SESSION['G_MESSAGE_TYPE'] === "ERROR")
|
||||
if ($_SESSION['G_MESSAGE_TYPE'] === "ERROR") {
|
||||
$color = "red";
|
||||
if ($_SESSION['G_MESSAGE_TYPE'] === "WARNING")
|
||||
}
|
||||
if ($_SESSION['G_MESSAGE_TYPE'] === "WARNING") {
|
||||
$color = "#C3C380";
|
||||
if ($_SESSION['G_MESSAGE_TYPE'] === "INFO")
|
||||
}
|
||||
if ($_SESSION['G_MESSAGE_TYPE'] === "INFO") {
|
||||
$color = "green";
|
||||
}
|
||||
$msg = "<div style='background-color:" . $color . ";color: white;padding: 1px 2px 1px 5px;' class='userGroupTitle'>" . $_SESSION['G_MESSAGE_TYPE'] . ": " . $_SESSION['G_MESSAGE'] . "</div>";
|
||||
unset($_SESSION['G_MESSAGE_TYPE']);
|
||||
unset($_SESSION['G_MESSAGE']);
|
||||
@@ -1166,7 +1170,7 @@ class PmDynaform
|
||||
"</script>\n" .
|
||||
"<script type='text/javascript' src='/jscore/cases/core/cases_Step.js'></script>\n" .
|
||||
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
|
||||
($this->fields["PRO_SHOW_MESSAGE"] === 1 ? '' : $title ) .
|
||||
($this->fields["PRO_SHOW_MESSAGE"] === 1 ? '' : $title) .
|
||||
"<div style='width:100%;padding:0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" .
|
||||
" <img src='/images/bulletButtonLeft.gif' style='float:left;'> \n" .
|
||||
" <a id='dyn_backward' href='" . $this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["PREVIOUS_STEP"] . "' style='float:left;font-size:12px;line-height:1;margin:0px 0px 1px 5px;'>\n" .
|
||||
@@ -1451,16 +1455,21 @@ class PmDynaform
|
||||
if (!$sw1 && !$sw2) {
|
||||
if ($key === "variable" && $json->variable === $oldVariable["VAR_NAME"]) {
|
||||
$json->variable = $newVariable["VAR_NAME"];
|
||||
if (isset($json->dataType))
|
||||
if (isset($json->dataType)) {
|
||||
$json->dataType = $newVariable["VAR_FIELD_TYPE"];
|
||||
if (isset($json->name))
|
||||
}
|
||||
if (isset($json->name)) {
|
||||
$json->name = $newVariable["VAR_NAME"];
|
||||
if (isset($json->dbConnection) && $json->dbConnection === $oldVariable["VAR_DBCONNECTION"])
|
||||
}
|
||||
if (isset($json->dbConnection) && $json->dbConnection === $oldVariable["VAR_DBCONNECTION"]) {
|
||||
$json->dbConnection = $newVariable["VAR_DBCONNECTION"];
|
||||
if (isset($json->dbConnectionLabel) && $json->dbConnectionLabel === $oldVariable["VAR_DBCONNECTION_LABEL"])
|
||||
}
|
||||
if (isset($json->dbConnectionLabel) && $json->dbConnectionLabel === $oldVariable["VAR_DBCONNECTION_LABEL"]) {
|
||||
$json->dbConnectionLabel = $newVariable["VAR_DBCONNECTION_LABEL"];
|
||||
if (isset($json->sql) && $json->sql === $oldVariable["VAR_SQL"])
|
||||
}
|
||||
if (isset($json->sql) && $json->sql === $oldVariable["VAR_SQL"]) {
|
||||
$json->sql = $newVariable["VAR_SQL"];
|
||||
}
|
||||
if (isset($json->options) && G::json_encode($json->options) === $oldVariable["VAR_ACCEPTED_VALUES"]) {
|
||||
$json->options = G::json_decode($newVariable["VAR_ACCEPTED_VALUES"]);
|
||||
}
|
||||
@@ -1651,8 +1660,9 @@ class PmDynaform
|
||||
$sw2 = is_object($value);
|
||||
if ($sw1 || $sw2) {
|
||||
$val = $this->jsonsf($value, $id, $for);
|
||||
if ($val !== null)
|
||||
if ($val !== null) {
|
||||
return $val;
|
||||
}
|
||||
}
|
||||
if (!$sw1 && !$sw2) {
|
||||
if ($key === $for && $id === $value) {
|
||||
@@ -1787,7 +1797,7 @@ class PmDynaform
|
||||
if ($oPro->getDynLabel() !== null && $oPro->getDynLabel() !== "") {
|
||||
$dyn_labels = G::json_decode($oPro->getDynLabel());
|
||||
}
|
||||
$dyn_labels->$name[count($name) - 2] = $content;
|
||||
$dyn_labels->{$name[count($name) - 2]} = $content;
|
||||
|
||||
$oPro->setDynLabel(G::json_encode($dyn_labels));
|
||||
$oPro->save();
|
||||
@@ -1892,7 +1902,7 @@ class PmDynaform
|
||||
{
|
||||
$result = array();
|
||||
$previusFunction = $this->onPropertyRead;
|
||||
$this->onPropertyRead = function($json, $key, $value) use (&$post) {
|
||||
$this->onPropertyRead = function ($json, $key, $value) use (&$post) {
|
||||
if ($key === "type" && isset($json->variable) && !empty($json->variable)) {
|
||||
//clears the data in the appData for grids
|
||||
$isThereIdIntoPost = array_key_exists($json->id, $post);
|
||||
@@ -2042,7 +2052,8 @@ class PmDynaform
|
||||
break;
|
||||
case 'form':
|
||||
$arrayGrid = array_merge(
|
||||
$arrayGrid, self::getGridsAndFields($field, $flagGridAssocToVar)
|
||||
$arrayGrid,
|
||||
self::getGridsAndFields($field, $flagGridAssocToVar)
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -2138,7 +2149,8 @@ class PmDynaform
|
||||
$value === "suggest" ||
|
||||
$value === "hidden" ||
|
||||
$value === "file" ||
|
||||
$value === "grid")) {
|
||||
$value === "grid"
|
||||
)) {
|
||||
if ($value === "grid" && $property === "data") {
|
||||
$json->{$property} = [];
|
||||
} else {
|
||||
|
||||
@@ -29,7 +29,7 @@ class PmGoogleApi
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if (!($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09') || $licensedFeatures->verifyfeature('AhKNjBEVXZlWUFpWE8wVTREQ0FObmo0aTdhVzhvalFic1M='))) {
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
@@ -64,7 +64,7 @@ class PmGoogleApi
|
||||
$this->configuration->loadConfig($gmail, 'GOOGLE_API_SETTINGS', '');
|
||||
}
|
||||
|
||||
public function setConfigGmail ($id, $value)
|
||||
public function setConfigGmail($id, $value)
|
||||
{
|
||||
$this->configuration->aConfig[$id] = $value;
|
||||
$this->configuration->saveConfig('GOOGLE_API_SETTINGS', '', '', '');
|
||||
@@ -81,7 +81,7 @@ class PmGoogleApi
|
||||
return $this->serviceAccountEmail;
|
||||
}
|
||||
|
||||
public function setServiceAccountCertificate ($serviceAccountCertificate)
|
||||
public function setServiceAccountCertificate($serviceAccountCertificate)
|
||||
{
|
||||
$this->setConfigGmail('serviceAccountCertificate', $serviceAccountCertificate);
|
||||
$this->serviceAccountCertificate = $serviceAccountCertificate;
|
||||
@@ -94,7 +94,7 @@ class PmGoogleApi
|
||||
|
||||
public function setServiceGmailStatus($status)
|
||||
{
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||
$status = false;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class PmGoogleApi
|
||||
|
||||
public function setServiceDriveStatus($status)
|
||||
{
|
||||
$licensedFeatures = &PMLicensedFeatures::getSingleton();
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
if (!$licensedFeatures->verifyfeature('AhKNjBEVXZlWUFpWE8wVTREQ0FObmo0aTdhVzhvalFic1M=')) {
|
||||
$status = false;
|
||||
}
|
||||
@@ -183,7 +183,6 @@ class PmGoogleApi
|
||||
*/
|
||||
public function testService($credentials)
|
||||
{
|
||||
|
||||
$scope = array(
|
||||
static::DRIVE,
|
||||
static::DRIVE_FILE,
|
||||
|
||||
@@ -15,7 +15,7 @@ class PmLicenseManager
|
||||
|
||||
public function __construct($flagActivatePlugins = true)
|
||||
{
|
||||
$oServerConf = &ServerConf::getSingleton();
|
||||
$oServerConf = ServerConf::getSingleton();
|
||||
|
||||
if ($oServerConf->getProperty('LOGIN_NO_WS') === null || $oServerConf->getProperty('LOGIN_NO_WS') === false) {
|
||||
$oServerConf->setProperty('LOGIN_NO_WS', true);
|
||||
@@ -65,7 +65,7 @@ class PmLicenseManager
|
||||
$this->licensedfeaturesList = isset($results ['DATA']['LICENSED_FEATURES_LIST']) ? $results ['DATA']['LICENSED_FEATURES_LIST'] : null;
|
||||
$this->status = $this->getCurrentLicenseStatus();
|
||||
|
||||
if (isset ($results ['LIC'])) {
|
||||
if (isset($results ['LIC'])) {
|
||||
$resultsRegister = $results['LIC'];
|
||||
$this->server = $results['LIC']['SRV'];
|
||||
$this->file = $results['LIC']['FILE'];
|
||||
@@ -183,8 +183,10 @@ class PmLicenseManager
|
||||
}
|
||||
if (!(empty($aDenied))) {
|
||||
if ((SYS_COLLECTION == "enterprise") && (SYS_TARGET == "pluginsList")) {
|
||||
G::SendMessageText("The following plugins were restricted due to your enterprise license: " . implode(", ",
|
||||
$aDenied), "INFO");
|
||||
G::SendMessageText("The following plugins were restricted due to your enterprise license: " . implode(
|
||||
", ",
|
||||
$aDenied
|
||||
), "INFO");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,7 +355,7 @@ class PmLicenseManager
|
||||
|
||||
public function validateLicense($path)
|
||||
{
|
||||
$application = new license_application ($path, false, true, false, true, true);
|
||||
$application = new license_application($path, false, true, false, true, true);
|
||||
$results = $application->validate(false, false, "", "", "80", true);
|
||||
|
||||
if ($results ['RESULT'] != 'OK') {
|
||||
@@ -365,7 +367,7 @@ class PmLicenseManager
|
||||
|
||||
public function installLicense($path, $redirect = true, $includeExpired = true)
|
||||
{
|
||||
$application = new license_application ($path, false, true, false, true, true);
|
||||
$application = new license_application($path, false, true, false, true, true);
|
||||
|
||||
$results = $application->validate(false, false, "", "", "80", true);
|
||||
|
||||
@@ -383,8 +385,7 @@ class PmLicenseManager
|
||||
G::SendTemporalMessage('ID_ISNT_LICENSE', 'tmp-info', 'labels');
|
||||
return false;
|
||||
} else {
|
||||
|
||||
$oServerConf = &ServerConf::getSingleton();
|
||||
$oServerConf = ServerConf::getSingleton();
|
||||
$oServerConf->setProperty('ACTIVE_LICENSE', [config("system.workspace") => $path]);
|
||||
$this->saveDataLicense($results, $path, $redirect);
|
||||
if ($redirect) {
|
||||
@@ -424,16 +425,16 @@ class PmLicenseManager
|
||||
{
|
||||
require_once("classes/model/LicenseManager.php");
|
||||
//obtening info in a row that has ACTIVE status
|
||||
$oCtia = new Criteria ('workflow');
|
||||
$oCtia = new Criteria('workflow');
|
||||
$oCtia->add(LicenseManagerPeer::LICENSE_STATUS, 'ACTIVE');
|
||||
$oDataset = LicenseManagerPeer::doSelectRS($oCtia);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
$oCtiaA = new Criteria ('workflow');
|
||||
$oCtiaA = new Criteria('workflow');
|
||||
$oCtiaA->add(LicenseManagerPeer::LICENSE_UID, $aRow [0]);
|
||||
|
||||
$oCtiaB = new Criteria ('workflow');
|
||||
$oCtiaB = new Criteria('workflow');
|
||||
$oCtiaB->add(LicenseManagerPeer::LICENSE_STATUS, 'INACTIVE');
|
||||
BasePeer::doUpdate($oCtiaA, $oCtiaB, Propel::getConnection('workflow'));
|
||||
return 'ACTIVE';
|
||||
@@ -468,7 +469,7 @@ class PmLicenseManager
|
||||
//if exists the row in the database propel will update it, otherwise will insert.
|
||||
$tr = LicenseManagerPeer::retrieveByPK($LicenseUid);
|
||||
if (!(is_object($tr) && get_class($tr) == 'LicenseManager')) {
|
||||
$tr = new LicenseManager ();
|
||||
$tr = new LicenseManager();
|
||||
}
|
||||
$tr->setLicenseUid($LicenseUid);
|
||||
$tr->setLicenseUser($LicenseUser);
|
||||
@@ -492,7 +493,7 @@ class PmLicenseManager
|
||||
{
|
||||
try {
|
||||
require_once("classes/model/LicenseManager.php");
|
||||
$oCriteria = new Criteria ('workflow');
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_USER);
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_START);
|
||||
$oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_PATH);
|
||||
|
||||
@@ -452,7 +452,8 @@ class PmTable
|
||||
$previous = null;
|
||||
$queryStack = array();
|
||||
$aDNS = $con->getDSN();
|
||||
$dbEngine = $aDNS["phptype"];
|
||||
$dbEngine = $aDNS['phptype'] === 'mysqli' ? 'mysql' : $aDNS['phptype'];
|
||||
|
||||
|
||||
foreach ($lines as $j => $line) {
|
||||
switch ($dbEngine) {
|
||||
|
||||
@@ -433,7 +433,6 @@ class ProcessMap
|
||||
$oProcess = new Process();
|
||||
|
||||
if (!is_null($oProcess)) {
|
||||
|
||||
$calendar = new Calendar();
|
||||
$files = Processes::getProcessFiles($sProcessUID, 'mail');
|
||||
|
||||
@@ -820,7 +819,7 @@ class ProcessMap
|
||||
}
|
||||
|
||||
global $_DBArray;
|
||||
$_DBArray = (isset($_SESSION['_DBArray']) ? $_SESSION['_DBArray'] : '');
|
||||
$_DBArray = isset($_SESSION['_DBArray']) ? $_SESSION['_DBArray'] : [];
|
||||
$_DBArray['steps'] = $aSteps;
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
$oCriteria = new Criteria('dbarray');
|
||||
@@ -910,7 +909,6 @@ class ProcessMap
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
|
||||
if (($aRow['INP_DOC_TITLE'] == null) || ($aRow['INP_DOC_TITLE'] == "")) {
|
||||
// There is no transaltion for this Document name, try to get/regenerate the label
|
||||
$oInputDocument = new InputDocument;
|
||||
@@ -1191,7 +1189,8 @@ class ProcessMap
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_STATUS, "ACTIVE", Criteria::EQUAL)->addOr(
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_STATUS, "VACATION", Criteria::EQUAL))
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_STATUS, "VACATION", Criteria::EQUAL)
|
||||
)
|
||||
);
|
||||
$oCriteria->add(UsersPeer::USR_UID, $aUIDS2, Criteria::NOT_IN);
|
||||
$oDataset = UsersPeer::doSelectRS($oCriteria);
|
||||
@@ -1398,7 +1397,6 @@ class ProcessMap
|
||||
* Task Notifications *
|
||||
*/
|
||||
if ($iForm == 7 || $iForm == 1) {
|
||||
|
||||
$files = Processes::getProcessFiles($aFields['PRO_UID'], 'mail');
|
||||
|
||||
$templates = array();
|
||||
@@ -1453,7 +1451,7 @@ class ProcessMap
|
||||
if ($iForm == 8) {
|
||||
$oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($_SESSION["cDhTajE2T2lxSkhqMzZUTXVacWYyNcKwV3A4eWYybDdyb1p3"]["TAS_UID"]);
|
||||
if ((is_object($oCaseConsolidated)) && get_class($oCaseConsolidated) == "CaseConsolidatedCore") {
|
||||
require_once ("classes/model/ReportTable.php");
|
||||
require_once("classes/model/ReportTable.php");
|
||||
|
||||
$aFields["CON_STATUS"] = $oCaseConsolidated->getConStatus();
|
||||
$aFields["DYN_UID"] = $oCaseConsolidated->getDynUid();
|
||||
@@ -2076,7 +2074,6 @@ class ProcessMap
|
||||
$triggersArray = "";
|
||||
$triggersArray[] = array('TRI_UID' => 'char', 'PRO_UID' => 'char', 'TRI_TITLE' => 'char', 'TRI_DESCRIPTION' => 'char');
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
|
||||
if (($aRow['TRI_TITLE'] == null) || ($aRow['TRI_TITLE'] == "")) {
|
||||
// There is no transaltion for this Trigger name, try to get/regenerate the label
|
||||
$triggerO = new Triggers();
|
||||
@@ -2099,7 +2096,7 @@ class ProcessMap
|
||||
|
||||
public function getTriggers($sProcessUID = '')
|
||||
{
|
||||
$aTriggers = Array();
|
||||
$aTriggers = array();
|
||||
$oCriteria = $this->getTriggersCriteria($sProcessUID);
|
||||
|
||||
$oDataset = RoutePeer::doSelectRS($oCriteria);
|
||||
@@ -2144,9 +2141,9 @@ class ProcessMap
|
||||
$oLogCaseScheduler = new LogCasesScheduler();
|
||||
$aRows = $oLogCaseScheduler->getAll();
|
||||
|
||||
$fieldNames = Array('PRO_UID' => 'char', 'TAS_UID' => 'char', 'USR_NAME' => 'char', 'EXEC_DATE' => 'char', 'EXEC_HOUR' => 'char', 'RESULT' => 'char', 'SCH_UID' => 'char', 'WS_CREATE_CASE_STATUS' => 'char', 'WS_ROUTE_CASE_STATUS' => 'char' );
|
||||
$fieldNames = array('PRO_UID' => 'char', 'TAS_UID' => 'char', 'USR_NAME' => 'char', 'EXEC_DATE' => 'char', 'EXEC_HOUR' => 'char', 'RESULT' => 'char', 'SCH_UID' => 'char', 'WS_CREATE_CASE_STATUS' => 'char', 'WS_ROUTE_CASE_STATUS' => 'char' );
|
||||
|
||||
$aRows = array_merge(Array($fieldNames), $aRows);
|
||||
$aRows = array_merge(array($fieldNames), $aRows);
|
||||
|
||||
$_DBArray['log_cases_scheduler'] = $aRows;
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
@@ -2339,7 +2336,6 @@ class ProcessMap
|
||||
throw new Exception(G::loadTranslation('ID_INVALID_ROU_TYPE_DEFINITION_ON_ROUTE_TABLE'));
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Exception(G::loadTranslation('ID_NO_DERIVATIONS_DEFINED'));
|
||||
}
|
||||
@@ -2455,7 +2451,6 @@ class ProcessMap
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
switch ($sType) {
|
||||
@@ -3114,8 +3109,7 @@ class ProcessMap
|
||||
*/
|
||||
public function listNoProcessesUser($sProcessUID)
|
||||
{
|
||||
|
||||
$memcache = & PMmemcached::getSingleton(config("system.workspace"));
|
||||
$memcache = PMmemcached::getSingleton(config("system.workspace"));
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(ProcessUserPeer::USR_UID);
|
||||
@@ -3228,7 +3222,7 @@ class ProcessMap
|
||||
*/
|
||||
public function assignProcessUser($sProcessUID, $sUsrUID, $sTypeUID)
|
||||
{
|
||||
$oProcessUser = new ProcessUser ( );
|
||||
$oProcessUser = new ProcessUser();
|
||||
$puType = 'SUPERVISOR';
|
||||
if ($sTypeUID == 'Group') {
|
||||
$puType = 'GROUP_SUPERVISOR';
|
||||
@@ -3256,7 +3250,6 @@ class ProcessMap
|
||||
*/
|
||||
public function getObjectsPermissionsCriteria($sProcessUID)
|
||||
{
|
||||
|
||||
$aObjectsPermissions = array();
|
||||
$aObjectsPermissions[] = array('OP_UID' => 'char', 'TASK_TARGET' => 'char', 'GROUP_USER' => 'char', 'TASK_SOURCE' => 'char', 'OBJECT_TYPE' => 'char', 'OBJECT' => 'char', 'PARTICIPATED' => 'char', 'ACTION' => 'char', 'OP_CASE_STATUS' => 'char');
|
||||
$oCriteria = new Criteria('workflow');
|
||||
@@ -3434,7 +3427,6 @@ class ProcessMap
|
||||
|
||||
public function getExtObjectsPermissions($start, $limit, $sProcessUID)
|
||||
{
|
||||
|
||||
$aObjectsPermissions = array();
|
||||
//$aObjectsPermissions [] = array('OP_UID' => 'char', 'TASK_TARGET' => 'char', 'GROUP_USER' => 'char', 'TASK_SOURCE' => 'char', 'OBJECT_TYPE' => 'char', 'OBJECT' => 'char', 'PARTICIPATED' => 'char', 'ACTION' => 'char', 'OP_CASE_STATUS' => 'char');
|
||||
$oCriteria = new Criteria('workflow');
|
||||
@@ -3663,13 +3655,19 @@ class ProcessMap
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_NewObjectPermission', '',
|
||||
$G_PUBLISH->AddContent(
|
||||
'xmlform',
|
||||
'xmlform',
|
||||
'processes/processes_NewObjectPermission',
|
||||
'',
|
||||
array('GROUP_USER' => $usersGroups,
|
||||
'LANG' => SYS_LANG,
|
||||
'PRO_UID' => $sProcessUID,
|
||||
'ID_DELETE' => G::LoadTranslation('ID_DELETE'),
|
||||
'ID_RESEND' => G::LoadTranslation('ID_RESEND')
|
||||
), 'processes_SaveObjectPermission');
|
||||
),
|
||||
'processes_SaveObjectPermission'
|
||||
);
|
||||
G::RenderPage('publish', 'raw');
|
||||
return true;
|
||||
}
|
||||
@@ -3683,7 +3681,6 @@ class ProcessMap
|
||||
*/
|
||||
public function editObjectPermission($sOP_UID, $sProcessUID)
|
||||
{
|
||||
|
||||
$user = '';
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->add(ObjectPermissionPeer::OP_UID, $sOP_UID);
|
||||
@@ -4111,7 +4108,6 @@ class ProcessMap
|
||||
*/
|
||||
public function processFilesManager($sProcessUID)
|
||||
{
|
||||
|
||||
global $_DBArray;
|
||||
global $G_PUBLISH;
|
||||
|
||||
@@ -4462,7 +4458,7 @@ class ProcessMap
|
||||
try {
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher = headPublisher::getSingleton();
|
||||
$oHeadPublisher->addScriptFile('/jscore/events/events.js');
|
||||
|
||||
switch ($type) {
|
||||
@@ -4579,7 +4575,7 @@ class ProcessMap
|
||||
public function loadProcessCategory()
|
||||
{
|
||||
$aProcessCategory = '';
|
||||
require_once ("classes/model/ProcessCategory.php");
|
||||
require_once("classes/model/ProcessCategory.php");
|
||||
$Criteria = new Criteria('workflow');
|
||||
$Criteria->clearSelectColumns();
|
||||
|
||||
@@ -4679,7 +4675,6 @@ class ProcessMap
|
||||
*/
|
||||
public function getAllProcesses()
|
||||
{
|
||||
|
||||
$aProcesses = array();
|
||||
//$aProcesses [] = array ('PRO_UID' => 'char', 'PRO_TITLE' => 'char');
|
||||
$oCriteria = new Criteria('workflow');
|
||||
@@ -5773,7 +5768,6 @@ class ProcessMap
|
||||
*/
|
||||
public function listExtProcessesSupervisors($start, $limit, $sProcessUID)
|
||||
{
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(ProcessUserPeer::PU_UID);
|
||||
$oCriteria->addSelectColumn(ProcessUserPeer::USR_UID);
|
||||
@@ -5811,8 +5805,7 @@ class ProcessMap
|
||||
*/
|
||||
public function listExtNoProcessesUser($sProcessUID)
|
||||
{
|
||||
|
||||
$memcache = & PMmemcached::getSingleton(config("system.workspace"));
|
||||
$memcache = PMmemcached::getSingleton(config("system.workspace"));
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(ProcessUserPeer::USR_UID);
|
||||
@@ -6819,7 +6812,6 @@ class ProcessMap
|
||||
$triggersArray = "";
|
||||
$triggersArray[] = array('TRI_UID' => 'char', 'PRO_UID' => 'char', 'TRI_TITLE' => 'char', 'TRI_DESCRIPTION' => 'char' );
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
|
||||
if (($aRow['TRI_TITLE'] == null) || ($aRow['TRI_TITLE'] == "")) {
|
||||
// There is no translation for this Trigger name, try to get/regenerate the label
|
||||
$triggerO = new Triggers();
|
||||
@@ -6867,4 +6859,3 @@ class ProcessMap
|
||||
return (int) $row['MAX_X'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,11 +5,26 @@
|
||||
*/
|
||||
class ReportTables
|
||||
{
|
||||
private $aDef = array('mysql' => array('number' => 'DOUBLE', 'char' => 'VARCHAR(255)', 'text' => 'TEXT', 'date' => 'DATETIME'
|
||||
), 'pgsql' => array('number' => 'DOUBLE', 'char' => 'VARCHAR(255)', 'text' => 'TEXT', 'date' => 'DATETIME'
|
||||
), 'mssql' => array('number' => 'FLOAT', 'char' => 'NVARCHAR(255)', 'text' => 'TEXT', 'date' => 'CHAR(19)'
|
||||
) /* Changed DATETIME CHAR(19) for compatibility issues. */);
|
||||
//private $sPrefix = 'REP_';
|
||||
private $aDef = array(
|
||||
'mysql' => array(
|
||||
'number' => 'DOUBLE',
|
||||
'char' => 'VARCHAR(255)',
|
||||
'text' => 'TEXT',
|
||||
'date' => 'DATETIME'
|
||||
),
|
||||
'pgsql' => array(
|
||||
'number' => 'DOUBLE',
|
||||
'char' => 'VARCHAR(255)',
|
||||
'text' => 'TEXT',
|
||||
'date' => 'DATETIME'
|
||||
),
|
||||
'mssql' => array(
|
||||
'number' => 'FLOAT',
|
||||
'char' => 'NVARCHAR(255)',
|
||||
'text' => 'TEXT',
|
||||
'date' => 'CHAR(19)'
|
||||
) /* Changed DATETIME CHAR(19) for compatibility issues. */
|
||||
);
|
||||
private $sPrefix = '';
|
||||
|
||||
/**
|
||||
@@ -17,7 +32,9 @@ class ReportTables
|
||||
* This function delete all reports
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $$sRepTabUid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteAllReportVars($sRepTabUid = '')
|
||||
@@ -36,8 +53,10 @@ class ReportTables
|
||||
* This function removes the table
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $sTableName Table name
|
||||
* @param string $sConnection Conexion
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dropTable($sTableName, $sConnection = 'report')
|
||||
@@ -54,7 +73,7 @@ class ReportTables
|
||||
break;
|
||||
case 'mssql':
|
||||
$rs = $stmt->executeQuery("IF OBJECT_ID (N'" . $sTableName . "', N'U') IS NOT NULL
|
||||
DROP TABLE [" . $sTableName . "]");
|
||||
DROP TABLE [" . $sTableName . "]");
|
||||
break;
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
@@ -67,14 +86,22 @@ class ReportTables
|
||||
* This Function creates the table
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $sTableName Table name
|
||||
* @param string $sConnection Connection name
|
||||
* @param string $sType
|
||||
* @param array $aFields
|
||||
* @param string $bDefaultFields
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $bDefaultFields = true)
|
||||
public function createTable(
|
||||
$sTableName,
|
||||
$sConnection = 'report',
|
||||
$sType = 'NORMAL',
|
||||
$aFields = array(),
|
||||
$bDefaultFields = true
|
||||
)
|
||||
{
|
||||
$sTableName = $this->sPrefix . $sTableName;
|
||||
//we have to do the propel connection
|
||||
@@ -108,7 +135,7 @@ class ReportTables
|
||||
}
|
||||
}
|
||||
if ($bDefaultFields) {
|
||||
$sQuery .= 'PRIMARY KEY (APP_UID' . ($sType == 'GRID' ? ',ROW' : '') . ')) ';
|
||||
$sQuery .= 'PRIMARY KEY (APP_UID' . ($sType === 'GRID' ? ',ROW' : '') . ')) ';
|
||||
}
|
||||
$sQuery .= ' DEFAULT CHARSET=utf8;';
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
@@ -157,15 +184,24 @@ class ReportTables
|
||||
* This Function fills the table
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $sTableName Table name
|
||||
* @param string $sConnection Connection name
|
||||
* @param string $sType
|
||||
* @param array $aFields
|
||||
* @param string $sProcessUid
|
||||
* @param string $sGrid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function populateTable($sTableName, $sConnection = 'report', $sType = 'NORMAL', $aFields = array(), $sProcessUid = '', $sGrid = '')
|
||||
public function populateTable(
|
||||
$sTableName,
|
||||
$sConnection = 'report',
|
||||
$sType = 'NORMAL',
|
||||
$aFields = array(),
|
||||
$sProcessUid = '',
|
||||
$sGrid = ''
|
||||
)
|
||||
{
|
||||
$sTableName = $this->sPrefix . $sTableName;
|
||||
//we have to do the propel connection
|
||||
@@ -201,14 +237,21 @@ class ReportTables
|
||||
foreach ($aFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(',', '', $aData[$aField['sFieldName']]) : '0');
|
||||
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aData[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aData[$aField['sFieldName']])) {
|
||||
$aData[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? @mysql_real_escape_string($aData[$aField['sFieldName']]) : '') . "'";
|
||||
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aData[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$value = (isset($aData[$aField['sFieldName']]) && trim($aData[$aField['sFieldName']])) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL';
|
||||
@@ -230,14 +273,21 @@ class ReportTables
|
||||
foreach ($aFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aGridRow[$aField['sFieldName']])) {
|
||||
$aGridRow[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$value = (isset($aGridRow[$aField['sFieldName']]) && trim($aGridRow[$aField['sFieldName']])) != '' ? "'" . $aGridRow[$aField['sFieldName']] . "'" : 'NULL';
|
||||
@@ -266,7 +316,11 @@ class ReportTables
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aData = unserialize($aRow['APP_DATA']);
|
||||
mysql_query('DELETE FROM [' . $sTableName . "] WHERE APP_UID = '" . $aRow['APP_UID'] . "'");
|
||||
//verify use mssql
|
||||
mysqli_query(
|
||||
$con->getResource(),
|
||||
'DELETE FROM [' . $sTableName . "] WHERE APP_UID = '" . $aRow['APP_UID'] . "'"
|
||||
);
|
||||
if ($sType == 'NORMAL') {
|
||||
$sQuery = 'INSERT INTO [' . $sTableName . '] (';
|
||||
$sQuery .= '[APP_UID],[APP_NUMBER]';
|
||||
@@ -277,14 +331,21 @@ class ReportTables
|
||||
foreach ($aFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(',', '', $aData[$aField['sFieldName']]) : '0');
|
||||
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aData[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aData[$aField['sFieldName']])) {
|
||||
$aData[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysql_real_escape_string($aData[$aField['sFieldName']]) : '') . "'";
|
||||
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aData[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? $aData[$aField['sFieldName']] : '') . "'";
|
||||
@@ -305,14 +366,21 @@ class ReportTables
|
||||
foreach ($aFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aGridRow[$aField['sFieldName']])) {
|
||||
$aGridRow[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
|
||||
@@ -338,8 +406,10 @@ class ReportTables
|
||||
* Function getTableVars
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $sRepTabUid
|
||||
* @param boolean $bWhitType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getTableVars($sRepTabUid, $bWhitType = false)
|
||||
@@ -356,7 +426,9 @@ class ReportTables
|
||||
if ($bWhitType) {
|
||||
if (!in_array($aRow['REP_VAR_NAME'], $aImportedVars)) {
|
||||
$aImportedVars[] = $aRow['REP_VAR_NAME'];
|
||||
$aVars[] = array('sFieldName' => $aRow['REP_VAR_NAME'], 'sType' => $aRow['REP_VAR_TYPE']
|
||||
$aVars[] = array(
|
||||
'sFieldName' => $aRow['REP_VAR_NAME'],
|
||||
'sType' => $aRow['REP_VAR_TYPE']
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -375,7 +447,9 @@ class ReportTables
|
||||
* This Function deletes report table
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $sRepTabUid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteReportTable($sRepTabUid)
|
||||
@@ -400,8 +474,10 @@ class ReportTables
|
||||
* This function gets the split date
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param date $date
|
||||
* @param string $mask
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSplitDate($date, $mask)
|
||||
@@ -465,7 +541,10 @@ class ReportTables
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Array(isset($d1) ? $d1 : '', isset($d2) ? $d2 : '', isset($d3) ? $d3 : ''
|
||||
return array(
|
||||
isset($d1) ? $d1 : '',
|
||||
isset($d2) ? $d2 : '',
|
||||
isset($d3) ? $d3 : ''
|
||||
);
|
||||
}
|
||||
|
||||
@@ -474,13 +553,14 @@ class ReportTables
|
||||
* This function returns the date formated
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param date $sDate
|
||||
* @param date $sMask
|
||||
*
|
||||
* @return date
|
||||
*/
|
||||
public function getFormatDate($sDate, $sMask)
|
||||
{
|
||||
//print $sDate." *** ". $sMask."<BR>";
|
||||
$dateTime = explode(" ", $sDate); //To accept the Hour part
|
||||
$aDate = explode('-', str_replace("/", "-", $dateTime[0]));
|
||||
$bResult = true;
|
||||
@@ -512,10 +592,12 @@ class ReportTables
|
||||
* This function updated the Report Tables
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $sProcessUid
|
||||
* @param string $sApplicationUid
|
||||
* @param string $iApplicationNumber
|
||||
* @param string $aFields
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updateTables($sProcessUid, $sApplicationUid, $iApplicationNumber, $aFields)
|
||||
@@ -545,6 +627,7 @@ class ReportTables
|
||||
$aRow['REP_TAB_NAME'] = $this->sPrefix . $aRow['REP_TAB_NAME'];
|
||||
$PropelDatabase = $this->chooseDB($aRow['REP_TAB_CONNECTION']);
|
||||
$con = Propel::getConnection($PropelDatabase);
|
||||
$con->getResource();
|
||||
$stmt = $con->createStatement();
|
||||
switch (DB_ADAPTER) {
|
||||
case 'mysql':
|
||||
@@ -570,7 +653,11 @@ class ReportTables
|
||||
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(',', '', $aFields[$aField['sFieldName']]) : '0') . ',';
|
||||
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0') . ',';
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
@@ -583,7 +670,10 @@ class ReportTables
|
||||
if (is_array($aFields[$aField['sFieldName']])) {
|
||||
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']][0] : '') . "',";
|
||||
} else {
|
||||
$sQuery .= '\'' . ((isset($aFields[$aField['sFieldName']])) ? @mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . '\',';
|
||||
$sQuery .= '\'' . ((isset($aFields[$aField['sFieldName']])) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . '\',';
|
||||
}
|
||||
break;
|
||||
case 'date':
|
||||
@@ -605,9 +695,15 @@ class ReportTables
|
||||
try {
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], config("system.workspace"), 'processmaker.log');
|
||||
Bootstrap::registerMonolog(
|
||||
'sqlExecution',
|
||||
400,
|
||||
'Sql Execution',
|
||||
['sql' => $sQuery, 'error' => $e->getMessage()],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` (';
|
||||
@@ -619,14 +715,21 @@ class ReportTables
|
||||
foreach ($aTableFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(',', '', $aFields[$aField['sFieldName']]) : '0');
|
||||
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . "'";
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$mysqlDate = (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '');
|
||||
@@ -644,7 +747,14 @@ class ReportTables
|
||||
try {
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], config("system.workspace"), 'processmaker.log');
|
||||
Bootstrap::registerMonolog(
|
||||
'sqlExecution',
|
||||
400,
|
||||
'Sql Execution',
|
||||
['sql' => $sQuery, 'error' => $e->getMessage()],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -665,14 +775,21 @@ class ReportTables
|
||||
foreach ($aTableFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aGridRow[$aField['sFieldName']])) {
|
||||
$aGridRow[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
|
||||
@@ -700,14 +817,21 @@ class ReportTables
|
||||
$sQuery .= '[' . $aField['sFieldName'] . '] = ';
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(',', '', $aFields[$aField['sFieldName']]) : '0') . ',';
|
||||
$sQuery .= (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0') . ',';
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . "',";
|
||||
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . "',";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= "'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '') . "',";
|
||||
@@ -726,14 +850,21 @@ class ReportTables
|
||||
foreach ($aTableFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(',', '', $aFields[$aField['sFieldName']]) : '0');
|
||||
$sQuery .= ',' . (isset($aFields[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aFields[$aField['sFieldName']])) {
|
||||
$aFields[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysql_real_escape_string($aFields[$aField['sFieldName']]) : '') . "'";
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aFields[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aFields[$aField['sFieldName']]) ? $aFields[$aField['sFieldName']] : '') . "'";
|
||||
@@ -744,7 +875,11 @@ class ReportTables
|
||||
}
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
} else {
|
||||
mysql_query('DELETE FROM [' . $aRow['REP_TAB_NAME'] . "] WHERE APP_UID = '" . $sApplicationUid . "'");
|
||||
//Verify use in mssql
|
||||
mysqli_query(
|
||||
$con->getResource(),
|
||||
'DELETE FROM [' . $aRow['REP_TAB_NAME'] . "] WHERE APP_UID = '" . $sApplicationUid . "'"
|
||||
);
|
||||
$aAux = explode('-', $aRow['REP_TAB_GRID']);
|
||||
if (isset($aFields[$aAux[0]])) {
|
||||
foreach ($aFields[$aAux[0]] as $iRow => $aGridRow) {
|
||||
@@ -757,14 +892,21 @@ class ReportTables
|
||||
foreach ($aTableFields as $aField) {
|
||||
switch ($aField['sType']) {
|
||||
case 'number':
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(',', '', $aGridRow[$aField['sFieldName']]) : '0');
|
||||
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
|
||||
',',
|
||||
'',
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '0');
|
||||
break;
|
||||
case 'char':
|
||||
case 'text':
|
||||
if (!isset($aGridRow[$aField['sFieldName']])) {
|
||||
$aGridRow[$aField['sFieldName']] = '';
|
||||
}
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysql_real_escape_string($aGridRow[$aField['sFieldName']]) : '') . "'";
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
|
||||
$con->getResource(),
|
||||
$aGridRow[$aField['sFieldName']]
|
||||
) : '') . "'";
|
||||
break;
|
||||
case 'date':
|
||||
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
|
||||
@@ -809,7 +951,9 @@ class ReportTables
|
||||
* Choose the database to connect
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $TabConnectionk
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function chooseDB($TabConnectionk)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,10 @@
|
||||
|
||||
class XMLConnection
|
||||
{
|
||||
var $phptype = 'myxml';
|
||||
var $caseFolding = true;
|
||||
var $xmldoc = null;
|
||||
var $xmlFile = '';
|
||||
public $phptype = 'myxml';
|
||||
public $caseFolding = true;
|
||||
public $xmldoc = null;
|
||||
public $xmlFile = '';
|
||||
|
||||
/**
|
||||
* XMLConnection
|
||||
@@ -13,10 +13,10 @@ class XMLConnection
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
public function XMLConnection ($file)
|
||||
public function XMLConnection($file)
|
||||
{
|
||||
$this->xmldoc = new Xml_Document();
|
||||
$this->xmldoc->parseXmlFile( $file );
|
||||
$this->xmldoc->parseXmlFile($file);
|
||||
$this->xmlFile = $file;
|
||||
}
|
||||
|
||||
@@ -27,74 +27,74 @@ class XMLConnection
|
||||
* @param string $sql
|
||||
* @return object(XMLResult) $result
|
||||
*/
|
||||
public function &query ($sql)
|
||||
public function &query($sql)
|
||||
{
|
||||
if (! isset( $this->xmldoc )) {
|
||||
$err = new DB_Error( "Error: Closed xmlConnection." );
|
||||
if (! isset($this->xmldoc)) {
|
||||
$err = new DB_Error("Error: Closed xmlConnection.");
|
||||
return $err;
|
||||
}
|
||||
if (1 === preg_match( '/^\s*SELECT\s+([\w\W]+?)(?:\s+FROM\s+`?([^`]+?)`?)(?:\s+WHERE\s+([\w\W]+?))?(?:\s+GROUP\s+BY\s+([\w\W]+?))?(?:\s+ORDER\s+BY\s+([\w\W]+?))?(?:\s+BETWEEN\s+([\w\W]+?)\s+AND\s+([\w\W]+?))?(?:\s+LIMIT\s+(\d+)\s*,\s*(\d+))?\s*$/im', $sql, $matches )) {
|
||||
if (1 === preg_match('/^\s*SELECT\s+([\w\W]+?)(?:\s+FROM\s+`?([^`]+?)`?)(?:\s+WHERE\s+([\w\W]+?))?(?:\s+GROUP\s+BY\s+([\w\W]+?))?(?:\s+ORDER\s+BY\s+([\w\W]+?))?(?:\s+BETWEEN\s+([\w\W]+?)\s+AND\s+([\w\W]+?))?(?:\s+LIMIT\s+(\d+)\s*,\s*(\d+))?\s*$/im', $sql, $matches)) {
|
||||
$sqlColumns = $matches[1];
|
||||
$sqlFrom = isset( $matches[2] ) ? $matches[2] : '';
|
||||
$sqlWhere = isset( $matches[3] ) ? $matches[3] : '';
|
||||
$sqlGroupBy = isset( $matches[4] ) ? $matches[4] : '';
|
||||
$sqlOrderBy = isset( $matches[5] ) ? $matches[5] : '';
|
||||
$sqlLowLimit = isset( $matches[8] ) ? $matches[8] : '';
|
||||
$sqlHighLimit = isset( $matches[9] ) ? $matches[9] : '';
|
||||
$sqlFrom = isset($matches[2]) ? $matches[2] : '';
|
||||
$sqlWhere = isset($matches[3]) ? $matches[3] : '';
|
||||
$sqlGroupBy = isset($matches[4]) ? $matches[4] : '';
|
||||
$sqlOrderBy = isset($matches[5]) ? $matches[5] : '';
|
||||
$sqlLowLimit = isset($matches[8]) ? $matches[8] : '';
|
||||
$sqlHighLimit = isset($matches[9]) ? $matches[9] : '';
|
||||
/* Start Block: Fields list */
|
||||
$count = preg_match_all( '/\s*(\*|[\w\.]+)(?:\s+AS\s+([\w\.]+))?/im', $sqlColumns, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE );
|
||||
$fieldsList = array ();
|
||||
$count = preg_match_all('/\s*(\*|[\w\.]+)(?:\s+AS\s+([\w\.]+))?/im', $sqlColumns, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$fieldsList = array();
|
||||
for ($r = 0; $r < $count; $r ++) {
|
||||
$name = (is_array( $match[2][$r] ) && $match[2][$r][0] !== '') ? $match[2][$r][0] : $match[1][$r][0];
|
||||
$name = (is_array($match[2][$r]) && $match[2][$r][0] !== '') ? $match[2][$r][0] : $match[1][$r][0];
|
||||
$fieldsList[$name] = $match[1][$r][0];
|
||||
}
|
||||
/* End Block */
|
||||
/* Start Block: Order list */
|
||||
$count = preg_match_all( '/\s*(\*|[\w\.]+)(\s+ASC|\s+DESC)?\s*,?/im', $sqlOrderBy, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE );
|
||||
$orderList = array ();
|
||||
$count = preg_match_all('/\s*(\*|[\w\.]+)(\s+ASC|\s+DESC)?\s*,?/im', $sqlOrderBy, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$orderList = array();
|
||||
for ($r = $count - 1; $r >= 0; $r --) {
|
||||
$direction = (is_array( $match[2][$r] ) && $match[2][$r][0] !== '') ? $match[2][$r][0] : 'ASC';
|
||||
$direction = strtoupper( $direction );
|
||||
$direction = (is_array($match[2][$r]) && $match[2][$r][0] !== '') ? $match[2][$r][0] : 'ASC';
|
||||
$direction = strtoupper($direction);
|
||||
$orderList[$match[1][$r][0]] = $direction;
|
||||
}
|
||||
/* End Block */
|
||||
$xmlFrom = '/' . str_replace( '.', '/', $sqlFrom );
|
||||
$node = & $this->xmldoc->findNode( $xmlFrom );
|
||||
if (! isset( $node )) {
|
||||
$xmlFrom = '/' . str_replace('.', '/', $sqlFrom);
|
||||
$node = $this->xmldoc->findNode($xmlFrom);
|
||||
if (! isset($node)) {
|
||||
//$err = new DB_Error( "$xmlFrom node not found in $dsn." );
|
||||
throw new Exception( "$xmlFrom node not found in " . $this->xmlFile . "." );
|
||||
throw new Exception("$xmlFrom node not found in " . $this->xmlFile . ".");
|
||||
return $err;
|
||||
} else {
|
||||
$res = $this->fetchChildren( $node );
|
||||
$res = $this->fetchChildren($node);
|
||||
}
|
||||
/* Start Block: WHERE*/
|
||||
if ($sqlWhere !== '') {
|
||||
/*Start Block: Replace the operator */
|
||||
$blocks = preg_split( '/("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', $sqlWhere, - 1, PREG_SPLIT_DELIM_CAPTURE );
|
||||
$blocks = preg_split('/("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', $sqlWhere, - 1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$sqlWhere = '';
|
||||
for ($r = 0; $r < sizeof( $blocks ); $r ++) {
|
||||
for ($r = 0; $r < sizeof($blocks); $r ++) {
|
||||
if (($r % 2) === 0) {
|
||||
$blocks[$r] = str_replace( '=', '==', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( '<>', '!=', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'AND', '&&', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'and', '&&', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'OR', '||', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'or', '||', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'NOT', '!', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'not', '!', $blocks[$r] );
|
||||
$blocks[$r] = preg_replace( '/\b[a-zA-Z_][\w\.]*\b/im', '$res[$r][\'$0\']', $blocks[$r] );
|
||||
$blocks[$r] = preg_replace( '/\$res\[\$r\]\[\'(like)\'\]/im', '$1', $blocks[$r] );
|
||||
$blocks[$r] = str_replace('=', '==', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('<>', '!=', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('AND', '&&', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('and', '&&', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('OR', '||', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('or', '||', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('NOT', '!', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('not', '!', $blocks[$r]);
|
||||
$blocks[$r] = preg_replace('/\b[a-zA-Z_][\w\.]*\b/im', '$res[$r][\'$0\']', $blocks[$r]);
|
||||
$blocks[$r] = preg_replace('/\$res\[\$r\]\[\'(like)\'\]/im', '$1', $blocks[$r]);
|
||||
}
|
||||
$sqlWhere .= $blocks[$r];
|
||||
}
|
||||
$sqlWhere = preg_replace_callback( '/(.+)\s+like\s+("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', array ('XMLConnection','sqlWhereLike'
|
||||
), $sqlWhere );
|
||||
$sqlWhere = preg_replace_callback( '/"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'/im', array ('XMLConnection','sqlString'
|
||||
), $sqlWhere );
|
||||
$newRes = array ();
|
||||
for ($r = 0; $r < sizeof( $res ); $r ++) {
|
||||
$sqlWhere = preg_replace_callback('/(.+)\s+like\s+("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', array('XMLConnection','sqlWhereLike'
|
||||
), $sqlWhere);
|
||||
$sqlWhere = preg_replace_callback('/"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'/im', array('XMLConnection','sqlString'
|
||||
), $sqlWhere);
|
||||
$newRes = array();
|
||||
for ($r = 0; $r < sizeof($res); $r ++) {
|
||||
$evalWhere = false;
|
||||
@eval( '$evalWhere = ' . $sqlWhere . ';' );
|
||||
@eval('$evalWhere = ' . $sqlWhere . ';');
|
||||
if ($evalWhere) {
|
||||
$newRes[] = $res[$r];
|
||||
}
|
||||
@@ -105,14 +105,14 @@ class XMLConnection
|
||||
/* Start Block: Expands the resultant data according to fill an array
|
||||
* with the required fields in the query.
|
||||
*/
|
||||
for ($r = 0; $r < sizeof( $res ); $r ++) {
|
||||
$res[$r] = $this->expandFields( $res[$r], $fieldsList );
|
||||
for ($r = 0; $r < sizeof($res); $r ++) {
|
||||
$res[$r] = $this->expandFields($res[$r], $fieldsList);
|
||||
}
|
||||
/* End Block */
|
||||
/* Start Block: ORDER BY*/
|
||||
foreach ($orderList as $field => $direction) {
|
||||
for ($i = 0; $i < sizeof( $res ); $i ++) {
|
||||
for ($j = $i + 1; $j < sizeof( $res ); $j ++) {
|
||||
for ($i = 0; $i < sizeof($res); $i ++) {
|
||||
for ($j = $i + 1; $j < sizeof($res); $j ++) {
|
||||
$condition = ($direction === 'ASC') ? ($res[$j] < $res[$i]) : ($res[$j] > $res[$i]);
|
||||
if ($condition) {
|
||||
$swap = $res[$i];
|
||||
@@ -127,169 +127,169 @@ class XMLConnection
|
||||
if ($sqlLowLimit != '' && $sqlHighLimit != '') {
|
||||
$sqlLowLimit = (int) $sqlLowLimit;
|
||||
$sqlHighLimit = (int) $sqlHighLimit;
|
||||
$res = array_slice( $res, $sqlLowLimit, $sqlHighLimit );
|
||||
$res = array_slice($res, $sqlLowLimit, $sqlHighLimit);
|
||||
}
|
||||
/* End Block */
|
||||
$result = new XMLResult( $res );
|
||||
$result = new XMLResult($res);
|
||||
return $result;
|
||||
} elseif (1 === preg_match( '/^\s*DELETE\s+FROM\s+`?([^`]+?)`?(?:\s+WHERE\s+([\w\W]+?))?\s*$/im', $sql, $matches )) {
|
||||
$sqlFrom = isset( $matches[1] ) ? $matches[1] : '';
|
||||
$sqlWhere = isset( $matches[2] ) ? $matches[2] : '1';
|
||||
} elseif (1 === preg_match('/^\s*DELETE\s+FROM\s+`?([^`]+?)`?(?:\s+WHERE\s+([\w\W]+?))?\s*$/im', $sql, $matches)) {
|
||||
$sqlFrom = isset($matches[1]) ? $matches[1] : '';
|
||||
$sqlWhere = isset($matches[2]) ? $matches[2] : '1';
|
||||
/* Start Block: WHERE*/
|
||||
/*Start Block: Replace the operator */
|
||||
$blocks = preg_split( '/("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', $sqlWhere, - 1, PREG_SPLIT_DELIM_CAPTURE );
|
||||
$blocks = preg_split('/("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', $sqlWhere, - 1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$sqlWhere = '';
|
||||
for ($r = 0; $r < sizeof( $blocks ); $r ++) {
|
||||
for ($r = 0; $r < sizeof($blocks); $r ++) {
|
||||
if (($r % 2) === 0) {
|
||||
$blocks[$r] = str_replace( '=', '==', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( '<>', '!=', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'AND', '&&', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'and', '&&', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'OR', '||', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'or', '||', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'NOT', '!', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'not', '!', $blocks[$r] );
|
||||
$blocks[$r] = preg_replace( '/\b[a-zA-Z_][\w\.]*\b/im', '$res[$r][\'$0\']', $blocks[$r] );
|
||||
$blocks[$r] = preg_replace( '/\$res\[\$r\]\[\'(like)\'\]/im', '$1', $blocks[$r] );
|
||||
$blocks[$r] = str_replace('=', '==', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('<>', '!=', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('AND', '&&', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('and', '&&', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('OR', '||', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('or', '||', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('NOT', '!', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('not', '!', $blocks[$r]);
|
||||
$blocks[$r] = preg_replace('/\b[a-zA-Z_][\w\.]*\b/im', '$res[$r][\'$0\']', $blocks[$r]);
|
||||
$blocks[$r] = preg_replace('/\$res\[\$r\]\[\'(like)\'\]/im', '$1', $blocks[$r]);
|
||||
}
|
||||
$sqlWhere .= $blocks[$r];
|
||||
}
|
||||
/* End Block */
|
||||
$sqlWhere = preg_replace_callback( '/(.+)\s+like\s+("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', array ('XMLConnection','sqlWhereLike'
|
||||
), $sqlWhere );
|
||||
$sqlWhere = preg_replace_callback( '/"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'/im', array ('XMLConnection','sqlString'
|
||||
), $sqlWhere );
|
||||
$sqlWhere = preg_replace_callback('/(.+)\s+like\s+("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', array('XMLConnection','sqlWhereLike'
|
||||
), $sqlWhere);
|
||||
$sqlWhere = preg_replace_callback('/"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'/im', array('XMLConnection','sqlString'
|
||||
), $sqlWhere);
|
||||
|
||||
/*Start Block: Removing fields */
|
||||
$xmlFrom = '/' . str_replace( '.', '/', $sqlFrom );
|
||||
$node = & $this->xmldoc->findNode( $xmlFrom );
|
||||
if (! isset( $node )) {
|
||||
$err = new DB_Error( "$xmlFrom node not found!." );
|
||||
$xmlFrom = '/' . str_replace('.', '/', $sqlFrom);
|
||||
$node = $this->xmldoc->findNode($xmlFrom);
|
||||
if (! isset($node)) {
|
||||
$err = new DB_Error("$xmlFrom node not found!.");
|
||||
return $err;
|
||||
} else {
|
||||
$res = $this->fetchChildren( $node );
|
||||
$res = $this->fetchChildren($node);
|
||||
}
|
||||
$newRes = array ();
|
||||
for ($r = 0; $r < sizeof( $res ); $r ++) {
|
||||
$newRes = array();
|
||||
for ($r = 0; $r < sizeof($res); $r ++) {
|
||||
$evalWhere = false;
|
||||
@eval( '$evalWhere = ' . $sqlWhere . ';' );
|
||||
@eval('$evalWhere = ' . $sqlWhere . ';');
|
||||
if ($evalWhere) {
|
||||
unset( $node->children[$r] );
|
||||
unset($node->children[$r]);
|
||||
$newRes[] = $res[$r];
|
||||
}
|
||||
}
|
||||
//Re-index
|
||||
$node->children = array_values( $node->children );
|
||||
$node->children = array_values($node->children);
|
||||
/* End Block */
|
||||
$this->xmldoc->save( $this->xmlFile );
|
||||
$result = new XMLResult( $newRes );
|
||||
$this->xmldoc->save($this->xmlFile);
|
||||
$result = new XMLResult($newRes);
|
||||
return $result;
|
||||
} elseif (1 === preg_match( '/^\s*INSERT\s+INTO\s+`?([^`]+?)`?\s*\(([\w\W]+?)\)\s+VALUES\s*\(([\w\W]+?)\)\s*$/im', $sql, $matches )) {
|
||||
$sqlFrom = isset( $matches[1] ) ? $matches[1] : '';
|
||||
$sqlColumns = isset( $matches[2] ) ? $matches[2] : '1';
|
||||
$sqlValues = isset( $matches[3] ) ? $matches[3] : '1';
|
||||
$xmlFrom = '/' . str_replace( '.', '/', $sqlFrom );
|
||||
$node = & $this->xmldoc->findNode( $xmlFrom );
|
||||
} elseif (1 === preg_match('/^\s*INSERT\s+INTO\s+`?([^`]+?)`?\s*\(([\w\W]+?)\)\s+VALUES\s*\(([\w\W]+?)\)\s*$/im', $sql, $matches)) {
|
||||
$sqlFrom = isset($matches[1]) ? $matches[1] : '';
|
||||
$sqlColumns = isset($matches[2]) ? $matches[2] : '1';
|
||||
$sqlValues = isset($matches[3]) ? $matches[3] : '1';
|
||||
$xmlFrom = '/' . str_replace('.', '/', $sqlFrom);
|
||||
$node = $this->xmldoc->findNode($xmlFrom);
|
||||
/* Start Block: Fields list */
|
||||
$count = preg_match_all( '/([\w\.]+)/im', $sqlColumns, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE );
|
||||
$fieldsList = array ();
|
||||
$count = preg_match_all('/([\w\.]+)/im', $sqlColumns, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$fieldsList = array();
|
||||
for ($r = 0; $r < $count; $r ++) {
|
||||
$fieldsList[] = $match[1][$r][0];
|
||||
}
|
||||
/* End Block */
|
||||
/* Start Block: Fields Values */
|
||||
$count = preg_match_all( '/("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'|\d+)/im', $sqlValues, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE );
|
||||
$fieldsValues = array ();
|
||||
$count = preg_match_all('/("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'|\d+)/im', $sqlValues, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$fieldsValues = array();
|
||||
for ($r = 0; $r < $count; $r ++) {
|
||||
if (substr( $match[1][$r][0], 0, 1 ) === '"') {
|
||||
$match[1][$r][0] = substr( $match[1][$r][0], 1, - 1 );
|
||||
$match[1][$r][0] = str_replace( '""', '"', $match[1][$r][0] );
|
||||
$match[1][$r][0] = str_replace( "''", "'", $match[1][$r][0] );
|
||||
if (substr($match[1][$r][0], 0, 1) === '"') {
|
||||
$match[1][$r][0] = substr($match[1][$r][0], 1, - 1);
|
||||
$match[1][$r][0] = str_replace('""', '"', $match[1][$r][0]);
|
||||
$match[1][$r][0] = str_replace("''", "'", $match[1][$r][0]);
|
||||
}
|
||||
if (substr( $match[1][$r][0], 0, 1 ) === "'") {
|
||||
$match[1][$r][0] = substr( $match[1][$r][0], 1, - 1 );
|
||||
$match[1][$r][0] = str_replace( "''", "'", $match[1][$r][0] );
|
||||
$match[1][$r][0] = str_replace( '""', '"', $match[1][$r][0] );
|
||||
if (substr($match[1][$r][0], 0, 1) === "'") {
|
||||
$match[1][$r][0] = substr($match[1][$r][0], 1, - 1);
|
||||
$match[1][$r][0] = str_replace("''", "'", $match[1][$r][0]);
|
||||
$match[1][$r][0] = str_replace('""', '"', $match[1][$r][0]);
|
||||
}
|
||||
$fieldsValues[$fieldsList[$r]] = $match[1][$r][0];
|
||||
}
|
||||
/* End Block */
|
||||
$AAA = getNames( $this->xmldoc->children[0]->children );
|
||||
$this->insertRow( $node, $fieldsValues );
|
||||
$DDD = getNames( $this->xmldoc->children[0]->children );
|
||||
$this->xmldoc->save( $this->xmlFile );
|
||||
$result = new XMLResult( array ($fieldsValues
|
||||
) );
|
||||
$AAA = getNames($this->xmldoc->children[0]->children);
|
||||
$this->insertRow($node, $fieldsValues);
|
||||
$DDD = getNames($this->xmldoc->children[0]->children);
|
||||
$this->xmldoc->save($this->xmlFile);
|
||||
$result = new XMLResult(array($fieldsValues
|
||||
));
|
||||
return $result;
|
||||
} elseif (1 === preg_match( '/^\s*UPDATE\s+`?([^`]+?)`?\s+SET\s+((?:(?:[a-z][\w\.]*)\s*=\s*(?:"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'|\d+)\s*(?:,\s*)?)+)(?:\s+WHERE\s+([\w\W]+?))?\s*$/im', $sql, $matches )) {
|
||||
$sqlFrom = isset( $matches[1] ) ? $matches[1] : '';
|
||||
$sqlColumns = isset( $matches[2] ) ? $matches[2] : '';
|
||||
$sqlWhere = isset( $matches[3] ) ? $matches[3] : '1';
|
||||
$count = preg_match_all( '/([a-z][\w\.]*)\s*=\s*("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'|\d+)/im', $sqlColumns, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE );
|
||||
$fieldsValues = array ();
|
||||
} elseif (1 === preg_match('/^\s*UPDATE\s+`?([^`]+?)`?\s+SET\s+((?:(?:[a-z][\w\.]*)\s*=\s*(?:"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'|\d+)\s*(?:,\s*)?)+)(?:\s+WHERE\s+([\w\W]+?))?\s*$/im', $sql, $matches)) {
|
||||
$sqlFrom = isset($matches[1]) ? $matches[1] : '';
|
||||
$sqlColumns = isset($matches[2]) ? $matches[2] : '';
|
||||
$sqlWhere = isset($matches[3]) ? $matches[3] : '1';
|
||||
$count = preg_match_all('/([a-z][\w\.]*)\s*=\s*("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'|\d+)/im', $sqlColumns, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$fieldsValues = array();
|
||||
for ($r = 0; $r < $count; $r ++) {
|
||||
if (substr( $match[2][$r][0], 0, 1 ) === '"') {
|
||||
$match[2][$r][0] = substr( $match[2][$r][0], 1, - 1 );
|
||||
$match[2][$r][0] = str_replace( '""', '"', $match[2][$r][0] );
|
||||
$match[2][$r][0] = str_replace( "''", "'", $match[2][$r][0] );
|
||||
if (substr($match[2][$r][0], 0, 1) === '"') {
|
||||
$match[2][$r][0] = substr($match[2][$r][0], 1, - 1);
|
||||
$match[2][$r][0] = str_replace('""', '"', $match[2][$r][0]);
|
||||
$match[2][$r][0] = str_replace("''", "'", $match[2][$r][0]);
|
||||
}
|
||||
if (substr( $match[2][$r][0], 0, 1 ) === "'") {
|
||||
$match[2][$r][0] = substr( $match[2][$r][0], 1, - 1 );
|
||||
$match[2][$r][0] = str_replace( "''", "'", $match[2][$r][0] );
|
||||
$match[2][$r][0] = str_replace( '""', '"', $match[2][$r][0] );
|
||||
if (substr($match[2][$r][0], 0, 1) === "'") {
|
||||
$match[2][$r][0] = substr($match[2][$r][0], 1, - 1);
|
||||
$match[2][$r][0] = str_replace("''", "'", $match[2][$r][0]);
|
||||
$match[2][$r][0] = str_replace('""', '"', $match[2][$r][0]);
|
||||
}
|
||||
$fieldsValues[$match[1][$r][0]] = $match[2][$r][0];
|
||||
}
|
||||
/* Start Block: WHERE*/
|
||||
/*Start Block: Replace the operator */
|
||||
$blocks = preg_split( '/("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', $sqlWhere, - 1, PREG_SPLIT_DELIM_CAPTURE );
|
||||
$blocks = preg_split('/("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', $sqlWhere, - 1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$sqlWhere = '';
|
||||
for ($r = 0; $r < sizeof( $blocks ); $r ++) {
|
||||
for ($r = 0; $r < sizeof($blocks); $r ++) {
|
||||
if (($r % 2) === 0) {
|
||||
$blocks[$r] = str_replace( '=', '==', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( '<>', '!=', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'AND', '&&', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'and', '&&', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'OR', '||', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'or', '||', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'NOT', '!', $blocks[$r] );
|
||||
$blocks[$r] = str_replace( 'not', '!', $blocks[$r] );
|
||||
$blocks[$r] = preg_replace( '/\b[a-zA-Z_][\w\.]*\b/im', '$res[$r][\'$0\']', $blocks[$r] );
|
||||
$blocks[$r] = preg_replace( '/\$res\[\$r\]\[\'(like)\'\]/im', '$1', $blocks[$r] );
|
||||
$blocks[$r] = str_replace('=', '==', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('<>', '!=', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('AND', '&&', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('and', '&&', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('OR', '||', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('or', '||', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('NOT', '!', $blocks[$r]);
|
||||
$blocks[$r] = str_replace('not', '!', $blocks[$r]);
|
||||
$blocks[$r] = preg_replace('/\b[a-zA-Z_][\w\.]*\b/im', '$res[$r][\'$0\']', $blocks[$r]);
|
||||
$blocks[$r] = preg_replace('/\$res\[\$r\]\[\'(like)\'\]/im', '$1', $blocks[$r]);
|
||||
}
|
||||
$sqlWhere .= $blocks[$r];
|
||||
}
|
||||
/* End Block */
|
||||
$sqlWhere = preg_replace_callback( '/(.+)\s+like\s+("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', array ('XMLConnection','sqlWhereLike'
|
||||
), $sqlWhere );
|
||||
$sqlWhere = preg_replace_callback( '/"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'/im', array ('XMLConnection','sqlString'
|
||||
), $sqlWhere );
|
||||
$sqlWhere = preg_replace_callback('/(.+)\s+like\s+("(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\')/im', array('XMLConnection','sqlWhereLike'
|
||||
), $sqlWhere);
|
||||
$sqlWhere = preg_replace_callback('/"(?:(?:[^"]|"")*)"|\'(?:(?:[^\']|\'\')*)\'/im', array('XMLConnection','sqlString'
|
||||
), $sqlWhere);
|
||||
/*Start Block: Removing fields */
|
||||
$xmlFrom = '/' . str_replace( '.', '/', $sqlFrom );
|
||||
$node = & $this->xmldoc->findNode( $xmlFrom );
|
||||
if (! isset( $node )) {
|
||||
$err = new DB_Error( "$xmlFrom node not found in $dsn." );
|
||||
$xmlFrom = '/' . str_replace('.', '/', $sqlFrom);
|
||||
$node = $this->xmldoc->findNode($xmlFrom);
|
||||
if (! isset($node)) {
|
||||
$err = new DB_Error("$xmlFrom node not found in $dsn.");
|
||||
return $err;
|
||||
} else {
|
||||
$res = $this->fetchChildren( $node );
|
||||
$res = $this->fetchChildren($node);
|
||||
}
|
||||
$newRes = array ();
|
||||
for ($r = 0; $r < sizeof( $res ); $r ++) {
|
||||
$newRes = array();
|
||||
for ($r = 0; $r < sizeof($res); $r ++) {
|
||||
$evalWhere = false;
|
||||
@eval( '$evalWhere = ' . $sqlWhere . ';' );
|
||||
@eval('$evalWhere = ' . $sqlWhere . ';');
|
||||
if ($evalWhere) {
|
||||
$this->updateRow( $node->children[$r], $fieldsValues );
|
||||
$newRes[] = array_merge( $res[$r], $fieldsValues );
|
||||
$this->updateRow($node->children[$r], $fieldsValues);
|
||||
$newRes[] = array_merge($res[$r], $fieldsValues);
|
||||
}
|
||||
}
|
||||
/* End Block */
|
||||
$nodeTEST = & $this->xmldoc->findNode( $xmlFrom );
|
||||
$this->xmldoc->save( $this->xmlFile );
|
||||
$result = new XMLResult( $newRes );
|
||||
$nodeTEST = $this->xmldoc->findNode($xmlFrom);
|
||||
$this->xmldoc->save($this->xmlFile);
|
||||
$result = new XMLResult($newRes);
|
||||
return $result;
|
||||
} else {
|
||||
echo ($sql);
|
||||
$err = new DB_Error( "SQL Query is not well formed." );
|
||||
echo($sql);
|
||||
$err = new DB_Error("SQL Query is not well formed.");
|
||||
return $err;
|
||||
}
|
||||
}
|
||||
@@ -300,12 +300,12 @@ class XMLConnection
|
||||
* @param string $a
|
||||
* @return void $b
|
||||
*/
|
||||
public function sqlLike ($a, $b)
|
||||
public function sqlLike($a, $b)
|
||||
{
|
||||
$b = addcslashes( $b, '[]()\/{}.?' );
|
||||
$b = str_replace( "%", '.*', $b );
|
||||
$b = addcslashes($b, '[]()\/{}.?');
|
||||
$b = str_replace("%", '.*', $b);
|
||||
$b = '/^' . $b . '$/im';
|
||||
return preg_match( $b, $a );
|
||||
return preg_match($b, $a);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,16 +315,16 @@ class XMLConnection
|
||||
* @param string $fieldsList
|
||||
* @return array $res
|
||||
*/
|
||||
public function expandFields ($resRow, $fieldsList)
|
||||
public function expandFields($resRow, $fieldsList)
|
||||
{
|
||||
$res = array ();
|
||||
$res = array();
|
||||
foreach ($fieldsList as $key => $value) {
|
||||
if ($key === '*') {
|
||||
foreach ($resRow as $k => $v) {
|
||||
$res[$k] = $v;
|
||||
}
|
||||
} else {
|
||||
$res[$key] = array_key_exists( $value, $resRow ) ? $resRow[$value] : null;
|
||||
$res[$key] = array_key_exists($value, $resRow) ? $resRow[$value] : null;
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
@@ -336,13 +336,13 @@ class XMLConnection
|
||||
* @param object &$node
|
||||
* @return array $res
|
||||
*/
|
||||
public function fetchNode (&$node)
|
||||
public function fetchNode(&$node)
|
||||
{
|
||||
$res = array ('XMLNODE_NAME' => $node->name,'XMLNODE_TYPE' => $node->type,'XMLNODE_VALUE' => $node->value
|
||||
$res = array('XMLNODE_NAME' => $node->name,'XMLNODE_TYPE' => $node->type,'XMLNODE_VALUE' => $node->value
|
||||
);
|
||||
foreach ($node->attributes as $name => $value) {
|
||||
if ($this->caseFolding) {
|
||||
$name = strtoupper( $name );
|
||||
$name = strtoupper($name);
|
||||
}
|
||||
$res[$name] = $value;
|
||||
}
|
||||
@@ -355,11 +355,11 @@ class XMLConnection
|
||||
* @param string &$node
|
||||
* @return array $res
|
||||
*/
|
||||
public function fetchChildren (&$node)
|
||||
public function fetchChildren(&$node)
|
||||
{
|
||||
$res = array ();
|
||||
$res = array();
|
||||
foreach ($node->children as $name => $child) {
|
||||
$res[] = $this->fetchNode( $child );
|
||||
$res[] = $this->fetchNode($child);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
@@ -369,9 +369,9 @@ class XMLConnection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disconnect ()
|
||||
public function disconnect()
|
||||
{
|
||||
unset( $this->xmldoc );
|
||||
unset($this->xmldoc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -379,9 +379,9 @@ class XMLConnection
|
||||
* @param array $match
|
||||
* @return object(DB_Error) $err
|
||||
*/
|
||||
public function sqlWhereLike ($match)
|
||||
public function sqlWhereLike($match)
|
||||
{
|
||||
switch (substr( $match[2], 0, 1 )) {
|
||||
switch (substr($match[2], 0, 1)) {
|
||||
case '"':
|
||||
return ' $this->sqlLike( ' . $match[1] . ', ' . $match[2] . ' ) ';
|
||||
break;
|
||||
@@ -389,7 +389,7 @@ class XMLConnection
|
||||
return ' $this->sqlLike( ' . $match[1] . ', ' . $match[2] . ' ) ';
|
||||
break;
|
||||
default:
|
||||
$err = new DB_Error( "XMLDB: Syntax error on $match[0]" );
|
||||
$err = new DB_Error("XMLDB: Syntax error on $match[0]");
|
||||
die();
|
||||
return $err;
|
||||
}
|
||||
@@ -401,25 +401,25 @@ class XMLConnection
|
||||
* @param array $match
|
||||
* @return object(DB_Error) $err
|
||||
*/
|
||||
public function sqlString ($match)
|
||||
public function sqlString($match)
|
||||
{
|
||||
switch (substr( $match[0], 0, 1 )) {
|
||||
switch (substr($match[0], 0, 1)) {
|
||||
case '"':
|
||||
$match[0] = substr( $match[0], 1, - 1 );
|
||||
$match[0] = str_replace( '""', '"', $match[0] );
|
||||
$match[0] = str_replace( "''", "'", $match[0] );
|
||||
$match[0] = addcslashes( $match[0], '\\\'' );
|
||||
$match[0] = substr($match[0], 1, - 1);
|
||||
$match[0] = str_replace('""', '"', $match[0]);
|
||||
$match[0] = str_replace("''", "'", $match[0]);
|
||||
$match[0] = addcslashes($match[0], '\\\'');
|
||||
return "'$match[0]'";
|
||||
break;
|
||||
case "'":
|
||||
$match[0] = substr( $match[0], 1, - 1 );
|
||||
$match[0] = str_replace( "''", "'", $match[0] );
|
||||
$match[0] = str_replace( '""', '"', $match[0] );
|
||||
$match[0] = addcslashes( $match[0], '\\\'' );
|
||||
$match[0] = substr($match[0], 1, - 1);
|
||||
$match[0] = str_replace("''", "'", $match[0]);
|
||||
$match[0] = str_replace('""', '"', $match[0]);
|
||||
$match[0] = addcslashes($match[0], '\\\'');
|
||||
return "'$match[0]'";
|
||||
break;
|
||||
default:
|
||||
$err = new DB_Error( "XMLDB: Syntax error on $match[0]" );
|
||||
$err = new DB_Error("XMLDB: Syntax error on $match[0]");
|
||||
die();
|
||||
return $err;
|
||||
}
|
||||
@@ -432,9 +432,9 @@ class XMLConnection
|
||||
* @param object $values
|
||||
* @return void
|
||||
*/
|
||||
public function insertRow (&$node, $values)
|
||||
public function insertRow(&$node, $values)
|
||||
{
|
||||
$attributes = array ();
|
||||
$attributes = array();
|
||||
foreach ($values as $field => $value) {
|
||||
switch ($field) {
|
||||
case 'XMLNODE_NAME':
|
||||
@@ -442,13 +442,13 @@ class XMLConnection
|
||||
case 'XMLNODE_VALUE':
|
||||
break;
|
||||
default:
|
||||
$attributes[strtolower( $field )] = $value;
|
||||
$attributes[strtolower($field)] = $value;
|
||||
}
|
||||
}
|
||||
$values['XMLNODE_NAME'] = ! isset( $values['XMLNODE_NAME'] ) ? '' : $values['XMLNODE_NAME'];
|
||||
$values['XMLNODE_TYPE'] = ! isset( $values['XMLNODE_TYPE'] ) ? 'open' : $values['XMLNODE_TYPE'];
|
||||
$values['XMLNODE_VALUE'] = ! isset( $values['XMLNODE_VALUE'] ) ? '' : $values['XMLNODE_VALUE'];
|
||||
$node->addChildNode( new Xml_Node( $values['XMLNODE_NAME'], $values['XMLNODE_TYPE'], $values['XMLNODE_VALUE'], $attributes ) );
|
||||
$values['XMLNODE_NAME'] = ! isset($values['XMLNODE_NAME']) ? '' : $values['XMLNODE_NAME'];
|
||||
$values['XMLNODE_TYPE'] = ! isset($values['XMLNODE_TYPE']) ? 'open' : $values['XMLNODE_TYPE'];
|
||||
$values['XMLNODE_VALUE'] = ! isset($values['XMLNODE_VALUE']) ? '' : $values['XMLNODE_VALUE'];
|
||||
$node->addChildNode(new Xml_Node($values['XMLNODE_NAME'], $values['XMLNODE_TYPE'], $values['XMLNODE_VALUE'], $attributes));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -458,7 +458,7 @@ class XMLConnection
|
||||
* @param object $values
|
||||
* @return void
|
||||
*/
|
||||
public function updateRow (&$node, $values)
|
||||
public function updateRow(&$node, $values)
|
||||
{
|
||||
foreach ($values as $field => $value) {
|
||||
switch ($field) {
|
||||
@@ -472,7 +472,7 @@ class XMLConnection
|
||||
$node->value = $value;
|
||||
break;
|
||||
default:
|
||||
$node->attributes[strtolower( $field )] = $value;
|
||||
$node->attributes[strtolower($field)] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ class XmlFormFieldToolBar extends XmlFormField
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function render($value)
|
||||
public function render($value = null, $paramDummy2 = NULL)
|
||||
{
|
||||
$this->toolBar = new ToolBar($this->xmlfile, $this->home);
|
||||
$template = PATH_CORE . 'templates/' . $this->type . '.html';
|
||||
$out = $this->toolBar->render($template, $scriptCode);
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher = headPublisher::getSingleton();
|
||||
$oHeadPublisher->addScriptFile($this->toolBar->scriptURL);
|
||||
$oHeadPublisher->addScriptCode($scriptCode);
|
||||
return $out;
|
||||
|
||||
@@ -303,13 +303,12 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
|
||||
switch (true) {
|
||||
case preg_match( "/^(SELECT|EXECUTE|EXEC|SHOW|DESCRIBE|EXPLAIN|BEGIN)\s/i", $statement ):
|
||||
$rs = $con->executeQuery( $SqlStatement );
|
||||
$con->commit();
|
||||
|
||||
$result = Array ();
|
||||
$i = 1;
|
||||
while ($rs->next()) {
|
||||
$result[$i ++] = $rs->getRow();
|
||||
}
|
||||
$con->commit();
|
||||
break;
|
||||
case preg_match( "/^INSERT\s/i", $statement ):
|
||||
$rs = $con->executeUpdate( $SqlStatement );
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* class.webdav.php
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
*/
|
||||
|
||||
@@ -399,7 +401,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
*/
|
||||
public function GET(&$options)
|
||||
{
|
||||
|
||||
$filter = new InputFilter();
|
||||
$options = $filter->xssFilterHard($options);
|
||||
$paths = $filter->xssFilterHard($this->paths);
|
||||
@@ -743,13 +744,13 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
|
||||
if (is_dir($path)) {
|
||||
$query = "DELETE FROM properties WHERE path LIKE '" . $this->_slashify($options["path"]) . "%'";
|
||||
mysql_query($query);
|
||||
mysqli_query($query);
|
||||
PearSystem::rm("-rf $path");
|
||||
} else {
|
||||
unlink($path);
|
||||
}
|
||||
$query = "DELETE FROM properties WHERE path = '$options[path]'";
|
||||
mysql_query($query);
|
||||
mysqli_query($query);
|
||||
|
||||
return "204 No Content";
|
||||
}
|
||||
@@ -838,13 +839,13 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
$query = "UPDATE properties
|
||||
SET path = REPLACE(path, '" . $options["path"] . "', '" . $destpath . "')
|
||||
WHERE path LIKE '" . $this->_slashify($options["path"]) . "%'";
|
||||
mysql_query($query);
|
||||
mysqli_query($query);
|
||||
}
|
||||
|
||||
$query = "UPDATE properties
|
||||
SET path = '" . $destpath . "'
|
||||
WHERE path = '" . $options["path"] . "'";
|
||||
mysql_query($query);
|
||||
mysqli_query($query);
|
||||
} else {
|
||||
if (is_dir($source)) {
|
||||
$files = PearSystem::find($source);
|
||||
@@ -898,9 +899,9 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
if (isset($options["update"])) {
|
||||
// Lock Update
|
||||
$query = "UPDATE locks SET expires = " . (time() + 300);
|
||||
mysql_query($query);
|
||||
mysqli_query($query);
|
||||
|
||||
if (mysql_affected_rows()) {
|
||||
if (mysqli_affected_rows()) {
|
||||
$options["timeout"] = 300; // 5min hardcoded
|
||||
return true;
|
||||
} else {
|
||||
@@ -917,9 +918,9 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
, owner = '$options[owner]'
|
||||
, expires = '$options[timeout]'
|
||||
, exclusivelock = " . ($options['scope'] === "exclusive" ? "1" : "0");
|
||||
mysql_query($query);
|
||||
mysqli_query($query);
|
||||
|
||||
return mysql_affected_rows() ? "200 OK" : "409 Conflict";
|
||||
return mysqli_affected_rows() ? "200 OK" : "409 Conflict";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -933,9 +934,9 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
$query = "DELETE FROM locks
|
||||
WHERE path = '$options[path]'
|
||||
AND token = '$options[token]'";
|
||||
mysql_query($query);
|
||||
mysqli_query($query);
|
||||
|
||||
return mysql_affected_rows() ? "204 No Content" : "409 Conflict";
|
||||
return mysqli_affected_rows() ? "204 No Content" : "409 Conflict";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -946,7 +947,6 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
*/
|
||||
public function checkLock($path)
|
||||
{
|
||||
|
||||
$filter = new InputFilter();
|
||||
$path = $filter->validateInput($path, 'nosql');
|
||||
$result = false;
|
||||
@@ -955,11 +955,11 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
FROM locks
|
||||
WHERE path = '%s' ";
|
||||
$query = $filter->preventSqlInjection($query, array($path));
|
||||
$res = mysql_query($query);
|
||||
$res = mysqli_query($query);
|
||||
|
||||
if ($res) {
|
||||
$row = mysql_fetch_array($res);
|
||||
mysql_free_result($res);
|
||||
$row = mysqli_fetch_array($res);
|
||||
mysqli_free_result($res);
|
||||
|
||||
if ($row) {
|
||||
$result = array("type" => "write", "scope" => $row["exclusivelock"] ? "exclusive" : "shared", "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], "expires" => $row['expires']
|
||||
@@ -982,4 +982,3 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ use ProcessMaker\Core\System;
|
||||
*/
|
||||
class Zimbra
|
||||
{
|
||||
|
||||
public $debug = false;
|
||||
public $error;
|
||||
protected $_connected = false; // boolean to determine if the connect function has been called
|
||||
@@ -119,7 +118,6 @@ class Zimbra
|
||||
$option_string = '';
|
||||
|
||||
try {
|
||||
|
||||
$soap = '<CreateAccountRequest xmlns="urn:zimbraAccount">
|
||||
<name>' . $name . '@' . $this->_server1 . '</name>
|
||||
<password>' . $password . '</password>' . $option_string . '
|
||||
@@ -820,7 +818,6 @@ class Zimbra
|
||||
protected function message($message)
|
||||
{
|
||||
if ($this->debug) {
|
||||
|
||||
$filter = new InputFilter();
|
||||
$message = $filter->xssFilterHard($message);
|
||||
echo $message;
|
||||
@@ -843,7 +840,6 @@ class Zimbra
|
||||
*/
|
||||
protected function soapRequest($body, $header = false, $connecting = false)
|
||||
{
|
||||
|
||||
$filter = new InputFilter();
|
||||
|
||||
if (!$connecting && !$this->_connected) {
|
||||
@@ -865,7 +861,7 @@ class Zimbra
|
||||
|
||||
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $soap_message);
|
||||
|
||||
$this->_curl = $filter->xssFilterHard($this->_curl,"url");
|
||||
$this->_curl = $filter->xssFilterHard($this->_curl, "url");
|
||||
$response = curl_exec($this->_curl);
|
||||
if (!$response) {
|
||||
$this->error = 'ERROR: curl_exec - (' . curl_errno($this->_curl) . ') ' . curl_error($this->_curl);
|
||||
@@ -928,7 +924,6 @@ class Zimbra
|
||||
// this is our target
|
||||
$ret = array();
|
||||
foreach ($values as $key => $val) {
|
||||
|
||||
switch ($val['type']) {
|
||||
case 'open':
|
||||
array_push($hash_stack, $val['tag']);
|
||||
@@ -983,7 +978,7 @@ class Zimbra
|
||||
|
||||
// does the current element refer to a list
|
||||
if (sizeof($elements) > 0) {
|
||||
$array[$element][sizeof($array[$element]) - 1] = &$this->composeArray($array[$element][sizeof($array[$element]) - 1], $elements, $value);
|
||||
$array[$element][sizeof($array[$element]) - 1] = $this->composeArray($array[$element][sizeof($array[$element]) - 1], $elements, $value);
|
||||
} else {
|
||||
// if (is_array($value))
|
||||
$array[$element][sizeof($array[$element])] = $value;
|
||||
|
||||
Reference in New Issue
Block a user