diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 373bc81c4c6..b10e0d37c75 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -171,7 +171,8 @@ if ($result) { $line->fetch($obj->fdid); // Situation invoices handling - $prev_progress = $line->get_prev_progress($obj->fdid); + $prev_progress = $line->get_prev_progress($obj->rowid); + if ($obj->type == Facture::TYPE_SITUATION) { // Avoid divide by 0 if ($obj->situation_percent == 0) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4c3fb340264..7d6de9bda7f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1044,6 +1044,10 @@ class ExtraFields $sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0]; if (!empty($InfoFieldList[4])) { + // can use curent entity filter + if (strpos($InfoFieldList[4], '$ENTITY$')!==false) { + $InfoFieldList[4]=str_replace('$ENTITY$',$conf->entity,$InfoFieldList[4]); + } // can use SELECT request if (strpos($InfoFieldList[4], '$SEL$')!==false) { $InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);