FIX : dont update object price on each iteration when updating situation for all lines
This commit is contained in:
parent
637f73a833
commit
56bfa20d70
@ -2560,9 +2560,10 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($mesg, null, 'warnings');
|
setEventMessages($mesg, null, 'warnings');
|
||||||
$result = -1;
|
$result = -1;
|
||||||
} else {
|
} 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) {
|
} elseif ($action == 'updateline' && $usercancreate && !$cancel) {
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
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
|
* Update invoice line with percentage
|
||||||
*
|
*
|
||||||
* @param FactureLigne $line Invoice line
|
* @param FactureLigne $line Invoice line
|
||||||
* @param int $percent Percentage
|
* @param int $percent Percentage
|
||||||
|
* @param boolean $update_price Update object price
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function update_percent($line, $percent)
|
public function update_percent($line, $percent, $update_price = true)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $mysoc, $user;
|
global $mysoc, $user;
|
||||||
@ -3756,7 +3757,11 @@ class Facture extends CommonInvoice
|
|||||||
$line->multicurrency_total_tva = $tabprice[17];
|
$line->multicurrency_total_tva = $tabprice[17];
|
||||||
$line->multicurrency_total_ttc = $tabprice[18];
|
$line->multicurrency_total_ttc = $tabprice[18];
|
||||||
$line->update($user);
|
$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