Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-09-25 22:47:12 +02:00
parent 70e313f16e
commit 92205f42a4
5 changed files with 9 additions and 9 deletions

View File

@ -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) {

View File

@ -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()
<?php
}
if (!empty($conf->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 */

View File

@ -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 '<td class="linecolmargin1 margininfos right" style="width: 80px">'.$langs->trans('BuyingPrice').'</td>';

View File

@ -49,7 +49,7 @@ global $mysoc;
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
$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;
}
@ -333,7 +333,7 @@ if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
print '<td align="right" class="linecolcycleref2 nowrap">'.price($sign * $tmp[0]).'</td>';
}
if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) {
if ($usemargins && isModEnabled('margin') && empty($user->socid)) {
if (!empty($user->rights->margins->creer)) { ?>
<td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php print price($line->pa_ht); ?></td>
<?php }

View File

@ -157,7 +157,7 @@ if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) {
// Private dir
$nodes[] = new \Sabre\DAV\FS\Directory($privateDir);
// ECM dir
if (!empty($conf->ecm->enabled) && !empty($conf->global->DAV_ALLOW_ECM_DIR)) {
if (isModEnabled('ecm') && !empty($conf->global->DAV_ALLOW_ECM_DIR)) {
$nodes[] = new \Sabre\DAV\FS\Directory($ecmDir);
}