diff --git a/ChangeLog b/ChangeLog
index 31009cbc032..1061c220394 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,7 @@ For users:
- New: More options to create a credit note (can be filled autatically according to remain to pay).
- New: Can define custom fields for categories.
- New: Prepare generation of SEPA files into module withdrawal.
+- New: Can filter on status for supplier order.
- Fix: Project Task numbering customs rule works.
- Fix: Add actions events not implemented.
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index c84111fc951..5fbb69dbd34 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -308,7 +308,7 @@ if ($result)
print ' ';
print '';
print '
';
- $formpropal->select_propal_statut($viewstatut,1);
+ $formpropal->selectProposalStatus($viewstatut,1);
print ' ';
print ' ';
print ' ';
diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php
index 2ca485268ce..8a85d0654e6 100644
--- a/htdocs/core/class/html.formorder.class.php
+++ b/htdocs/core/class/html.formorder.class.php
@@ -45,6 +45,29 @@ class FormOrder
}
+
+ /**
+ * Return combo list of differents status of a orders
+ *
+ * @param string $selected Preselected value
+ * @param int $short Use short labels
+ * @return void
+ */
+ function selectSupplierOrderStatus($selected='', $short=0, $hmlname='order_status')
+ {
+ print '';
+ print ' ';
+ $statustohow=array(0,1,2,3,4,5,6,9); // 7 is same label than 6. 8 does not exist.
+
+ foreach($statustohow as $key)
+ {
+ print '';
+ print CommandeFournisseur::LibStatut($key,$short);
+ print ' ';
+ }
+ print ' ';
+ }
+
/**
* Return list of way to order
*
diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php
index 099ba33c9a6..101feda9e5d 100644
--- a/htdocs/core/class/html.formpropal.class.php
+++ b/htdocs/core/class/html.formpropal.class.php
@@ -49,14 +49,14 @@ class FormPropal
* @param int $short Use short labels
* @return void
*/
- function select_propal_statut($selected='',$short=0)
+ function selectProposalStatus($selected='',$short=0)
{
global $langs;
$sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
$sql .= " WHERE active = 1";
- dol_syslog(get_class($this)."::select_propal_statut sql=".$sql);
+ dol_syslog(get_class($this)."::selectProposalStatus sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index f150ec6a31b..7e8f065690d 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -99,8 +99,8 @@ class CommandeFournisseur extends CommonOrder
$this->statuts[3] = 'StatusOrderOnProcess';
$this->statuts[4] = 'StatusOrderReceivedPartially';
$this->statuts[5] = 'StatusOrderReceivedAll';
- $this->statuts[6] = 'StatusOrderCanceled';
- $this->statuts[7] = 'StatusOrderCanceled';
+ $this->statuts[6] = 'StatusOrderCanceled'; // Approved->Canceled
+ $this->statuts[7] = 'StatusOrderCanceled'; // Process running->canceled
$this->statuts[9] = 'StatusOrderRefused';
}
diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php
index 9e5cf3dc2d3..70bd5eb2d2b 100644
--- a/htdocs/fourn/commande/liste.php
+++ b/htdocs/fourn/commande/liste.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2004-2014 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2013 Cédric Salvador
*
@@ -29,6 +29,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
$langs->load("orders");
@@ -39,6 +40,8 @@ $search_nom=GETPOST('search_nom');
$search_user=GETPOST('search_user');
$search_ttc=GETPOST('search_ttc');
$sall=GETPOST('search_all');
+$search_status=GETPOST('search_status','int');
+if ($search_status == '') $search_status=-1;
$page = GETPOST('page','int');
$socid = GETPOST('socid','int');
@@ -67,6 +70,7 @@ llxHeader('',$title);
$commandestatic=new CommandeFournisseur($db);
$formfile = new FormFile($db);
+$formorder = new FormOrder($db);
if ($sortorder == "") $sortorder="DESC";
@@ -119,8 +123,13 @@ if ($search_refsupp)
{
$sql.= " AND (cf.ref_supplier LIKE '%".$db->escape($search_refsupp)."%')";
}
+if ($search_status >= 0)
+{
+ if ($search_status == 6 || $search_status == 7) $sql.=" AND fk_statut IN (6,7)";
+ else $sql.=" AND fk_statut = ".$search_status;
+}
-$sql.= " ORDER BY $sortfield $sortorder ";
+$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
$resql = $db->query($sql);
@@ -136,6 +145,7 @@ if ($resql)
if ($search_user) $param.="&search_user=".$search_user;
if ($search_ttc) $param.="&search_ttc=".$search_ttc;
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
+ if ($search_status >= 0) $param.="&search_status=".$search_status;
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
print '