diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index dc212fe38db..9eeb3d40b88 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -52,6 +52,10 @@ $action=GETPOST('action');
$confirm=GETPOST('confirm');
$lineid=GETPOST('lineid');
+$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
+$search_societe=GETPOST('search_societe','alpha');
+$search_montant_ht=GETPOST('search_montant_ht','alpha');
+
$sall=GETPOST("sall");
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
$year=GETPOST("year");
@@ -1744,23 +1748,23 @@ else
{
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
- if (GETPOST('search_ref'))
+ if ($search_ref)
{
- $sql.= " AND p.ref LIKE '%".$db->escape(GETPOST('search_ref'))."%'";
+ $sql.= " AND p.ref LIKE '%".$db->escape(trim($search_ref))."%'";
}
- if (!empty($_GET['search_societe']))
+ if ($search_societe)
{
- $sql.= " AND s.nom LIKE '%".$db->escape(GETPOST('search_societe'))."%'";
+ $sql.= " AND s.nom LIKE '%".$db->escape(trim($search_societe))."%'";
}
- if (!empty($_GET['search_montant_ht']))
+ if ($search_montant_ht)
{
- $sql.= " AND p.total_ht='".$db->escape(GETPOST('search_montant_ht'))."'";
+ $sql.= " AND p.total_ht='".$db->escape(trim($search_montant_ht))."'";
}
- if ($sall) $sql.= " AND (s.nom like '%".$db->escape($sall)."%' OR p.note like '%".$db->escape($sall)."%' OR pd.description like '%".$db->escape($sall)."%')";
+ if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%' OR pd.description LIKE '%".$db->escape($sall)."%')";
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if ($viewstatut <> '')
{
- $sql.= ' AND p.fk_statut in ('.$viewstatut.')';
+ $sql.= ' AND p.fk_statut IN ('.$viewstatut.')';
}
if ($month > 0)
{
@@ -1773,10 +1777,6 @@ else
{
$sql.= " AND date_format(p.datep, '%Y') = '".$year."'";
}
- if (dol_strlen($_POST['sf_ref']) > 0)
- {
- $sql.= " AND p.ref like '%".$db->escape($_POST["sf_ref"]) . "%'";
- }
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC';
$sql.= $db->plimit($limit + 1,$offset);
@@ -1817,10 +1817,10 @@ else
print '