diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 7c8a88a5c7e..86b167d154c 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -176,7 +176,7 @@ class modService extends DolibarrModules if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR'; } - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { + if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); } if (isModEnabled('stock')) { @@ -572,7 +572,7 @@ class modService extends DolibarrModules )); } - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { + if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice')); } if (is_object($mysoc) && $usenpr) { @@ -663,7 +663,7 @@ class modService extends DolibarrModules 'p.desiredstock' => '' )); } - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { + if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled('margin')) { $import_sample = array_merge($import_sample, array('p.cost_price'=>'90')); } if (is_object($mysoc) && $usenpr) { diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d755c3996a8..c8188c82bb8 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -41,7 +41,7 @@ if (empty($object) || !is_object($object)) { $usemargins = 0; -if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { +if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { $usemargins = 1; } @@ -492,7 +492,7 @@ jQuery(document).ready(function() margin->enabled)) { + if (isModEnabled('margin')) { ?> /* Add rule to clear margin when we change some data, so when we change sell or buy price, margin will be recalculated after submitting form */ jQuery("#tva_tx").click(function() { /* somtimes field is a text, sometimes a combo */ diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 36403e56c72..6d8238cd885 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -131,7 +131,7 @@ if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { } // Purchase price -if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) { +if ($usemargins && isModEnabled('margin') && empty($user->socid)) { if (!empty($user->rights->margins->creer)) { if ($conf->global->MARGIN_TYPE == "1") { print '