FIX: mandatory extrafelds on lines are not checked (#34228)

* FIX: mandatory extrafelds on lines are not checked

* FIX: mandatory extrafelds on lines are not checked
This commit is contained in:
HENRY Florian 2025-05-22 17:40:41 +02:00 committed by GitHub
parent 819c3fd08a
commit 51e4ce05c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 62 additions and 12 deletions

View file

@ -4443,8 +4443,17 @@ class PropaleLigne extends CommonObjectLine
// End call triggers
}
$this->db->commit();
return 1;
if (!$error) {
$this->db->commit();
return 1;
}
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->error = $this->db->error()." sql=".$sql;
$this->db->rollback();
@ -4650,8 +4659,17 @@ class PropaleLigne extends CommonObjectLine
// End call triggers
}
$this->db->commit();
return 1;
if (!$error) {
$this->db->commit();
return 1;
}
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->error = $this->db->error();
$this->db->rollback();

View file

@ -6409,7 +6409,7 @@ class FactureLigne extends CommonInvoiceLine
// If fk_remise_except is defined, the discount is linked to the invoice
// which flags it as "consumed".
if ($this->fk_remise_except) {
if ($this->fk_remise_except && empty($error)) {
$discount = new DiscountAbsolute($this->db);
$result = $discount->fetch($this->fk_remise_except);
if ($result >= 0) {
@ -6446,7 +6446,7 @@ class FactureLigne extends CommonInvoiceLine
}
}
if (!$notrigger) {
if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger('LINEBILL_INSERT', $user);
if ($result < 0) {
@ -6456,8 +6456,17 @@ class FactureLigne extends CommonInvoiceLine
// End call triggers
}
$this->db->commit();
return $this->id;
if (!$error) {
$this->db->commit();
return $this->id;
}
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
@ -6628,8 +6637,18 @@ class FactureLigne extends CommonInvoiceLine
}
// End call triggers
}
$this->db->commit();
return 1;
if (!$error) {
$this->db->commit();
return 1;
}
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->error = $this->db->error();
$this->db->rollback();

View file

@ -3026,6 +3026,8 @@ class CommandeFournisseur extends CommonOrder
$this->db->commit();
return $result;
} else {
$this->errors[] = $this->line->error;
$this->errors = array_merge($this->errors, $this->line->errors);
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;

View file

@ -2439,6 +2439,7 @@ class FactureFournisseur extends CommonInvoice
if ($res < 1) {
$this->errors[] = $line->error;
$this->errors = array_merge($this->errors, $line->errors);
} else {
// Update total price into invoice record
$res = $this->update_price('1', 'auto', 0, $this->thirdparty);
@ -4093,8 +4094,18 @@ class SupplierInvoiceLine extends CommonObjectLine
// End call triggers
}
$this->db->commit();
return $this->id;
if (!$error) {
$this->db->commit();
return $this->id;
}
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->error = $this->db->error();
$this->db->rollback();