diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6ef9c3aa253..7376e797c3c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2069,11 +2069,16 @@ class Commande extends CommonObject $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;'; if ($this->db->query($sql) ) { - if (($conf->global->PROPALE_CLASSIFIED_INVOICED_WITH_ORDER == 1) && $this->propale_id) - { - $propal = new Propal($this->db); - $propal->fetch($this->propale_id); - $propal->classer_facturee(); + if (! empty($conf->propal->enabled) && ! empty($conf->global->PROPALE_CLASSIFIED_INVOICED_WITH_ORDER)) + { + $this->fetchObjectLinked('','propal',$this->id,$this->element); + if (! empty($this->linkedObjects)) + { + foreach($this->linkedObjects['propal'] as $element) + { + $ret=$element->classer_facturee(); + } + } } return 1; }