';
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 6628aeb19d7..9bd341e357c 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -703,7 +703,10 @@ class CommandeFournisseur extends CommonOrder
{
$sql.= " date_approve='".$this->db->idate($now)."',";
$sql.= " fk_user_approve = ".$user->id;
- if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)) $movetoapprovestatus=false;
+ if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)
+ {
+ if (empty($this->user_approve_id2)) $movetoapprovestatus=false; // second level approval not done
+ }
}
else // request a second level approval
{
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index a348ad93396..9ca609c154c 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -2629,7 +2629,7 @@ elseif (! empty($object->id))
{
if ($user->rights->fournisseur->commande->approuver)
{
- if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && ! empty($object->user_approve_id))
+ if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL && ! empty($object->user_approve_id))
{
print ''.$langs->trans("ApproveOrder").'';
}
@@ -2645,23 +2645,26 @@ elseif (! empty($object->id))
}
// Second approval (if option SUPPLIER_ORDER_DOUBLE_APPROVAL is set)
- if ($object->statut == 1)
+ if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)
{
- if ($user->rights->fournisseur->commande->approve2)
+ if ($object->statut == 1)
{
- if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && ! empty($object->user_approve_id2))
+ if ($user->rights->fournisseur->commande->approve2)
{
- print ''.$langs->trans("Approve2Order").'';
+ if (! empty($object->user_approve_id2))
+ {
+ print ''.$langs->trans("Approve2Order").'';
+ }
+ else
+ {
+ print 'id.'&action=approve2">'.$langs->trans("Approve2Order").'';
+ }
}
else
{
- print 'id.'&action=approve2">'.$langs->trans("Approve2Order").'';
+ print ''.$langs->trans("Approve2Order").'';
}
}
- else
- {
- print ''.$langs->trans("Approve2Order").'';
- }
}
// Refuse
diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang
index 39b3ee8c3d9..85b01c6c25a 100644
--- a/htdocs/langs/en_US/suppliers.lang
+++ b/htdocs/langs/en_US/suppliers.lang
@@ -43,4 +43,4 @@ ListOfSupplierOrders=List of supplier orders
MenuOrdersSupplierToBill=Supplier orders to invoice
NbDaysToDelivery=Delivery delay in days
DescNbDaysToDelivery=The biggest deliver delay of the products from this order
-UseDoubleApproval=Use double approval (the second approval can be done by any user with the dedicated permission)
\ No newline at end of file
+UseDoubleApproval=Use double approval when amount (without tax) is higher than (The second approval can be done by any user with the dedicated permission. Set to 0 for no double approval)
\ No newline at end of file