From 03f85bef83746ea9c9a30fd59c7e800275ca9023 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Jul 2012 16:57:10 +0200 Subject: [PATCH] [ bug #444 ] Regression on auto-closing for proposals and orders --- htdocs/commande/class/commande.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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; }