diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index ffc01a998d5..78b786d2366 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -400,7 +400,7 @@ if ($id > 0)
// display amount and link to unpaid bill
$outstandigBills = $object->get_OutstandingBill();
if ($outstandigBills != 0)
- print " / ".price($outstandigBills).' ';
+ print " (".$langs->trans("CurrentOutstandingBill")." ".price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency).' )';
print '';
print '';
}
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index a3ef72bb6ca..da6e56c9460 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -182,9 +182,9 @@ if ($search_author)
{
$sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
}
-if ($search_montant_ht)
+if ($search_montant_ht != '')
{
- $sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
+ $sql.= natural_search("p.total_ht", $search_montant_ht, 1);
}
if ($sall) {
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
@@ -316,12 +316,12 @@ if ($result)
print '';
print '
';
// Amount
- print '';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
// Author
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
$formpropal->selectProposalStatus($viewstatut,1);
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 9d143d87eb2..c38b1a8e34f 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -51,6 +51,7 @@ $sall=GETPOST('sall');
$socid=GETPOST('socid','int');
$search_user=GETPOST('search_user','int');
$search_sale=GETPOST('search_sale','int');
+$search_total_ht=GETPOST('search_total_ht','alpha');
// Security check
$id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
@@ -79,6 +80,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_ref='';
$search_ref_customer='';
$search_company='';
+ $search_total_ht='';
$orderyear='';
$ordermonth='';
$deliverymonth='';
@@ -96,6 +98,7 @@ $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
/*
* View
*/
@@ -198,7 +201,10 @@ if ($search_user > 0)
{
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
}
-
+if ($search_total_ht != '')
+{
+ $sql.= natural_search('c.total_ht', $search_total_ht, 1);
+}
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
$nbtotalofrecords = 0;
@@ -252,7 +258,8 @@ if ($resql)
if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer;
if ($search_user > 0) $param.='&search_user='.$search_user;
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
-
+ if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
+
$num = $db->num_rows($resql);
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$i = 0;
@@ -316,7 +323,9 @@ if ($resql)
print ' ';
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
print ' ';
- print ' ';
+ print '';
+ print ' ';
+ print ' ';
print ' ';
print ' ';
print " \n";
@@ -328,7 +337,8 @@ if ($resql)
$generic_commande = new Commande($db);
$generic_product = new Product($db);
- while ($i < min($num,$limit)) {
+ while ($i < min($num,$limit))
+ {
$objp = $db->fetch_object($resql);
$var=!$var;
print '';
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 4cb696836bd..d38519bf6d5 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1962,11 +1962,11 @@ if ($action == 'create')
// Outstanding Bill
$outstandigBills = $soc->get_OutstandingBill();
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
- print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency);
+ print price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency);
if ($soc->outstanding_limit != '')
{
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
- print ' / ' . price($soc->outstanding_limit);
+ print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
}
print ')';
print '';
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 56bd57c725a..dc081424ace 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -187,13 +187,13 @@ if ($search_societe)
{
$sql .= natural_search('s.nom', $search_societe);
}
-if ($search_montant_ht)
+if ($search_montant_ht != '')
{
- $sql.= ' AND f.total = \''.$db->escape(price2num(trim($search_montant_ht))).'\'';
+ $sql.= natural_search('f.total', $search_montant_ht, 1);
}
-if ($search_montant_ttc)
+if ($search_montant_ttc != '')
{
- $sql.= ' AND f.total_ttc = \''.$db->escape(price2num(trim($search_montant_ttc))).'\'';
+ $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
}
if ($search_status != '')
{
@@ -263,8 +263,8 @@ if ($resql)
if ($search_societe) $param.='&search_societe=' .$search_societe;
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
if ($search_user > 0) $param.='&search_user=' .$search_user;
- if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
- if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc;
+ if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
+ if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$i = 0;
@@ -323,9 +323,9 @@ if ($resql)
print '';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
print ' ';
print ' ';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index c5d8d509b08..509f237b0d6 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -4961,7 +4961,7 @@ function natural_search($fields, $value, $numeric=0)
if ($numeric)
{
- $value=preg_replace('/([<>=]+)\s([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
+ $value=preg_replace('/([<>=]+)\s([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
}
$crits = explode(' ', $value);
$res = '';
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 613eb463366..6926997f0f1 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -100,7 +100,7 @@ $offset = $conf->liste_limit * $page ;
/*
- * Mode Liste
+ * Mode list
*/
$sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,";
@@ -130,13 +130,13 @@ if ($search_user)
{
$sql.= " AND u.login LIKE '%".$db->escape($search_user)."%'";
}
-if ($search_ht)
+if ($search_ht != '')
{
- $sql .= " AND cf.total_ht = '".$db->escape(price2num($search_ht))."'";
+ $sql .= natural_search("cf.total_ht",$search_ht, 1);
}
-if ($search_ttc)
+if ($search_ttc != '')
{
- $sql .= " AND cf.total_ttc = '".$db->escape(price2num($search_ttc))."'";
+ $sql .= natural_search("cf.total_ttc", $search_ttc, 1);
}
if ($sall)
{
@@ -214,8 +214,8 @@ if ($resql)
print ' ';
}
print ' ';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
print ' ';
print '';
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index d59870d8fc5..66ad20e4c05 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -153,7 +153,7 @@ if ($search_ref)
if (is_numeric($search_ref)) $sql .= natural_search(array('fac.ref'), $search_ref);
else $sql .= natural_search('fac.ref', $search_ref);
}
-if (search_ref_supplier)
+if ($search_ref_supplier)
{
$sql .= natural_search('fac.ref_supplier', $search_ref_supplier);
}
@@ -178,14 +178,14 @@ if ($search_company)
$sql .= natural_search('s.nom', $search_company);
}
-if ($search_amount_no_tax)
+if ($search_amount_no_tax != '')
{
- $sql .= " AND fac.total_ht = '".$db->escape(price2num($search_amount_no_tax))."'";
+ $sql .= natural_search('fac.total_ht', $search_amount_no_tax, 1);
}
-if ($search_amount_all_tax)
+if ($search_amount_all_tax != '')
{
- $sql .= " AND fac.total_ttc = '".$db->escape(price2num($search_amount_all_tax))."'";
+ $sql .= natural_search('fac.total_ttc', $search_amount_all_tax, 1);
}
$nbtotalofrecords = 0;
@@ -270,9 +270,9 @@ if ($resql)
print ' ';
}
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print ' ';
$liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid"));
print $form->selectarray('filtre', $liststatus, $filter, 1);