From 3842c50b48a1ea0002f2149d5ae2615b6bb8635d Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Wed, 2 Aug 2006 10:03:03 +0000
Subject: [PATCH] =?UTF-8?q?Ajout:=20ajout=20d'une=20option=20dans=20le=20m?=
 =?UTF-8?q?odule=20propal=20et=20commande=20qui=20permet=20de=20cacher=20l?=
 =?UTF-8?q?es=20propales=20et=20commandes=20sign=E9s=20et/ou=20factur=E9es?=
 =?UTF-8?q?=20afin=20d'y=20voir=20plus=20clair=20dans=20les=20listes.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/admin/commande.php | 32 ++++++++++++++++++++++++++++++++
 htdocs/admin/propale.php  | 20 ++++++++++++++++++++
 htdocs/comm/propal.php    |  5 +++++
 htdocs/commande/liste.php |  5 +++++
 4 files changed, 62 insertions(+)

diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index 5444907fb3c..f12d5a1a77d 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -127,6 +127,11 @@ if ($_GET["action"] == 'setmod')
 	dolibarr_set_const($db, "COMMANDE_ADDON",$_GET["value"]);
 }
 
+if ($_POST["action"] == 'sethidetreated')
+{
+    dolibarr_set_const($db, "COMMANDE_HIDE_TREATED",$_POST["hidetreated"]);
+}
+
 
 
 /*
@@ -324,5 +329,32 @@ closedir($handle);
 
 print '</table>';
 
+//Autres Options
+print "<br>";
+print_titre($langs->trans("OtherOptions"));
+
+print '<table class="noborder" width="100%">';
+print '<tr class="liste_titre">';
+print '<td>'.$langs->trans("Parameter").'</td>';
+print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
+print '<td width="80">&nbsp;</td>';
+print "</tr>\n";
+$var=true;
+
+// cacher les commandes classer factur�es des listes
+$var=! $var;
+print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
+print '<input type="hidden" name="action" value="sethidetreated">';
+print '<tr '.$bc[$var].'><td>';
+print $langs->trans("HideTreadedOrders");
+print '</td><td width="60" align="center">';
+print $html->selectyesno("hidetreated",$conf->global->COMMANDE_HIDE_TREATED,1);
+print '</td><td align="right">';
+print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
+print "</td></tr>\n";
+print '</form>';
+
+print '</table>';
+
 llxFooter('$Date$ - $Revision$');
 ?>
diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php
index 6881c1a03b5..a4f57bae890 100644
--- a/htdocs/admin/propale.php
+++ b/htdocs/admin/propale.php
@@ -92,6 +92,13 @@ if ($_POST["action"] == 'setclassifiedinvoiced')
     exit;
 }
 
+if ($_POST["action"] == 'sethidetreated')
+{
+    dolibarr_set_const($db, "PROPALE_HIDE_TREATED",$_POST["hidetreated"]);
+    Header("Location: propale.php");
+    exit;
+}
+
 if ($_GET["action"] == 'set')
 {
 	$type='propal';
@@ -395,6 +402,19 @@ if ($conf->commande->enabled)
 	print '</form>';
 }
 
+// cacher les propales classer factur�es des listes
+$var=! $var;
+print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
+print '<input type="hidden" name="action" value="sethidetreated">';
+print '<tr '.$bc[$var].'><td>';
+print $langs->trans("HideTreadedPropal");
+print '</td><td align="left">';
+print $html->selectyesno("hidetreated",$conf->global->PROPALE_HIDE_TREATED,1);
+print '</td><td align="right">';
+print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
+print "</td></tr>\n";
+print '</form>';
+
 print '</table>';
 
 
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 3cee83c00ee..b552d85d1fe 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -1729,6 +1729,11 @@ else
     {
       $sql .= " AND p.ref like '%".addslashes($_POST["sf_ref"]) . "%'";
     }
+  // on ne liste pas les propales classer ayant le statut sign�, factur�, non sign�
+  if ($conf->global->PROPALE_HIDE_TREATED && (!$sall && empty($_GET['search_ref']) && empty($_GET['search_societe']) && empty($_GET['search_montant_ht'])))
+  {
+	  $sql .= ' AND p.fk_statut < 2';
+  }
   $sql .= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC';
   $sql .= $db->plimit($limit + 1,$offset);
   $result=$db->query($sql);
diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php
index 71b8f233c7f..3529c1ab54f 100644
--- a/htdocs/commande/liste.php
+++ b/htdocs/commande/liste.php
@@ -116,6 +116,11 @@ if (!empty($sref_client))
 {
 	$sql .= ' AND c.ref_client like \'%'.addslashes($sref_client).'%\'';
 }
+// on ne liste pas les commandes classer factur�es, elles apparaissent tout de m�me avec la recherche
+if ($conf->global->COMMANDE_HIDE_TREATED && (!$sref && !$sref_client && !$snom && !$sall && (!strlen($_POST['sf_ref']) > 0)))
+{
+	$sql .= ' AND c.facture = 0';
+}
 
 $sql .= ' ORDER BY '.$sortfield.' '.$sortorder;
 $sql .= $db->plimit($limit + 1,$offset);
-- 
GitLab