Merge pull request #11813 from frederic34/patch-9
Optimize invoice situation doc
This commit is contained in:
commit
9db155287c
@ -5168,13 +5168,16 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
public function get_prev_progress($invoiceid, $include_credit_note = true)
|
public function get_prev_progress($invoiceid, $include_credit_note = true)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
global $invoicecache;
|
||||||
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
|
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
// If invoice is not a situation invoice, this->fk_prev_id is used for something else
|
// If invoice is not a situation invoice, this->fk_prev_id is used for something else
|
||||||
$tmpinvoice=new Facture($this->db);
|
if (!isset($invoicecache[$invoiceid])) {
|
||||||
$tmpinvoice->fetch($invoiceid);
|
$invoicecache[$invoiceid]=new Facture($this->db);
|
||||||
if ($tmpinvoice->type != Facture::TYPE_SITUATION) return 0;
|
$invoicecache[$invoiceid]->fetch($invoiceid);
|
||||||
|
}
|
||||||
|
if ($invoicecache[$invoiceid]->type != Facture::TYPE_SITUATION) return 0;
|
||||||
|
|
||||||
$sql = 'SELECT situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet WHERE rowid=' . $this->fk_prev_id;
|
$sql = 'SELECT situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet WHERE rowid=' . $this->fk_prev_id;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user