use isModEnabled
This commit is contained in:
parent
1d634557ce
commit
2f4fe9d619
@ -40,7 +40,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';
|
||||
@ -203,10 +203,10 @@ $arrayfields = array(
|
||||
'c.fk_warehouse'=>array('label'=>'Warehouse', 'checked'=>0, 'enabled'=>(empty($conf->stock->enabled) && empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER) ? 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),
|
||||
@ -338,7 +338,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);
|
||||
@ -1402,7 +1402,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'])
|
||||
|
||||
@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
if (isModEnabled("banque")) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
}
|
||||
if (!empty($conf->margin->enabled)) {
|
||||
if (isModEnabled('margin')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ if ($resql) {
|
||||
print '<td>'.$langs->trans('Entity').'</td>';
|
||||
}
|
||||
//Add Margin
|
||||
if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
print '<td class="right">'.$langs->trans('Margin').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';
|
||||
@ -455,7 +455,7 @@ if ($resql) {
|
||||
$invoice->fetch($objp->facid);
|
||||
|
||||
// Add Margin
|
||||
if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
$formmargin = new FormMargin($db);
|
||||
$marginInfo = array();
|
||||
$invoice->fetch_lines();
|
||||
@ -489,7 +489,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// Add margin
|
||||
if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
print '<td class="right">'.price($marginInfo['total_margin']).'</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -1966,7 +1966,7 @@ if ($action == 'create') {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nohover">'.$langs->trans("Comment").'</td><td colspan="3" class="nohover" colspan="'.($conf->margin->enabled ? 4 : 3).'"><input type="text" class="minwidth300" name="comment" value="'.dol_escape_htmltag(GETPOST("comment", 'alphanohtml')).'"></td>';
|
||||
print '<td class="nohover">'.$langs->trans("Comment").'</td><td colspan="3" class="nohover" colspan="'.(isModEnabled('margin') ? 4 : 3).'"><input type="text" class="minwidth300" name="comment" value="'.dol_escape_htmltag(GETPOST("comment", 'alphanohtml')).'"></td>';
|
||||
print '<td class="nohover right">';
|
||||
print '<input type="submit" class="button" name="activate" value="'.$langs->trans("Activate").'"> ';
|
||||
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
@ -137,7 +137,7 @@ if (!isset($form) || !is_object($form)) {
|
||||
}
|
||||
|
||||
// Link to module builder
|
||||
if (!empty($conf->modulebuilder->enabled)) {
|
||||
if (isModEnabled('modulebuilder')) {
|
||||
$text = '<a href="'.DOL_URL_ROOT.'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="modulebuilder">';
|
||||
//$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
|
||||
$text .= '<span class="fa fa-bug atoplogin"></span>';
|
||||
|
||||
@ -113,7 +113,7 @@ class modMargin extends DolibarrModules
|
||||
'url'=>'/margin/index.php',
|
||||
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>100,
|
||||
'enabled'=>'$conf->margin->enabled', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
||||
'enabled'=>'isModEnabled("margin")', // Define condition to show or hide menu entry. Use '$conf->monmodule->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'$user->rights->margins->liretous', // Use 'perms'=>'$user->rights->monmodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
|
||||
@ -77,7 +77,7 @@ if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
if (empty($user->rights->fournisseur->lire) && (empty($conf->margin->enabled) && !$user->hasRight("margin", "liretous"))) {
|
||||
if (empty($user->rights->fournisseur->lire) && (!isModEnabled('margin') && !$user->hasRight("margin", "liretous"))) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -1770,8 +1770,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
/* Not for supplier proposals
|
||||
if ($soc->outstanding_limit)
|
||||
{
|
||||
if ($soc->outstanding_limit) {
|
||||
// Outstanding Bill
|
||||
print '<tr><td>';
|
||||
print $langs->trans('OutstandingBill');
|
||||
@ -1861,8 +1860,8 @@ if ($action == 'create') {
|
||||
print '</table>';
|
||||
|
||||
// Margin Infos
|
||||
/*if (!empty($conf->margin->enabled)) {
|
||||
$formmargin->displayMarginInfos($object);
|
||||
/*if (isModEnabled('margin')) {
|
||||
$formmargin->displayMarginInfos($object);
|
||||
}*/
|
||||
|
||||
print '</div>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user