diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 199b6500184..57281bb43a6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -290,13 +290,6 @@ class Commande extends CommonOrder } } - // Set new ref and current status - if (! $error) - { - $this->ref = $num; - $this->statut = 1; - } - if (! $error) { // Appel des triggers @@ -307,6 +300,13 @@ class Commande extends CommonOrder // Fin appel triggers } + // Set new ref and current status + if (! $error) + { + $this->ref = $num; + $this->statut = 1; + } + if (! $error) { $this->db->commit(); @@ -1060,7 +1060,7 @@ class Commande extends CommonOrder function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0) { global $mysoc; - + $commandeid=$this->id; dol_syslog(get_class($this)."::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG); @@ -1107,9 +1107,9 @@ class Commande extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); - + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2314,9 +2314,9 @@ class Commande extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc); - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -2565,8 +2565,8 @@ class Commande extends CommonOrder while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - - $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; + + $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->client->warning_delay)) $this->nbtodolate++; } return 1;