Merge pull request #20583 from altairisfr/sitfac
FIX : dont update object price on each iteration when updating situation on all lines
This commit is contained in:
commit
27b3209f51
@ -2560,9 +2560,10 @@ if (empty($reshook)) {
|
||||
setEventMessages($mesg, null, 'warnings');
|
||||
$result = -1;
|
||||
} else {
|
||||
$object->update_percent($line, GETPOST('all_progress'));
|
||||
$object->update_percent($line, GETPOST('all_progress'), false);
|
||||
}
|
||||
}
|
||||
$object->update_price(1);
|
||||
}
|
||||
} elseif ($action == 'updateline' && $usercancreate && !$cancel) {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
||||
|
||||
@ -3725,11 +3725,12 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* Update invoice line with percentage
|
||||
*
|
||||
* @param FactureLigne $line Invoice line
|
||||
* @param int $percent Percentage
|
||||
* @param FactureLigne $line Invoice line
|
||||
* @param int $percent Percentage
|
||||
* @param boolean $update_price Update object price
|
||||
* @return void
|
||||
*/
|
||||
public function update_percent($line, $percent)
|
||||
public function update_percent($line, $percent, $update_price = true)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $mysoc, $user;
|
||||
@ -3756,7 +3757,11 @@ class Facture extends CommonInvoice
|
||||
$line->multicurrency_total_tva = $tabprice[17];
|
||||
$line->multicurrency_total_ttc = $tabprice[18];
|
||||
$line->update($user);
|
||||
$this->update_price(1);
|
||||
|
||||
// sometimes it is better to not update price for each line, ie when updating situation on all lines
|
||||
if ($update_price) {
|
||||
$this->update_price(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user