Merged in bugfix/HOR-4676 (pull request #6526)

HOR-4676

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2018-06-15 20:33:57 +00:00
committed by Julio Cesar Laura Avendaño
3 changed files with 31 additions and 28 deletions

View File

@@ -154,7 +154,7 @@ class Applications
$sqlSearch .= " LIMIT " . $limit; $sqlSearch .= " LIMIT " . $limit;
} }
$dataset = $stmt->executeQuery($sqlSearch); $dataset = $stmt->executeQuery($sqlSearch);
$appNumbers = array(-1); $appNumbers = [-1];
while ($dataset->next()) { while ($dataset->next()) {
$newRow = $dataset->getRow(); $newRow = $dataset->getRow();
array_push($appNumbers, $newRow['APP_NUMBER']); array_push($appNumbers, $newRow['APP_NUMBER']);
@@ -177,23 +177,21 @@ class Applications
} }
//Add the additional filters //Add the additional filters
if (!empty($sort) && empty($search)) { //Sorts the records in descending order by default
if (!empty($sort)) {
switch ($sort) { switch ($sort) {
case 'APP_NUMBER': case 'APP_NUMBER':
//The order by APP_DELEGATION.APP_NUMBER is must be fast than APPLICATION.APP_NUMBER //The order by APP_DELEGATION.APP_NUMBER is must be fast than APPLICATION.APP_NUMBER
$sort = 'APP_DELEGATION.APP_NUMBER'; $orderBy = 'APP_DELEGATION.APP_NUMBER ' . $dir;
break; break;
case 'APP_CURRENT_USER': case 'APP_CURRENT_USER':
//The column APP_CURRENT_USER is result of concat those fields //The column APP_CURRENT_USER is result of concat those fields
$sort = 'USR_LASTNAME, USR_FIRSTNAME'; $orderBy = 'USR_LASTNAME ' . $dir . ' ,USR_FIRSTNAME ' . $dir;
break; break;
default:
$orderBy = $sort ." ". $dir;
} }
$sqlData .= " ORDER BY " . $sort; $sqlData .= " ORDER BY " . $orderBy;
}
//Sorts the records in descending order by default
if (!empty($dir) && empty($search)) {
$sqlData .= " " . $dir;
} }
//Define the number of records by return //Define the number of records by return
@@ -205,31 +203,32 @@ class Applications
} else { } else {
$sqlData .= " LIMIT " . $limit; $sqlData .= " LIMIT " . $limit;
} }
$oDataset = $stmt->executeQuery($sqlData); $dataset = $stmt->executeQuery($sqlData);
$result = []; $result = [];
//By performance enable always the pagination //By performance enable always the pagination
$result['totalCount'] = intval($start) + intval($limit) + 1; $result['totalCount'] = $start + $limit + 1;
$rows = []; $rows = [];
$aPriorities = array('1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH'); $priorities = ['1' => 'VL','2' => 'L','3' => 'N','4' => 'H','5' => 'VH'];
while ($oDataset->next()) { while ($dataset->next()) {
$aRow = $oDataset->getRow(); $row = $dataset->getRow();
if (isset($aRow['APP_STATUS'])) { if (isset( $row['APP_STATUS'] )) {
$aRow['APP_STATUS_LABEL'] = G::LoadTranslation("ID_{$aRow['APP_STATUS']}"); $row['APP_STATUS_LABEL'] = G::LoadTranslation( "ID_{$row['APP_STATUS']}" );
} }
if (isset($aRow['DEL_PRIORITY'])) { if (isset( $row['DEL_PRIORITY'] )) {
$aRow['DEL_PRIORITY'] = G::LoadTranslation("ID_PRIORITY_{$aPriorities[$aRow['DEL_PRIORITY']]}"); $row['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$priorities[$row['DEL_PRIORITY']]}" );
} }
$aRow["APP_CURRENT_USER"] = $aRow["USR_LASTNAME"].' '.$aRow["USR_FIRSTNAME"]; $row["APP_CURRENT_USER"] = $row["USR_LASTNAME"].' '.$row["USR_FIRSTNAME"];
$aRow["APPDELCR_APP_TAS_TITLE"] = ''; $row["APPDELCR_APP_TAS_TITLE"] = '';
$aRow["USRCR_USR_UID"] = $aRow["USR_UID"]; $row["USRCR_USR_UID"] = $row["USR_UID"];
$aRow["USRCR_USR_FIRSTNAME"] = $aRow["USR_FIRSTNAME"]; $row["USRCR_USR_FIRSTNAME"] = $row["USR_FIRSTNAME"];
$aRow["USRCR_USR_LASTNAME"] = $aRow["USR_LASTNAME"]; $row["USRCR_USR_LASTNAME"] = $row["USR_LASTNAME"];
$aRow["USRCR_USR_USERNAME"] = $aRow["USR_USERNAME"]; $row["USRCR_USR_USERNAME"] = $row["USR_USERNAME"];
$aRow["APP_OVERDUE_PERCENTAGE"] = ''; $row["APP_OVERDUE_PERCENTAGE"] = '';
$rows[] = $aRow; $rows[] = $row;
} }
$result['data'] = $rows; $result['data'] = $rows;
return $result; return $result;
} }

View File

@@ -84,6 +84,8 @@ try {
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) { foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) { if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
$pluginRegistry->disablePlugin($plugin->getNamespace()); $pluginRegistry->disablePlugin($plugin->getNamespace());
// In order to keep the custom plugins state, it is required to set the attribute before saving the info
$plugin->setEnabled(true);
$pluginRegistry->savePlugin($plugin->getNamespace()); $pluginRegistry->savePlugin($plugin->getNamespace());
} }
} }

View File

@@ -44,6 +44,8 @@ if ($aux['extension'] != 'dat') {
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) { foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) { if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
$pluginRegistry->disablePlugin($plugin->getNamespace()); $pluginRegistry->disablePlugin($plugin->getNamespace());
// In order to keep the custom plugins state, it is required to set the attribute before saving the info
$plugin->setEnabled(true);
$pluginRegistry->savePlugin($plugin->getNamespace()); $pluginRegistry->savePlugin($plugin->getNamespace());
} }
} }