Fix: uniformize code (in progress)

This commit is contained in:
Regis Houssin
2012-07-20 09:57:50 +02:00
parent 9f3f3703e3
commit fafd79a0f8
37 changed files with 337 additions and 380 deletions

View File

@@ -28,8 +28,7 @@
*/
include_once(DOL_DOCUMENT_ROOT."/core/class/commonorder.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT ."/marges/lib/marges.lib.php");
require_once(DOL_DOCUMENT_ROOT ."/margin/lib/margins.lib.php");
/**
* \class Commande
@@ -2240,7 +2239,7 @@ class Commande extends CommonOrder
// infos marge
$this->line->fk_fournprice = $fk_fournprice;
$this->line->pa_ht = $pa_ht;
// TODO deprecated
$this->line->price=$price;
$this->line->remise=$remise;
@@ -2998,13 +2997,13 @@ class OrderLine
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->pa_ht)) $this->pa_ht=0;
// si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises)
// si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises)
if ($this->pa_ht == 0) {
if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
}
// Check parameters
if ($this->product_type < 0) return -1;
@@ -3106,8 +3105,8 @@ class OrderLine
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->pa_ht)) $this->pa_ht=0;
// si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises)
// si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises)
if ($this->pa_ht == 0) {
if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);