FIX credit note progression

This commit is contained in:
John BOTELLA 2018-09-25 09:54:58 +02:00
parent b1380a6902
commit 791c373db5
2 changed files with 4 additions and 3 deletions

View File

@ -953,8 +953,8 @@ if (empty($reshook))
if($facture_source->type == Facture::TYPE_SITUATION)
{
$line->fk_prev_id = $line->id;
$source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id
$line->fk_prev_id = $line->id; // Credit note line need to be linked to the situation invoice it is create from
if(!empty($facture_source->tab_previous_situation_invoice))
{
@ -978,7 +978,7 @@ if (empty($reshook))
$maxPrevSituationPercent = 0;
foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{
if($prevLine->id == $line->fk_prev_id)
if($prevLine->id == $source_fk_prev_id)
{
$maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent);

View File

@ -4828,6 +4828,7 @@ class FactureLigne extends CommonInvoiceLine
* Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
*
* @param int $invoiceid Invoice id
* @param bool $include_credit_note
* @return int >= 0
*/
function get_prev_progress($invoiceid, $include_credit_note = true)