mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-11 18:32:32 +01:00
Merge pull request #18492 from aspangaro/15a5
NEW Task - Add From/to input on search date
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2006-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -71,12 +72,22 @@ if ($mine) {
|
||||
$search_task_user = $user->id; $mine = 0;
|
||||
}
|
||||
|
||||
$search_sday = GETPOST('search_sday', 'int');
|
||||
$search_smonth = GETPOST('search_smonth', 'int');
|
||||
$search_syear = GETPOST('search_syear', 'int');
|
||||
$search_eday = GETPOST('search_eday', 'int');
|
||||
$search_emonth = GETPOST('search_emonth', 'int');
|
||||
$search_eyear = GETPOST('search_eyear', 'int');
|
||||
$search_date_startday = GETPOST('search_date_startday', 'int');
|
||||
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
|
||||
$search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_datelimit_startday = GETPOST('search_datelimit_startday', 'int');
|
||||
$search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int');
|
||||
$search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int');
|
||||
$search_datelimit_endday = GETPOST('search_datelimit_endday', 'int');
|
||||
$search_datelimit_endmonth = GETPOST('search_datelimit_endmonth', 'int');
|
||||
$search_datelimit_endyear = GETPOST('search_datelimit_endyear', 'int');
|
||||
$search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
|
||||
$search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
|
||||
|
||||
// Initialize context for list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'tasklist';
|
||||
@@ -191,12 +202,22 @@ if (empty($reshook)) {
|
||||
$search_task_progress = "";
|
||||
$search_task_user = -1;
|
||||
$search_project_user = -1;
|
||||
$search_sday = '';
|
||||
$search_smonth = '';
|
||||
$search_syear = '';
|
||||
$search_eday = '';
|
||||
$search_emonth = '';
|
||||
$search_eyear = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_endday = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_datelimit_startday = '';
|
||||
$search_datelimit_startmonth = '';
|
||||
$search_datelimit_startyear = '';
|
||||
$search_datelimit_endday = '';
|
||||
$search_datelimit_endmonth = '';
|
||||
$search_datelimit_endyear = '';
|
||||
$search_datelimit_start = '';
|
||||
$search_datelimit_end = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
@@ -372,8 +393,18 @@ if ($search_task_progress) {
|
||||
if ($search_societe) {
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
$sql .= dolSqlDateFilter('t.dateo', $search_sday, $search_smonth, $search_syear);
|
||||
$sql .= dolSqlDateFilter('t.datee', $search_eday, $search_emonth, $search_eyear);
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND t.dateo >= '".$db->idate($search_date_start)."'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND t.dateo <= '".$db->idate($search_date_end)."'";
|
||||
}
|
||||
if ($search_datelimit_start) {
|
||||
$sql .= " AND t.datee >= '".$db->idate($search_datelimit_start)."'";
|
||||
}
|
||||
if ($search_datelimit_end) {
|
||||
$sql .= " AND t.datee <= '".$db->idate($search_datelimit_end)."'";
|
||||
}
|
||||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
@@ -454,23 +485,41 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($search_sday) {
|
||||
$param .= '&search_sday='.urlencode($search_sday);
|
||||
if ($search_date_startday) {
|
||||
$param .= '&search_date_startday='.urlencode($search_date_startday);
|
||||
}
|
||||
if ($search_smonth) {
|
||||
$param .= '&search_smonth='.urlencode($search_smonth);
|
||||
if ($search_date_startmonth) {
|
||||
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
|
||||
}
|
||||
if ($search_syear) {
|
||||
$param .= '&search_syear='.urlencode($search_syear);
|
||||
if ($search_date_startyear) {
|
||||
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
|
||||
}
|
||||
if ($search_eday) {
|
||||
$param .= '&search_eday='.urlencode($search_eday);
|
||||
if ($search_date_endday) {
|
||||
$param .= '&search_date_endday='.urlencode($search_date_endday);
|
||||
}
|
||||
if ($search_emonth) {
|
||||
$param .= '&search_emonth='.urlencode($search_emonth);
|
||||
if ($search_date_endmonth) {
|
||||
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
|
||||
}
|
||||
if ($search_eyear) {
|
||||
$param .= '&search_eyear='.urlencode($search_eyear);
|
||||
if ($search_date_endyear) {
|
||||
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
|
||||
}
|
||||
if ($search_datelimit_startday) {
|
||||
$param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday);
|
||||
}
|
||||
if ($search_datelimit_startmonth) {
|
||||
$param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth);
|
||||
}
|
||||
if ($search_datelimit_startyear) {
|
||||
$param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear);
|
||||
}
|
||||
if ($search_datelimit_endday) {
|
||||
$param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday);
|
||||
}
|
||||
if ($search_datelimit_endmonth) {
|
||||
$param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth);
|
||||
}
|
||||
if ($search_datelimit_endyear) {
|
||||
$param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear);
|
||||
}
|
||||
if ($socid) {
|
||||
$param .= '&socid='.urlencode($socid);
|
||||
@@ -646,22 +695,26 @@ if (!empty($arrayfields['t.description']['checked'])) {
|
||||
}
|
||||
// Start date
|
||||
if (!empty($arrayfields['t.dateo']['checked'])) {
|
||||
print '<td class="liste_titre center minwidth150">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_sday" value="'.$search_sday.'">';
|
||||
}
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_smonth" value="'.$search_smonth.'">';
|
||||
print $formother->selectyear($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'valignmiddle width75', 1);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// End date
|
||||
if (!empty($arrayfields['t.datee']['checked'])) {
|
||||
print '<td class="liste_titre center minwidth150">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_eday" value="'.$search_eday.'">';
|
||||
}
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_emonth" value="'.$search_emonth.'">';
|
||||
print $formother->selectyear($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'valignmiddle width75', 1);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
// TODO Add option late
|
||||
//print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert");
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
|
||||
Reference in New Issue
Block a user