diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 83db0e0f1d2..bc7ea0cd67d 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -181,7 +181,7 @@ if (empty($reshook))
if ($action == 'setorder_min_amount')
{
$object->fetch($id);
- $object->order_min_amount=GETPOST('order_min_amount');
+ $object->order_min_amount=price2num(GETPOST('order_min_amount','alpha'));
$result=$object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
@@ -423,15 +423,21 @@ if ($object->id > 0)
print '';
print '';
+ }
- print '
';
- print '| ';
- print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer);
- print ' | ';
- print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
-
- print ' | ';
- print '
';
+ if ($object->client)
+ {
+ if (! empty($conf->commande->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
+ {
+ print ''."\n";
+ print '';
+ print '| ';
+ print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer);
+ print ' | ';
+ print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
+ print ' | ';
+ print '
';
+ }
}
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index c10591b4e45..fff45f59bf5 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2387,7 +2387,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Total HT
$alert = '';
- if($object->total_ht < $object->thirdparty->order_min_amount) {
+ if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->order_min_amount) {
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
}
print '| ' . $langs->trans('AmountHT') . ' | ';
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 906dbda4f6e..b295355bdc9 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -109,7 +109,7 @@ if (empty($reshook))
if ($action == 'setsupplier_order_min_amount')
{
$object->fetch($id);
- $object->supplier_order_min_amount=GETPOST('supplier_order_min_amount');
+ $object->supplier_order_min_amount=price2num(GETPOST('supplier_order_min_amount','alpha'));
$result=$object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
@@ -298,15 +298,17 @@ if ($object->id > 0)
print '';
print '
';
- print '';
- print '| ';
- print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
- print ' | ';
- $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
- print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
-
- print ' | ';
- print '
';
+ if (! empty($conf->fournisseur->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
+ {
+ print '';
+ print '| ';
+ print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
+ print ' | ';
+ $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
+ print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
+ print ' | ';
+ print '
';
+ }
// Categories
if (! empty($conf->categorie->enabled))
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index e1670e0c4d0..09310deb2fc 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -2116,7 +2116,7 @@ elseif (! empty($object->id))
// Total
$alert = '';
- if($object->total_ht < $object->thirdparty->supplier_order_min_amount) {
+ if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->supplier_order_min_amount) {
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->supplier_order_min_amount));
}
print '| '.$langs->trans("AmountHT").' | ';
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 72071919a9b..8ea73b73884 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -424,11 +424,10 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region
// We'll need this table joined to the select in order to filter by categ
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
-$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st";
+$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
// We'll need this table joined to the select in order to filter by sale
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-$sql.= " WHERE s.fk_stcomm = st.id";
-$sql.= " AND s.entity IN (".getEntity('societe').")";
+$sql.= " WHERE s.entity IN (".getEntity('societe').")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php
index 2f325f3001f..c2ea3d987a5 100644
--- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php
+++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php
@@ -23,10 +23,10 @@ if (empty($conf) || ! is_object($conf))
}
// Sale representative
-print '
| ';
+print ' |
| ';
print $langs->trans('SalesRepresentatives');
print ' | ';
-print '';
+print ' | ';
$listsalesrepresentatives=$object->getSalesRepresentatives($user);
$nbofsalesrepresentative=count($listsalesrepresentatives);
|