Fix Stickler CI

This commit is contained in:
kamel 2021-04-26 17:48:42 +02:00
parent 9c46b234cf
commit 9f3bcbc39d

View File

@ -3618,48 +3618,36 @@ class SupplierInvoiceLine extends CommonObjectLine
// Si fk_remise_except defini, on lie la remise a la facture // Si fk_remise_except defini, on lie la remise a la facture
// ce qui la flague comme "consommee". // ce qui la flague comme "consommee".
if ($this->fk_remise_except) if ($this->fk_remise_except) {
{
$discount = new DiscountAbsolute($this->db); $discount = new DiscountAbsolute($this->db);
$result = $discount->fetch($this->fk_remise_except); $result = $discount->fetch($this->fk_remise_except);
if ($result >= 0) if ($result >= 0) {
{
// Check if discount was found // Check if discount was found
if ($result > 0) if ($result > 0) {
{
// Check if discount not already affected to another invoice // Check if discount not already affected to another invoice
if ($discount->fk_facture_line > 0) if ($discount->fk_facture_line > 0) {
{ if (empty($noerrorifdiscountalreadylinked)) {
if (empty($noerrorifdiscountalreadylinked))
{
$this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id); $this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id);
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
} } else {
else
{
$result = $discount->link_to_invoice($this->rowid, 0); $result = $discount->link_to_invoice($this->rowid, 0);
if ($result < 0) if ($result < 0) {
{
$this->error = $discount->error; $this->error = $discount->error;
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
} }
} } else {
else
{
$this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded");
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -3; return -3;
} }
} } else {
else
{
$this->error = $discount->error; $this->error = $discount->error;
dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();