Fix credit note card apparence

This commit is contained in:
John 2018-04-05 09:46:55 +02:00
parent ce24ca08ee
commit e966d11356
2 changed files with 11 additions and 2 deletions

View File

@ -4586,6 +4586,7 @@ else if ($id > 0 || ! empty($ref))
// remove situation from cycle
if ($object->statut == Facture::STATUS_VALIDATED
&& $object->type == Facture::TYPE_SITUATION
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->situation_counter > 1

View File

@ -1530,8 +1530,16 @@ class Facture extends CommonInvoice
$invoice = new Facture($this->db);
if ($invoice->fetch($objp->rowid) > 0)
{
if ($objp->situation_counter < $this->situation_counter) $this->tab_previous_situation_invoice[] = $invoice;
else $this->tab_next_situation_invoice[] = $invoice;
if ($objp->situation_counter < $this->situation_counter
|| ($objp->situation_counter == $this->situation_counter && $objp->rowid < $this->id) // This case appear when there are credit notes
)
{
$this->tab_previous_situation_invoice[] = $invoice;
}
else
{
$this->tab_next_situation_invoice[] = $invoice;
}
}
}
}