From 56a0f70ad3c8f0607f6d47888863d790b509f0f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Apr 2013 10:33:25 +0200 Subject: [PATCH 1/4] Fix: margin disabled into demo for foundation --- htdocs/public/demo/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index c0e47ea955d..1c03c17c5b5 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -42,7 +42,7 @@ $hookmanager->initHooks(array('demo')); $demoprofiles=array( array('default'=>'1', 'key'=>'profdemoservonly','label'=>'DemoCompanyServiceOnly', - 'disablemodules'=>'adherent,barcode,boutique,cashdesk,categorie,don,expedition,externalsite,mailmanspip,prelevement,product,stock', + 'disablemodules'=>'adherent,barcode,boutique,cashdesk,categorie,don,expedition,externalsite,mailmanspip,margin,prelevement,product,stock', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png'), array('default'=>'-1','key'=>'profdemoshopwithdesk','label'=>'DemoCompanyShopWithCashDesk', 'disablemodules'=>'adherent,boutique,categorie,don,externalsite,ficheinter,mailmanspip,prelevement,product,stock', @@ -54,10 +54,10 @@ $demoprofiles=array( 'disablemodules'=>'adherent,boutique,don,externalsite,mailmanspip', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'), array('default'=>'-1', 'key'=>'profdemofun','label'=>'DemoFundation', - 'disablemodules'=>'banque,barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,prelevement,product,projet,propal,propale,service,societe,stock,tax', + 'disablemodules'=>'banque,barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png'), array('default'=>'0', 'key'=>'profdemofun2','label'=>'DemoFundation2', - 'disablemodules'=>'barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,prelevement,product,projet,propal,propale,service,societe,stock,tax', + 'disablemodules'=>'barcode,boutique,cashdesk,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,facture,ficheinter,fournisseur,mailmanspip,margin,prelevement,product,projet,propal,propale,service,societe,stock,tax', 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png') ); From 077698d78989f7d8c3836fb0fd8c08110315e887 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 19 Apr 2013 12:47:53 +0200 Subject: [PATCH 2/4] Fix: for avoid missing the customer discount --- htdocs/core/tpl/objectline_add.tpl.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index 497d4a294ba..6a7cffcb3fc 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -80,8 +80,8 @@ if (! empty($conf->margin->enabled)) { 'origin_price_ht_cache' => 'price_ht', 'origin_tva_tx_cache' => 'tva_tx', 'origin_price_ttc_cache' => 'price_ttc', - 'qty' => 'qty' - ,'remise_percent' => 'discount' + 'qty' => 'qty', + 'remise_percent' => 'discount' ), 'update_textarea' => array( 'product_desc' => 'desc' @@ -160,7 +160,10 @@ if (! empty($conf->margin->enabled)) { - % + + % + + margin->enabled)) { @@ -373,6 +376,11 @@ $(document).ready(function() { $('#price_ttc').attr('disabled','disabled'); } + $('#remise_percent').bind('change', function() { + if ($(this).val() < $('#origin_remise_percent').val()) + $('#remise_percent').val($('#origin_remise_percent').val()); + }); + $('#tva_tx').change(function() { if ($(this).val() == 0) { if ($('#idprod').val() == 0) { From 5d7b94f6610a94f8204965bfe6ac78ca8a3f7a2a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 19 Apr 2013 13:30:08 +0200 Subject: [PATCH 3/4] Fix: the purchase price, manually entered is not taken recovered --- htdocs/core/class/commonobject.class.php | 285 ++++++++++++----------- 1 file changed, 148 insertions(+), 137 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9f8a2aabf7d..6d8dfff5934 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2946,11 +2946,11 @@ abstract class CommonObject global $conf,$langs,$bc; //var_dump($line); - if (!empty($line->date_start)) - { + if (!empty($line->date_start)) + { $date_start=$line->date_start; } - else + else { $date_start=$line->date_debut_prevue; if ($line->date_debut_reel) $date_start=$line->date_debut_reel; @@ -2959,7 +2959,7 @@ abstract class CommonObject { $date_end=$line->date_end; } - else + else { $date_end=$line->date_fin_prevue; if ($line->date_fin_reel) $date_end=$line->date_fin_reel; @@ -2995,7 +2995,7 @@ abstract class CommonObject $this->tpl['label'].=$line->desc; }else { $this->tpl['label'].= ($line->label ? ' '.$line->label : ''); - } + } // Dates if ($line->product_type == 1 && ($date_start || $date_end)) { @@ -3048,149 +3048,160 @@ abstract class CommonObject } + /** + * + * @param string $force_price + * @return multitype:number string NULL + */ + function getMarginInfos($force_price=false) { + global $conf; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; - function getMarginInfos($force_price=false) { - global $conf; - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; - $marginInfos = array( - 'pa_products' => 0, - 'pv_products' => 0, - 'margin_on_products' => 0, - 'margin_rate_products' => '', - 'mark_rate_products' => '', - 'pa_services' => 0, - 'pv_services' => 0, - 'margin_on_services' => 0, - 'margin_rate_services' => '', - 'mark_rate_services' => '', - 'pa_total' => 0, - 'pv_total' => 0, - 'total_margin' => 0, - 'total_margin_rate' => '', - 'total_mark_rate' => '' - ); - foreach($this->lines as $line) { - if (isset($line->fk_fournprice) && !$force_price) { - $product = new ProductFournisseur($this->db); - if ($product->fetch_product_fournisseur_price($line->fk_fournprice)) - $line->pa_ht = $product->fourn_unitprice; - if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0) - $line->pa_ht += $product->fourn_unitcharges; - } - // si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente - if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) { - $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); - } + $marginInfos = array( + 'pa_products' => 0, + 'pv_products' => 0, + 'margin_on_products' => 0, + 'margin_rate_products' => '', + 'mark_rate_products' => '', + 'pa_services' => 0, + 'pv_services' => 0, + 'margin_on_services' => 0, + 'margin_rate_services' => '', + 'mark_rate_services' => '', + 'pa_total' => 0, + 'pv_total' => 0, + 'total_margin' => 0, + 'total_margin_rate' => '', + 'total_mark_rate' => '' + ); - // calcul des marges - if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise - if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit - $marginInfos['pa_products'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); + foreach($this->lines as $line) { + if (empty($line->pa_ht) && isset($line->fk_fournprice) && !$force_price) { + $product = new ProductFournisseur($this->db); + if ($product->fetch_product_fournisseur_price($line->fk_fournprice)) + $line->pa_ht = $product->fourn_unitprice; + if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0) + $line->pa_ht += $product->fourn_unitcharges; + } + // si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente + if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) { + $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); + } + + // calcul des marges + if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise + if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit + $marginInfos['pa_products'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pv_products'] += $line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); } - elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service - $marginInfos['pa_services'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100)); - $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); + elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service + $marginInfos['pa_services'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pv_services'] += $line->subprice * (1 - ($line->remise_percent / 100)); + $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pv_total'] += $line->subprice * (1 - $line->remise_percent / 100); } - elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total - $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pv_total'] += $line->subprice * (1 - ($line->remise_percent / 100)); + elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total + $marginInfos['pa_total'] += $line->pa_ht;// ($line->pa_ht != 0)?$line->pa_ht:$line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pv_total'] += $line->subprice * (1 - ($line->remise_percent / 100)); } } - else { - $type=$line->product_type?$line->product_type:$line->fk_product_type; - if ($type == 0) { // product - $marginInfos['pa_products'] += $line->qty * $line->pa_ht; - $marginInfos['pv_products'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); - $marginInfos['pa_total'] += $line->qty * $line->pa_ht; - $marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); - } - elseif ($type == 1) { // service - $marginInfos['pa_services'] += $line->qty * $line->pa_ht; - $marginInfos['pv_services'] += $line->qty * $line->subprice * (1 - ($line->remise_percent / 100)); - $marginInfos['pa_total'] += $line->qty * $line->pa_ht; - $marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); - } - } - } + else { + $type=$line->product_type?$line->product_type:$line->fk_product_type; + if ($type == 0) { // product + $marginInfos['pa_products'] += $line->qty * $line->pa_ht; + $marginInfos['pv_products'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + $marginInfos['pa_total'] += $line->qty * $line->pa_ht; + $marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + } + elseif ($type == 1) { // service + $marginInfos['pa_services'] += $line->qty * $line->pa_ht; + $marginInfos['pv_services'] += $line->qty * $line->subprice * (1 - ($line->remise_percent / 100)); + $marginInfos['pa_total'] += $line->qty * $line->pa_ht; + $marginInfos['pv_total'] += $line->qty * $line->subprice * (1 - $line->remise_percent / 100); + } + } + } - $marginInfos['margin_on_products'] = $marginInfos['pv_products'] - $marginInfos['pa_products']; - if ($marginInfos['pa_products'] > 0) - $marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5); - if ($marginInfos['pv_products'] > 0) - $marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5); + $marginInfos['margin_on_products'] = $marginInfos['pv_products'] - $marginInfos['pa_products']; + if ($marginInfos['pa_products'] > 0) + $marginInfos['margin_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pa_products'],5); + if ($marginInfos['pv_products'] > 0) + $marginInfos['mark_rate_products'] = 100 * round($marginInfos['margin_on_products'] / $marginInfos['pv_products'],5); - $marginInfos['margin_on_services'] = $marginInfos['pv_services'] - $marginInfos['pa_services']; - if ($marginInfos['pa_services'] > 0) - $marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5); - if ($marginInfos['pv_services'] > 0) - $marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5); + $marginInfos['margin_on_services'] = $marginInfos['pv_services'] - $marginInfos['pa_services']; + if ($marginInfos['pa_services'] > 0) + $marginInfos['margin_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pa_services'],5); + if ($marginInfos['pv_services'] > 0) + $marginInfos['mark_rate_services'] = 100 * round($marginInfos['margin_on_services'] / $marginInfos['pv_services'],5); + $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; + if ($marginInfos['pa_total'] > 0) + $marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5); + if ($marginInfos['pv_total'] > 0) + $marginInfos['total_mark_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pv_total'],5); - $marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total']; - if ($marginInfos['pa_total'] > 0) - $marginInfos['total_margin_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pa_total'],5); - if ($marginInfos['pv_total'] > 0) - $marginInfos['total_mark_rate'] = 100 * round($marginInfos['total_margin'] / $marginInfos['pv_total'],5); + return $marginInfos; + } - return $marginInfos; - } + /** + * + * @param string $force_price + */ + function displayMarginInfos($force_price=false) { + global $langs, $conf; + + $marginInfo = $this->getMarginInfos($force_price); + + print ''; + print ''; + print ''; + print ''; + if ($conf->global->MARGIN_TYPE == "1") + print ''; + else + print ''; + print ''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print ''; + print ''; + //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print ''; + print ''; + //} + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) + print ''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) + print ''; + print ''; + print '
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').'
'.$langs->trans('MarginOnProducts').''.price($marginInfo['pv_products']).''.price($marginInfo['pa_products']).''.price($marginInfo['margin_on_products']).''.(($marginInfo['margin_rate_products'] == '')?'n/a':price($marginInfo['margin_rate_products']).'%').''.(($marginInfo['mark_rate_products'] == '')?'n/a':price($marginInfo['mark_rate_products']).'%').'
'.$langs->trans('MarginOnServices').''.price($marginInfo['pv_services']).''.price($marginInfo['pa_services']).''.price($marginInfo['margin_on_services']).''.(($marginInfo['margin_rate_services'] == '')?'n/a':price($marginInfo['margin_rate_services']).'%').''.(($marginInfo['mark_rate_services'] == '')?'n/a':price($marginInfo['mark_rate_services']).'%').'
'.$langs->trans('TotalMargin').''.price($marginInfo['pv_total']).''.price($marginInfo['pa_total']).''.price($marginInfo['total_margin']).''.(($marginInfo['total_margin_rate'] == '')?'n/a':price($marginInfo['total_margin_rate']).'%').''.(($marginInfo['total_mark_rate'] == '')?'n/a':price($marginInfo['total_mark_rate']).'%').'
'; + } - function displayMarginInfos($force_price=false) { - global $langs, $conf; - $marginInfo = $this->getMarginInfos($force_price); - print ''; - print ''; - print ''; - print ''; - if ($conf->global->MARGIN_TYPE == "1") - print ''; - else - print ''; - print ''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; - print ''; - //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; - print ''; - //} - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; - print ''; - print '
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').'
'.$langs->trans('MarginOnProducts').''.price($marginInfo['pv_products']).''.price($marginInfo['pa_products']).''.price($marginInfo['margin_on_products']).''.(($marginInfo['margin_rate_products'] == '')?'n/a':price($marginInfo['margin_rate_products']).'%').''.(($marginInfo['mark_rate_products'] == '')?'n/a':price($marginInfo['mark_rate_products']).'%').'
'.$langs->trans('MarginOnServices').''.price($marginInfo['pv_services']).''.price($marginInfo['pa_services']).''.price($marginInfo['margin_on_services']).''.(($marginInfo['margin_rate_services'] == '')?'n/a':price($marginInfo['margin_rate_services']).'%').''.(($marginInfo['mark_rate_services'] == '')?'n/a':price($marginInfo['mark_rate_services']).'%').'
'.$langs->trans('TotalMargin').''.price($marginInfo['pv_total']).''.price($marginInfo['pa_total']).''.price($marginInfo['total_margin']).''.(($marginInfo['total_margin_rate'] == '')?'n/a':price($marginInfo['total_margin_rate']).'%').''.(($marginInfo['total_mark_rate'] == '')?'n/a':price($marginInfo['total_mark_rate']).'%').'
'; - } } - ?> From 556574cbc96b17149ceec49627143e33ebcde76c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 19 Apr 2013 13:47:30 +0200 Subject: [PATCH 4/4] FIXME: this field not exist in llx_product_fournisseur_price --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 9a86f0e9ee3..8d5a3474bf8 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -296,7 +296,7 @@ class ProductFournisseur extends Product function fetch_product_fournisseur_price($rowid) { $sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,"; - $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.recuperableonly as fourn_tva_npr"; + $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " WHERE pfp.rowid = ".$rowid; @@ -320,7 +320,7 @@ class ProductFournisseur extends Product $this->product_id = $obj->fk_product; // deprecated $this->fk_product = $obj->fk_product; $this->fk_availability = $obj->fk_availability; - $this->fourn_tva_npr = $obj->fourn_tva_npr; + //$this->fourn_tva_npr = $obj->fourn_tva_npr; // FIXME this field not exist in llx_product_fournisseur_price return 1; } else