Skip to content

Commit

Permalink
FIX Filter on list of events were lost after "Back to list"
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 10, 2020
1 parent 918e570 commit b9a8d82
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions htdocs/comm/action/list.php
Expand Up @@ -43,7 +43,7 @@
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
$resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid", "int") : GETPOST("resourceid", "int");
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
$status = (GETPOST("search_status", 'alpha') != '') ?GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha');
$search_status = (GETPOST("search_status", 'alpha') != '') ?GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha');
$type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
$optioncss = GETPOST('optioncss', 'alpha');
$year = GETPOST("year", 'int');
Expand All @@ -67,8 +67,8 @@
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'));
$dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'));
if ($status == '' && !isset($_GET['status']) && !isset($_POST['status'])) $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && !isset($_GET['action']) && !isset($_POST['action'])) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
if ($search_status == '' && ! GETPOSTISSET('search_status')) $search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && ! GETPOSTISSET('action')) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);

$filter = GETPOST("search_filter", 'alpha', 3) ?GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ?GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
Expand Down Expand Up @@ -100,12 +100,12 @@
if (!$sortorder)
{
$sortorder = "DESC,DESC";
if ($status == 'todo') $sortorder = "DESC,DESC";
if ($search_status == 'todo') $sortorder = "DESC,DESC";
}
if (!$sortfield)
{
$sortfield = "a.datep,a.id";
if ($status == 'todo') $sortfield = "a.datep,a.id";
if ($search_status == 'todo') $sortfield = "a.datep,a.id";
}

// Security check
Expand Down Expand Up @@ -184,7 +184,7 @@
$search_note = '';
$datestart = '';
$dateend = '';
$status = '';
$search_status = '';
$search_array_options = array();
}

Expand Down Expand Up @@ -218,7 +218,7 @@
} else $param .= "&search_actioncode=".urlencode($actioncode);
}
if ($resourceid > 0) $param .= "&search_resourceid=".urlencode($resourceid);
if ($status != '' && $status > -1) $param .= "&search_status=".urlencode($status);
if ($search_status != '' && $search_status > -1) $param .= "&search_status=".urlencode($search_status);
if ($filter) $param .= "&search_filter=".urlencode($filter);
if ($filtert) $param .= "&search_filtert=".urlencode($filtert);
if ($socid) $param .= "&search_socid=".urlencode($socid);
Expand Down Expand Up @@ -309,12 +309,12 @@
// We must filter on assignement table
if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($type) $sql .= " AND c.id = ".(int) $type;
if ($status == '0') { $sql .= " AND a.percent = 0"; }
if ($status == '-1') { $sql .= " AND a.percent = -1"; } // Not applicable
if ($status == '50') { $sql .= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
if ($status == '100') { $sql .= " AND a.percent = 100"; }
if ($status == 'done') { $sql .= " AND (a.percent = 100)"; }
if ($status == 'todo') { $sql .= " AND (a.percent >= 0 AND a.percent < 100)"; }
if ($search_status == '0') { $sql .= " AND a.percent = 0"; }
if ($search_status == '-1') { $sql .= " AND a.percent = -1"; } // Not applicable
if ($search_status == '50') { $sql .= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
if ($search_status == '100') { $sql .= " AND a.percent = 100"; }
if ($search_status == 'done') { $sql .= " AND (a.percent = 100)"; }
if ($search_status == 'todo') { $sql .= " AND (a.percent >= 0 AND a.percent < 100)"; }
if ($search_id) $sql .= natural_search("a.id", $search_id, 1);
if ($search_title) $sql .= natural_search("a.label", $search_title);
if ($search_note) $sql .= natural_search('a.note', $search_note);
Expand Down Expand Up @@ -397,7 +397,7 @@
print $nav;

dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
dol_fiche_end();

// Add link to show birthdays
Expand Down Expand Up @@ -488,8 +488,8 @@
if (!empty($arrayfields['a.tms']['checked'])) print '<td class="liste_titre"></td>';
if (!empty($arrayfields['a.percent']['checked'])) {
print '<td class="liste_titre center">';
$formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2, 'minwidth100imp maxwidth125');
print ajax_combobox('selectstatus');
$formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'minwidth100imp maxwidth125');
print ajax_combobox('selectsearch_status');
print '</td>';
}
// Action column
Expand Down

0 comments on commit b9a8d82

Please sign in to comment.