FIX update date_echeance of supplier invoices when we update invoice date in the past (#29886)
When we update the date of supplier invoices in the past, the date_echeance was not updated if the new calculated date_echeance is before the current date_echeance. The same goes if we update the payment term of supplier invoice, the date echeance is not updated if the new calculted date_echeance is before the current date_echeance. With this PR, when we update the supplier invoice date or payment term, the date_echeance is updated even if the new calculated date_echeance is before the current date_echeance. Co-authored-by: Ulysse Valdenaire <uvaldenaire@easya.solutions>
This commit is contained in:
parent
bd23133543
commit
ee75ffe823
1 changed files with 2 additions and 3 deletions
|
|
@ -389,9 +389,8 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$old_date_echeance = $object->date_echeance;
|
||||
$new_date_echeance = $object->calculate_date_lim_reglement();
|
||||
if ($new_date_echeance > $old_date_echeance) {
|
||||
if ($new_date_echeance) {
|
||||
$object->date_echeance = $new_date_echeance;
|
||||
}
|
||||
if ($object->date_echeance < $object->date) {
|
||||
|
|
@ -455,7 +454,7 @@ if (empty($reshook)) {
|
|||
|
||||
$object->date = $newdate;
|
||||
$date_echence_calc = $object->calculate_date_lim_reglement();
|
||||
if (!empty($object->date_echeance) && $object->date_echeance < $date_echence_calc) {
|
||||
if (!empty($object->date_echeance)) {
|
||||
$object->date_echeance = $date_echence_calc;
|
||||
}
|
||||
if ($object->date_echeance && $object->date_echeance < $object->date) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue