Search diagnosis - Add filter of session status and order by start day - refs BT#19395

pull/4099/head
Christian 4 years ago
parent b173f45b2e
commit 8f56014e8d
  1. 20
      load_search.php
  2. 14
      main/inc/ajax/model.ajax.php

@ -556,6 +556,22 @@ $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseEight]');
$userForm->addHtml('</div></div></div>');
$form->addButtonSave(get_lang('SaveDiagnosticChanges'), 'save');
// Get list of session status
if (api_get_configuration_value('allow_session_status')) {
$statusList = SessionManager::getStatusList();
$statusSelectList[0] = ' -- '.get_lang('All').' --';
foreach ($statusList as $nro => $name) {
$statusSelectList[$nro] = $name;
}
$form->addSelect(
'filter_status',
get_lang('SessionStatus'),
$statusSelectList,
['id' => 'filter_status']
);
}
$form->addButtonSearch(get_lang('SearchSessions'), 'search');
$extraFieldsToFilter = $extraField->get_all(['variable = ?' => 'temps_de_travail']);
@ -701,6 +717,10 @@ if ($form->validate()) {
}
}
}
if (!empty($_REQUEST['filter_status'])) {
$filterToSend['filter_status'] = (int) $_REQUEST['filter_status'];
}
}
if ($save) {

@ -785,8 +785,13 @@ switch ($action) {
}
}
if ($list_type === 'custom') {
$whereCondition .= ' AND (s.status IN ("'.SessionManager::STATUS_PLANNED.'", "'.SessionManager::STATUS_PROGRESS.'") ) ';
if (api_get_configuration_value('allow_session_status') && isset($filters->filter_status)) {
$sStatus = (int) $filters->filter_status;
$whereCondition .= ' AND s.status = '.$sStatus;
} else {
if ($list_type === 'custom') {
$whereCondition .= ' AND (s.status IN ("'.SessionManager::STATUS_PLANNED.'", "'.SessionManager::STATUS_PROGRESS.'") ) ';
}
}
if ($list_type === 'simple' || $list_type === 'custom') {
@ -1846,12 +1851,13 @@ switch ($action) {
$columns = $session_columns['simple_column_name'];
$sidx = in_array($sidx, $columns) ? $sidx : 'name';
$orderBy = 'display_start_date DESC';
if ($list_type === 'simple' || $list_type === 'custom') {
$result = SessionManager::get_sessions_admin(
[
'where' => $whereCondition,
'order' => "$sidx $sord, s.name",
'order' => $orderBy,
'extra' => $extra_fields,
'limit' => "$start , $limit",
],
@ -1866,7 +1872,7 @@ switch ($action) {
$result = SessionManager::get_sessions_admin_complete(
[
'where' => $whereCondition,
'order' => "$sidx $sord, s.name",
'order' => $orderBy,
'extra' => $extra_fields,
'limit' => "$start , $limit",
]

Loading…
Cancel
Save