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 '';
+//Autres Options
+print "
";
+print_titre($langs->trans("OtherOptions"));
+
+print '
';
+print '';
+print '| '.$langs->trans("Parameter").' | ';
+print ''.$langs->trans("Value").' | ';
+print ' | ';
+print "
\n";
+$var=true;
+
+// cacher les commandes classer facturées des listes
+$var=! $var;
+print '';
+
+print '
';
+
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 '';
}
+// cacher les propales classer facturées des listes
+$var=! $var;
+print '';
+
print '';
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);