use isModEnabled

This commit is contained in:
Frédéric FRANCE 2023-04-19 13:58:08 +02:00
parent ec8c550f37
commit fee9dec15a
13 changed files with 22 additions and 23 deletions

View File

@ -3061,7 +3061,7 @@ class Adherent extends CommonObject
$blockingerrormsg = '';
if (empty($conf->adherent->enabled)) { // Should not happen. If module disabled, cron job should not be visible.
if (!isModEnabled('adherent')) { // Should not happen. If module disabled, cron job should not be visible.
$langs->load("agenda");
$this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
return 0;

View File

@ -890,7 +890,7 @@ if ($search_billed != '' && $search_billed >= 0) {
}
if ($search_status <> '') {
if ($search_status <= 3 && $search_status >= -1) { // status from -1 to 3 are real status (other are virtual combination)
if ($search_status == 1 && empty($conf->expedition->enabled)) {
if ($search_status == 1 && !isModEnabled('expedition')) {
$sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated'
} else {
$sql .= ' AND c.fk_statut = '.((int) $search_status); // draft, validated, in process or canceled
@ -1116,7 +1116,7 @@ if ($resql) {
$title .= ' - '.$langs->trans('StatusOrderToProcessShort');
}
if ($search_status == -3) {
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('expedition') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
}
if ($search_status == -4) {
$title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort");

View File

@ -188,7 +188,7 @@ $arrayfields = array(
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>55),
'c.date_commande'=>array('label'=>"OrderDateShort", 'checked'=>1, 'position'=>60),
'c.date_delivery'=>array('label'=>"DateDeliveryPlanned", 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE), 'position'=>65),
'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>-1, 'position'=>66 , 'enabled'=>!empty($conf->expedition->enabled)),
'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>-1, 'position'=>66 , 'enabled'=>isModEnabled('expedition')),
'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>-1, 'position'=>67),
'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>-1, 'position'=>68),
'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>-1, 'position'=>69),
@ -212,7 +212,7 @@ $arrayfields = array(
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
'c.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position'=>135),
'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140),
'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990),
'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(isModEnabled('expedition')), 'position'=>990),
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995),
'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999),
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
@ -466,7 +466,7 @@ if ($search_billed != '' && $search_billed >= 0) {
}
if ($search_status <> '') {
if ($search_status <= 3 && $search_status >= -1) { // status from -1 to 3 are real status (other are virtual combination)
if ($search_status == 1 && empty($conf->expedition->enabled)) {
if ($search_status == 1 && !isModEnabled('expedition')) {
$sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated'
} else {
$sql .= ' AND c.fk_statut = '.((int) $search_status); // brouillon, validee, en cours, annulee
@ -646,7 +646,7 @@ if ($resql) {
$title .= ' - '.$langs->trans('StatusOrderToProcessShort');
}
if ($search_status == -3) {
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('expedition') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
}
if ($search_status == -4) {
$title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort");

View File

@ -1178,7 +1178,7 @@ if ($resql) {
if (!empty($user->rights->facture->paiement)) {
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
}
if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
if (isModEnabled('prelevement') && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
}

View File

@ -746,7 +746,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Remain to take or to pay back
print '<td class="right">';
print price($sign * $remaintopay);
if (!empty($conf->prelevement->enabled)) {
if (isModEnabled('prelevement')) {
$numdirectdebitopen = 0;
$totaldirectdebit = 0;
$sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
@ -859,8 +859,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<br><div class="center">';
print '<input type="checkbox" checked name="closepaidinvoices"> '.$checkboxlabel;
/*if (!empty($conf->prelevement->enabled))
{
/*if (isModEnabled('prelevement')) {
$langs->load("withdrawals");
if (!empty($conf->global->WITHDRAW_DISABLE_AUTOCREATE_ONPAYMENTS)) print '<br>'.$langs->trans("IfInvoiceNeedOnWithdrawPaymentWontBeClosed");
}*/

View File

@ -56,7 +56,7 @@ function facture_prepare_head($object)
$h++;
}
if (!empty($conf->prelevement->enabled)) {
if (isModEnabled('prelevement')) {
$nbStandingOrders = 0;
$sql = "SELECT COUNT(pfd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";

View File

@ -274,7 +274,7 @@ class modUser extends DolibarrModules
$keyforelement = 'user';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
if (empty($conf->adherent->enabled)) {
if (!isModEnabled('adherent')) {
unset($this->export_fields_array[$r]['u.fk_member']);
unset($this->export_entities_array[$r]['u.fk_member']);
}

View File

@ -139,11 +139,11 @@ class InterfaceNotification extends DolibarrTriggers
$qualified = 0;
} elseif ($element == 'invoice_supplier' && !isModEnabled('supplier_invoice')) {
$qualified = 0;
} elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) {
} elseif ($element == 'withdraw' && !isModEnabled('prelevement')) {
$qualified = 0;
} elseif ($element == 'shipping' && empty($conf->expedition->enabled)) {
} elseif ($element == 'shipping' && !isModEnabled('expedition')) {
$qualified = 0;
} elseif ($element == 'member' && empty($conf->adherent->enabled)) {
} elseif ($element == 'member' && !isModEnabled('adherent')) {
$qualified = 0;
} elseif (($element == 'expense_report' || $element == 'expensereport') && empty($conf->expensereport->enabled)) {
$qualified = 0;

View File

@ -81,7 +81,7 @@ $error = 0;
$langs->loadLangs(array("main", "members", "companies", "install", "other", "errors"));
// Security check
if (empty($conf->adherent->enabled)) {
if (!isModEnabled('adherent')) {
httponly_accessforbidden('Module Membership not enabled');
}

View File

@ -53,7 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Security check
if (empty($conf->adherent->enabled)) {
if (!isModEnabled('adherent')) {
httponly_accessforbidden('Module Memebership no enabled');
}

View File

@ -49,7 +49,7 @@ if (is_numeric($entity)) {
require '../../main.inc.php';
// Security check
if (empty($conf->adherent->enabled)) {
if (!isModEnabled('adherent')) {
httponly_accessforbidden('Module Membership not enabled');
}

View File

@ -205,7 +205,7 @@ class CompanyBankAccount extends Account
$sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
$sql .= ",default_rib = ".((int) $this->default_rib);
if (!empty($conf->prelevement->enabled)) {
if (isModEnabled('prelevement')) {
$sql .= ",frstrecur = '".$this->db->escape($this->frstrecur)."'";
$sql .= ",rum = '".$this->db->escape($this->rum)."'";
$sql .= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null");

View File

@ -1440,7 +1440,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print_liste_field_titre("RIB");
print_liste_field_titre("IBAN");
print_liste_field_titre("BIC");
if (!empty($conf->prelevement->enabled)) {
if (isModEnabled('prelevement')) {
print_liste_field_titre("RUM");
print_liste_field_titre("DateRUM");
print_liste_field_titre("WithdrawMode");
@ -1530,7 +1530,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
print dol_escape_htmltag($rib->bic);
print '</td>';
if (!empty($conf->prelevement->enabled)) {
if (isModEnabled('prelevement')) {
// RUM
//print '<td>'.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).'</td>';
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($rib->rum).'">'.dol_escape_htmltag($rib->rum).'</td>';
@ -1695,7 +1695,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
//var_dump($src);
print '</td>';
if (!empty($conf->prelevement->enabled)) {
if (isModEnabled('prelevement')) {
// RUM
print '<td valign="middle">';
//var_dump($src);