Fix selection must depends on enabled modules

This commit is contained in:
Laurent Destailleur 2021-01-04 13:32:43 +01:00
parent 5c104e344c
commit 8df5928e9c

View File

@ -549,16 +549,17 @@ if (!empty($conf->multicompany->enabled) && is_object($mc))
print '<br>'; print '<br>';
$listofchoices = array( $listofchoices = array(
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills'), 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => !empty($conf->facture->enabled)),
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills'), 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled)),
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'), 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled)),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'), 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled)),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'), 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled)),
'selectsocialcontributions'=>array('label'=>'SocialContributions'), 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => !empty($conf->salaries->enabled)),
'selectvariouspayment'=>array('label'=>'VariousPayment'), 'selectvariouspayment'=>array('label'=>'VariousPayment', 'enabled' => !empty($conf->banque->enabled)),
'selectloanspayment'=>array('label'=>'PaymentLoan'), 'selectloanspayment'=>array('label'=>'PaymentLoan', 'enabled' => !empty($conf->loan->enabled)),
); );
foreach ($listofchoices as $choice => $val) { foreach ($listofchoices as $choice => $val) {
if (empty($val['enabled'])) continue; // list not qualified
$checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : ''); $checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : '');
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>'; print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
} }