diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 1c0ae369be6..ba96725ddbd 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -194,6 +194,8 @@ if (empty($reshook)) {
// Remove a product line
$result = $object->deleteline($user, $lineid);
if ($result > 0) {
+ // reorder lines
+ $object->line_order(true);
// Define output language
$outputlangs = $langs;
$newlang = '';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 2f7efbf11ba..9df6688a4e5 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -247,6 +247,8 @@ if (empty($reshook)) {
$result = $object->deleteline(GETPOST('lineid', 'int'));
if ($result > 0) {
+ // reorder lines
+ $object->line_order(true);
// Define output language
$outputlangs = $langs;
$newlang = '';
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 3d2b995233a..743930767dd 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1193,6 +1193,10 @@ if ($action == 'create') {
print '';
print '';
} else {
+ if (! empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
+ print '';
+ }
+
print $langs->trans("NA");
}
print '';
@@ -1372,6 +1376,10 @@ if ($action == 'create') {
print '';
print '';
} else {
+ if (! empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
+ print '';
+ }
+
print $langs->trans("NA");
}
print '';
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index cdeeeff9d17..5f06b2f5559 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -830,6 +830,8 @@ if (empty($reshook)) {
$result = $object->deleteline($lineid);
if ($result > 0) {
+ // reorder lines
+ $object->line_order(true);
// Define output language
$outputlangs = $langs;
$newlang = '';
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 5d16f779090..eb13ead4fbd 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -599,7 +599,7 @@ $help_url = '';
// llxHeader('',$title,$help_url);
$sql = 'SELECT';
-if ($sall || $search_product_category > 0 || $search_user > 0) {
+if ($sall || $search_product_category > 0) {
$sql = 'SELECT DISTINCT';
}
$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.email,';
@@ -641,10 +641,6 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cf.fk_projet";
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
-if ($search_user > 0) {
- $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
- $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
-}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
@@ -708,7 +704,13 @@ if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
}
if ($search_user > 0) {
- $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='supplier_order' AND tc.source='internal' AND ec.element_id = cf.rowid AND ec.fk_socpeople = ".((int) $search_user);
+ $sql .= " AND EXISTS (";
+ $sql .= " SELECT ec.rowid ";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "element_contact as ec";
+ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON tc.rowid = ec.fk_c_type_contact";
+ $sql .= " WHERE ec.element_id = cf.rowid AND ec.fk_socpeople = " . ((int) $search_user);
+ $sql .= " AND tc.element = 'order_supplier' AND tc.source = 'internal'";
+ $sql .= ")";
}
if ($search_total_ht != '') {
$sql .= natural_search('cf.total_ht', $search_total_ht, 1);
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 9efb21c4594..37ef9c813a2 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -250,6 +250,8 @@ if (empty($reshook)) {
// Remove a product line
$result = $object->deleteline($lineid);
if ($result > 0) {
+ // reorder lines
+ $object->line_order(true);
// Define output language
/*$outputlangs = $langs;
$newlang = '';