|
@@ -732,7 +732,8 @@ class CommandeFournisseur extends CommonOrder
|
|
|
|
|
|
// Do we have to change status now ? (If double approval is required and first approval, we keep status to 1 = validated)
|
|
|
$movetoapprovestatus=true;
|
|
|
-
|
|
|
+ $comment='';
|
|
|
+
|
|
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
|
|
$sql.= " SET ref='".$this->db->escape($num)."',";
|
|
|
if (empty($secondlevel)) // standard or first level approval
|
|
@@ -741,7 +742,11 @@ class CommandeFournisseur extends CommonOrder
|
|
|
$sql.= " fk_user_approve = ".$user->id;
|
|
|
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
|
|
|
+ if (empty($this->user_approve_id2))
|
|
|
+ {
|
|
|
+ $movetoapprovestatus=false; // second level approval not done
|
|
|
+ $comment=' (first level)';
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else // request a second level approval
|
|
@@ -749,6 +754,7 @@ class CommandeFournisseur extends CommonOrder
|
|
|
$sql.= " date_approve2='".$this->db->idate($now)."',";
|
|
|
$sql.= " fk_user_approve2 = ".$user->id;
|
|
|
if (empty($this->user_approve_id)) $movetoapprovestatus=false; // first level approval not done
|
|
|
+ $comment=' (second level)';
|
|
|
}
|
|
|
// If double approval is required and first approval, we keep status to 1 = validated
|
|
|
if ($movetoapprovestatus) $sql.= ", fk_statut = 2";
|
|
@@ -758,7 +764,7 @@ class CommandeFournisseur extends CommonOrder
|
|
|
|
|
|
if ($this->db->query($sql))
|
|
|
{
|
|
|
- $this->log($user, 2, time()); // Statut 2
|
|
|
+ $this->log($user, 2, time(), $comment); // Statut 2
|
|
|
|
|
|
if (! empty($conf->global->SUPPLIER_ORDER_AUTOADD_USER_CONTACT))
|
|
|
{
|