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

View File

@@ -84,6 +84,8 @@ try {
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
$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());
}
}

View File

@@ -44,6 +44,8 @@ if ($aux['extension'] != 'dat') {
foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
$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());
}
}