diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 30861f5c985..f42c77176dc 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -330,15 +330,15 @@ if ($viewstatut != '' && $viewstatut != '-1') $sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; } -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "p.datep", $search_day, $search_month, $search_year ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery ); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4b9b769855c..d59618e7541 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -304,12 +304,12 @@ if ($viewstatut <> '') } } -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear ); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index b04fd1388b6..74d30692c3f 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -107,7 +107,7 @@ if ($search_company) } // if ($search_amount) $sql.=" AND d.km='".$db->escape(price2num(trim($search_amount)))."'"; -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "d.dated", $day, $month, $year ); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8b8b018e6ee..f141f065e4d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -452,11 +452,11 @@ if ($search_status != '-1' && $search_status != '') } if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "f.datef", $search_day, $search_month, $search_year ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim ); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index bcf99538498..460393e8bc4 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -164,7 +164,7 @@ else else $sql.= " AND f.fk_user_author = ".$userid; } // Search criteria - $sql.= dol_sql_datefilter("p.datep", $day, $month, $year); + $sql.= dolSqlDateFilter("p.datep", $day, $month, $year); if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 48961a0c6d5..d6d1e0c741c 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -151,7 +151,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) * @return int Time into seconds * @see convertSecondToTime */ -function convertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0) +function convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0) { $iResult=($iHours*3600)+($iMinutes*60)+$iSeconds; return $iResult; @@ -276,16 +276,16 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt /** - * générate standard filter date + * Generate a SQL string to make a filter into a range (for second of date until last second of date) * - * @param string $datefield fields where apply sql date filter - * @param int $day_date day date - * @param int $month_date month date - * @param int $year_date year date - * @return string $sqldate sql part of date + * @param string $datefield Name of SQL field where apply sql date filter + * @param int $day_date Day date + * @param int $month_date Month date + * @param int $year_date Year date + * @return string $sqldate String with SQL filter */ - -function dolSqlDatefilter($datefield, $day_date, $month_date, $year_date) { +function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date) +{ global $db; $sqldate=""; if ($month_date > 0) { diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 13c5878b6b8..38e050b1673 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -276,13 +276,13 @@ if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall); // Ref if (!empty($search_ref)) $sql.= natural_search('d.ref', $search_ref); // Date Start -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "d.date_debut", $day_start, $month_start, $year_start ); // Date End -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "d.date_fin", $day_end, $month_end, $year_end ); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4a263381c81..bd1430f2d40 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -528,11 +528,11 @@ if (GETPOST('statut', 'intcomma') !== '') if ($search_status != '' && $search_status >= 0) $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")"; -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cf.date_commande", $search_orderday, $search_ordermonth, $search_orderyear ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cf.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear ); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 7896cfa9eec..a05b93bb7da 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -331,8 +331,8 @@ if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_mont if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; -$sql.= dol_sql_datefilter( "f.datef", $day, $month, $year); -$sql.= dol_sql_datefilter( "f.date_lim_reglement", $day_lim, $month_lim, $year_lim); +$sql.= dolSqlDateFilter( "f.datef", $day, $month, $year); +$sql.= dolSqlDateFilter( "f.date_lim_reglement", $day_lim, $month_lim, $year_lim); if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'"; if ($search_label) $sql .= natural_search('f.libelle', $search_label); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index c88dd1f4776..f638a7e5015 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -191,19 +191,19 @@ if(!empty($search_ref)) } // Start date -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cp.date_debut", $search_day_start, $search_month_start, $search_year_start ); // End date -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cp.date_fin", $search_day_end, $search_month_end, $search_year_end ); // Create date -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cp.date_create", $search_day_create, $search_month_create, $search_year_create ); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index ed841c653b1..1eee5ebf60e 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -290,8 +290,8 @@ if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($search_status >= 0 && $search_status != '') $sql.= ' AND sp.fk_statut IN ('.$db->escape($search_status).')'; -$sql.= dol_sql_datefilter("sp.date_livraison", $day, $month, $year); -$sql.= dol_sql_datefilter("sp.date_valid", $dayvalid, $monthvalid, $yearvalid); +$sql.= dolSqlDateFilter("sp.date_livraison", $day, $month, $year); +$sql.= dolSqlDateFilter("sp.date_valid", $dayvalid, $monthvalid, $yearvalid); if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0)