diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 15f6c0b3513..8796da505cd 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -374,7 +374,7 @@ if ($resql) if ($search_year) $param.='&search_year='.urlencode($search_year); if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_refcustomer) $param.='&search_refcustomer='.urlencode($search_refcustomer); - if ($search_refprojet) $param.='&search_refprojet='.urlencode($search_refprojet); + if ($search_refprojet) $param.='&search_refprojet='.urlencode($search_refprojet); if ($search_societe) $param.='&search_societe='.urlencode($search_societe); if ($search_user > 0) $param.='&search_user='.urlencode($search_user); if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 44fb15869ff..8a4ac65c763 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -41,9 +41,9 @@ $confirm=GETPOST('confirm','alpha'); $withproject=GETPOST('withproject','int'); $project_ref=GETPOST('project_ref','alpha'); -$search_dateday=GETPOST('search_dateday'); -$search_datemonth=GETPOST('search_datemonth'); -$search_dateyear=GETPOST('search_dateyear'); +$search_day=GETPOST('search_day','int'); +$search_month=GETPOST('search_month','int'); +$search_year=GETPOST('search_year','int'); $search_datehour=''; $search_datewithhour=''; $search_note=GETPOST('search_note','alpha'); @@ -98,7 +98,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { - $search_date=''; + $search_day=''; + $search_month=''; + $search_year=''; + $search_date=''; $search_datehour=''; $search_datewithhour=''; $search_note=''; @@ -643,6 +646,20 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($search_task_ref) $sql .= natural_search('pt.ref', $search_task_ref); if ($search_task_label) $sql .= natural_search('pt.label', $search_task_label); if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user); + if ($search_month > 0) + { + if ($search_year > 0 && empty($search_day)) + $sql.= " AND t.task_datehour BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; + else if ($search_year > 0 && ! empty($search_day)) + $sql.= " AND t.task_datehour BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; + else + $sql.= " AND date_format(t.task_datehour, '%m') = '".$db->escape($search_month)."'"; + } + else if ($search_year > 0) + { + $sql.= " AND t.task_datehour BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; + } + $sql .= $db->order($sortfield, $sortorder); $var=true; @@ -738,14 +755,21 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Fields title search print '