diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3c478ff5a2c..44f7e00bdce 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -64,7 +64,7 @@ $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'pro if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } -if (!empty($conf->margin->enabled)) { +if (isModEnabled('margin')) { $langs->load('margins'); } @@ -2737,7 +2737,7 @@ if ($action == 'create') { print ''; // Margin Infos - if (!empty($conf->margin->enabled)) { + if (isModEnabled('margin')) { $formmargin->displayMarginInfos($object); } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 5b678a0f7ac..76c4a42ddce 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -536,7 +536,7 @@ $formother = new FormOther($db); $formfile = new FormFile($db); $formpropal = new FormPropal($db); $formmargin = null; -if (!empty($conf->margin->enabled)) { +if (isModEnabled('margin')) { $formmargin = new FormMargin($db); } $companystatic = new Societe($db); @@ -1573,7 +1573,7 @@ if ($resql) { $typenArray = null; $with_margin_info = false; - if (!empty($conf->margin->enabled) && ( + if (isModEnabled('margin') && ( !empty($arrayfields['total_pa']['checked']) || !empty($arrayfields['total_margin']['checked']) || !empty($arrayfields['total_margin_rate']['checked']) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5cde78cd09f..58a6ce70f0f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -if (!empty($conf->margin->enabled)) { +if (isModEnabled('margin')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; } require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -199,10 +199,10 @@ $arrayfields = array( 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), - 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), - 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), - 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), - 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), + 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), + 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), + 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), + 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), @@ -778,7 +778,7 @@ $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); $formmargin = null; -if (!empty($conf->margin->enabled)) { +if (isModEnabled('margin')) { $formmargin = new FormMargin($db); } $companystatic = new Societe($db); @@ -1850,7 +1850,7 @@ if ($resql) { $i = 0; $with_margin_info = false; - if (!empty($conf->margin->enabled) && ( + if (isModEnabled('margin') && ( !empty($arrayfields['total_pa']['checked']) || !empty($arrayfields['total_margin']['checked']) || !empty($arrayfields['total_margin_rate']['checked']) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ddfe7e5429f..1d6dbd9f03b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -245,10 +245,10 @@ $arrayfields = array( 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>292), 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>295), 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>296), // Not enabled by default because slow - 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), - 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), - 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), - 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), + 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) ? 0 : 1)), + 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) ? 0 : 1)), + 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), + 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502), 'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))), diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 3509134c70f..b452b20154a 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1476,7 +1476,7 @@ if ($action == 'create') { $productstatic = new Product($db); $usemargins = 0; - if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'propal', 'commande'))) { + if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'propal', 'commande'))) { $usemargins = 1; } @@ -1522,7 +1522,7 @@ if ($action == 'create') { print ''.$langs->trans("Unit").''; } print ''.$langs->trans("ReductionShort").''; - if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { + if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { print ''.$langs->trans("BuyingPrice").''; } print ' '; @@ -1592,7 +1592,7 @@ if ($action == 'create') { } // Margin - if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { + if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { print ''.price($objp->pa_ht).''; } @@ -1749,7 +1749,7 @@ if ($action == 'create') { print ''; $colspan = 6; - if (!empty($conf->margin->enabled) && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { + if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) { $colspan++; } if (!empty($conf->global->PRODUCT_USE_UNITS)) { @@ -2237,7 +2237,7 @@ $db->close(); ?> margin->enabled) && $action == 'editline') { +if (isModEnabled('margin') && $action == 'editline') { // TODO Why this ? To manage margin on contracts ? ?>