Merge pull request #22075 from grandoc/new_branch_04_09_2022

update code
This commit is contained in:
Laurent Destailleur 2022-09-09 18:03:43 +02:00 committed by GitHub
commit cf887dba16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 88 additions and 88 deletions

View File

@ -514,7 +514,7 @@ $tabcond[27] = isModEnabled("societe");
$tabcond[28] = isModEnabled('holiday');
$tabcond[29] = isModEnabled('project');
$tabcond[30] = isModEnabled('label');
//$tabcond[31]= !empty($conf->accounting->enabled);
//$tabcond[31]= isModEnabled('accounting');
$tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm'));
$tabcond[33] = isModEnabled('hrm');
$tabcond[34] = isModEnabled('hrm');
@ -2077,7 +2077,7 @@ if ($id > 0) {
} elseif (in_array($value, array('recuperableonly'))) {
$class = "center";
} elseif ($value == 'accountancy_code' || $value == 'accountancy_code_sell' || $value == 'accountancy_code_buy') {
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
$tmpaccountingaccount = new AccountingAccount($db);
$tmpaccountingaccount->fetch(0, $valuetoshow, 1);
@ -2486,7 +2486,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '</td>';
} elseif ($value == 'accountancy_code' || $value == 'accountancy_code_sell' || $value == 'accountancy_code_buy') {
print '<td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$fieldname = $value;
$accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0);
print $formaccounting->select_account($accountancy_account, '.'. $value, 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');

View File

@ -66,7 +66,7 @@ $conditions = array(
'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")),
'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('supplier_proposal') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")),
'USERSIGN' => 1,
'MAILING' => !empty($conf->mailing->enabled),
'MAILING' => isModEnabled('mailing'),
'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')),
'TICKET' => !empty($conf->ticket->enabled),
);

View File

@ -531,7 +531,7 @@ if ($action == 'edit') {
}
} elseif ($val['type'] == 'accountancy_code') {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$formaccounting = new FormAccounting($db);
print $formaccounting->select_account($selected, $constname, 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
@ -540,7 +540,7 @@ if ($action == 'edit') {
}
} elseif ($val['type'] == 'accountancy_category') {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print '<input type="text" name="' . $constname . '" list="pcg_type_datalist" value="' . $selected . '">';
// autosuggest from existing account types if found
print '<datalist id="pcg_type_datalist">';
@ -637,7 +637,7 @@ if ($action == 'edit') {
setEventMessages(null, $object->errors, "errors");
}
} elseif ($val['type'] == 'accountancy_code') {
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $conf->global->{$constname}, 1);

View File

@ -34,7 +34,7 @@ if (!is_object($form)) {
$form = new Form($db);
}
if (!empty($conf->accounting->enabled) && !is_object($formaccounting)) {
if (isModEnabled('accounting') && !is_object($formaccounting)) {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$formaccounting = new FormAccounting($db);
}
@ -66,7 +66,7 @@ if (empty($reshook)) {
$html_name = $mode_key . '_' . $field_key;
print '<tr><td class="titlefieldcreate">' . $langs->trans($field_info['label']) . '</td><td colspan="3">';
$accountancy_code = GETPOSTISSET($html_name) ? GETPOST($html_name, 'aZ09') : (!empty($assetaccountancycodes->accountancy_codes[$mode_key][$field_key]) ? $assetaccountancycodes->accountancy_codes[$mode_key][$field_key] : '');
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print $formaccounting->select_account($accountancy_code, $html_name, 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
} else {
print '<input name="' . $html_name . '" class="maxwidth200" value="' . dol_escape_htmltag($accountancy_code) . '">';

View File

@ -50,7 +50,7 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
if (isModEnabled('accounting')) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
foreach ($assetaccountancycodes->accountancy_codes_fields as $mode_key => $mode_info) {
//if (empty($object->enabled_modes[$mode_key])) continue;
@ -63,7 +63,7 @@ if (empty($reshook)) {
print '<tr><td class="titlefieldcreate">' . $langs->trans($field_info['label']) . '</td><td colspan="3">';
if (!empty($assetaccountancycodes->accountancy_codes[$mode_key][$field_key])) {
$accountancy_code = $assetaccountancycodes->accountancy_codes[$mode_key][$field_key];
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $accountancy_code, 1);

View File

@ -180,7 +180,7 @@ abstract class ActionsContactCardCommon
if ($action == 'view' || $action == 'edit' || $action == 'delete') {
// Emailing
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
}

View File

@ -249,7 +249,7 @@ if (empty($reshook)) {
$action = 'create';
}
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) {
if (isModEnabled('mailing') && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
$action = 'create';
@ -290,7 +290,7 @@ if (empty($reshook)) {
}
}
if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) {
if (empty($error) && isModEnabled('mailing') && !empty($object->email)) {
// Add mass emailing flag into table mailing_unsubscribe
$result = $object->setNoEmail($object->no_email);
if ($result < 0) {
@ -342,7 +342,7 @@ if (empty($reshook)) {
$action = 'edit';
}
if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
if (isModEnabled('mailing') && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email"));
$action = 'edit';
@ -830,7 +830,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</tr>';
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) {
print "\n".'<script type="text/javascript">'."\n";
print '$(document).ready(function () {
@ -1101,7 +1101,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<td>';
print img_picto('', 'object_email');
print '<input type="text" name="email" id="email" class="maxwidth100onsmartphone quatrevingtpercent" value="'.(GETPOSTISSET('email') ?GETPOST('email', 'alpha') : $object->email).'"></td>';
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$langs->load("mails");
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsSend").'</td>';
print '<td>'.$object->getNbOfEMailings().'</td>';
@ -1111,7 +1111,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</tr>';
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
if ($conf->use_javascript_ajax && isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) {
print "\n".'<script type="text/javascript">'."\n";
@ -1376,14 +1376,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("PostOrFunction").'</td><td>'.$object->poste.'</td></tr>';
// Email
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$langs->load("mails");
print '<tr><td>'.$langs->trans("NbOfEMailingsSend").'</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?filteremail='.urlencode($object->email).'">'.$object->getNbOfEMailings().'</a></td></tr>';
}
// Unsubscribe opt-out
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$result = $object->getNoEmail();
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -344,7 +344,7 @@ class Contact extends CommonObject
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
$this->fields['rowid']['visible'] = 0;
}
if (empty($conf->mailing->enabled)) {
if (!isModEnabled('mailing')) {
$this->fields['no_email']['enabled'] = 0;
}
// typical ['s.nom'] is used for third-parties

View File

@ -78,7 +78,7 @@ $search_phone_pro = GETPOST("search_phone_pro", 'alpha');
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_fax = GETPOST("search_fax", 'alpha');
$search_email = GETPOST("search_email", 'alpha');
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$search_no_email = GETPOSTISSET("search_no_email") ? GETPOST("search_no_email", 'int') : -1;
} else {
$search_no_email = -1;
@ -218,7 +218,7 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
$arrayfields['unsubscribed'] = array(
'label'=>'No_Email',
'checked'=>0,
'enabled'=>(!empty($conf->mailing->enabled)),
'enabled'=>(isModEnabled('mailing')),
'position'=>111);
if (isModEnabled('socialnetworks')) {
@ -385,7 +385,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
if (!empty($conf->mailing->enabled)) {
if (isModEnabled('mailing')) {
$sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed";
}
// Add fields from hooks

View File

@ -2272,7 +2272,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
// Add if object was dispatched "into accountancy"
if (!empty($conf->accounting->enabled) && in_array($object->element, array('bank', 'paiementcharge', 'facture', 'invoice', 'invoice_supplier', 'expensereport', 'payment_various'))) {
if (isModEnabled('accounting') && in_array($object->element, array('bank', 'paiementcharge', 'facture', 'invoice', 'invoice_supplier', 'expensereport', 'payment_various'))) {
// Note: For 'chargesociales', 'salaries'... this is the payments that are dispatched (so element = 'bank')
if (method_exists($object, 'getVentilExportCompta')) {
$accounted = $object->getVentilExportCompta();

View File

@ -440,7 +440,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
}
// Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing.
if (!empty($conf->mailing->enabled) && !empty($objcon->email)
if (isModEnabled('mailing') && !empty($objcon->email)
&& (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) {
$langs->load("mails");
@ -565,7 +565,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out = info_admin($langs->trans("WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv("Module2400Name")), 0, 0, 'warning');
}
if (isModEnabled('agenda') || (!empty($conf->mailing->enabled) && !empty($objcon->email))) {
if (isModEnabled('agenda') || (isModEnabled('mailing') && !empty($objcon->email))) {
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';

View File

@ -248,7 +248,7 @@ if ($user->rights->fournisseur->lire && $line->fk_fournprice > 0 && empty($conf-
}
}
if (!empty($conf->accounting->enabled) && $line->fk_accounting_account > 0) {
if (isModEnabled('accounting') && $line->fk_accounting_account > 0) {
$accountingaccount = new AccountingAccount($this->db);
$accountingaccount->fetch($line->fk_accounting_account);
print '<div class="clearboth"></div><br><span class="opacitymedium">'.$langs->trans('AccountingAffectation').' : </span>'.$accountingaccount->getNomUrl(0, 1, 1);

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
}
@ -169,7 +169,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
$dir = "../../core/modules/dons/";
$form = new Form($db);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db);
}
@ -335,7 +335,7 @@ print '<td>';
$label = $langs->trans("AccountAccounting");
print '<label for="DONATION_ACCOUNTINGACCOUNT">'.$label.'</label></td>';
print '<td class="center">';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print $formaccounting->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT, 'DONATION_ACCOUNTINGACCOUNT', 1, '', 1, 1);
} else {
print '<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="'.$conf->global->DONATION_ACCOUNTINGACCOUNT.'">';

View File

@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
}
@ -1990,7 +1990,7 @@ if ($action == 'create') {
$bankaccountstatic->label = $objp->baref;
$bankaccountstatic->number = $objp->banumber;
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$bankaccountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db);
@ -2122,7 +2122,7 @@ if ($action == 'create') {
}
$titlealt = '';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
$accountingaccount = new AccountingAccount($db);
$resaccountingaccount = $accountingaccount->fetch(0, $line->type_fees_accountancy_code, 1);

View File

@ -40,10 +40,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
}

View File

@ -1212,13 +1212,13 @@ class ProductFournisseur extends Product
}
}
if (!empty($conf->accounting->enabled) && $this->status) {
if (isModEnabled('accounting') && $this->status) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= '<br><b>'.$langs->trans('ProductAccountancySellCode').':</b> '.length_accountg($this->accountancy_code_sell);
$label .= '<br><b>'.$langs->trans('ProductAccountancySellIntraCode').':</b> '.length_accountg($this->accountancy_code_sell_intra);
$label .= '<br><b>'.$langs->trans('ProductAccountancySellExportCode').':</b> '.length_accountg($this->accountancy_code_sell_export);
}
if (!empty($conf->accounting->enabled) && $this->status_buy) {
if (isModEnabled('accounting') && $this->status_buy) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyCode').':</b> '.length_accountg($this->accountancy_code_buy);
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyIntraCode').':</b> '.length_accountg($this->accountancy_code_buy_intra);

View File

@ -58,7 +58,7 @@ if (isModEnabled('project')) {
if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
}
@ -3337,7 +3337,7 @@ if ($action == 'create') {
$bankaccountstatic->label = $objp->baref;
$bankaccountstatic->number = $objp->banumber;
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$bankaccountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db);

View File

@ -29,10 +29,10 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
}
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -245,7 +245,7 @@ if (empty($reshook)) {
$form = new Form($db);
$formproject = new FormProjets($db);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db);
}
@ -342,7 +342,7 @@ if ($action == 'create') {
print '</td></tr>';
// Accountancy
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
// Accountancy_account_capital
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("LoanAccountancyCapitalCode").'</td>';
print '<td>';
@ -533,7 +533,7 @@ if ($id > 0) {
print $langs->trans("LoanAccountancyCapitalCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 1, 1);
} else {
print '<input name="accountancy_account_capital" size="16" value="'.$object->account_capital.'">';
@ -544,7 +544,7 @@ if ($id > 0) {
print $langs->trans("LoanAccountancyCapitalCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->account_capital, 1);
@ -564,7 +564,7 @@ if ($id > 0) {
print $langs->trans("LoanAccountancyInsuranceCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 1, 1);
} else {
print '<input name="accountancy_account_insurance" size="16" value="'.$object->account_insurance.'">';
@ -575,7 +575,7 @@ if ($id > 0) {
print $langs->trans("LoanAccountancyInsuranceCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->account_insurance, 1);
@ -595,7 +595,7 @@ if ($id > 0) {
print $langs->trans("LoanAccountancyInterestCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 1, 1);
} else {
print '<input name="accountancy_account_interest" size="16" value="'.$object->account_interest.'">';
@ -606,7 +606,7 @@ if ($id > 0) {
print $langs->trans("LoanAccountancyInterestCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->account_interest, 1);

View File

@ -65,7 +65,7 @@ if (isModEnabled('facture')) {
if (isModEnabled('commande')) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
@ -1203,7 +1203,7 @@ $form = new Form($db);
$formfile = new FormFile($db);
$formproduct = new FormProduct($db);
$formcompany = new FormCompany($db);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db);
}
@ -1673,7 +1673,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border centpercent">';
if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) {
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
// Accountancy_code_sell
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td>';
@ -2187,7 +2187,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border centpercent">';
if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) {
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
// Accountancy_code_sell
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td>';
@ -2388,7 +2388,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancySellCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if (!empty($object->accountancy_code_sell)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->accountancy_code_sell, 1);
@ -2405,7 +2405,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancySellIntraCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if (!empty($object->accountancy_code_sell_intra)) {
$accountingaccount2 = new AccountingAccount($db);
$accountingaccount2->fetch('', $object->accountancy_code_sell_intra, 1);
@ -2422,7 +2422,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancySellExportCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if (!empty($object->accountancy_code_sell_export)) {
$accountingaccount3 = new AccountingAccount($db);
$accountingaccount3->fetch('', $object->accountancy_code_sell_export, 1);
@ -2438,7 +2438,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancyBuyCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if (!empty($object->accountancy_code_buy)) {
$accountingaccount4 = new AccountingAccount($db);
$accountingaccount4->fetch('', $object->accountancy_code_buy, 1);
@ -2455,7 +2455,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancyBuyIntraCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if (!empty($object->accountancy_code_buy_intra)) {
$accountingaccount5 = new AccountingAccount($db);
$accountingaccount5->fetch('', $object->accountancy_code_buy_intra, 1);
@ -2472,7 +2472,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancyBuyExportCode");
print '</td><td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if (!empty($object->accountancy_code_buy_export)) {
$accountingaccount6 = new AccountingAccount($db);
$accountingaccount6->fetch('', $object->accountancy_code_buy_export, 1);

View File

@ -4985,7 +4985,7 @@ class Product extends CommonObject
$label .= "<br><b>".$langs->trans("PMPValue").'</b>: '.price($this->pmp, 0, '', 1, -1, -1, $conf->currency);
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if ($this->status && isset($this->accountancy_code_sell)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= '<br>';

View File

@ -1292,7 +1292,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
// Accounting Report
/*
$accouting_module_activated = !empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled);
$accouting_module_activated = !empty($conf->comptabilite->enabled) || isModEnabled('accounting');
if ($accouting_module_activated && $object->statut != Project::STATUS_DRAFT) {
$start = dol_getdate((int) $object->date_start);
$end = dol_getdate((int) $object->date_end);

View File

@ -714,7 +714,7 @@ foreach ($profid as $key => $val) {
$i++;
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans('CustomerAccountancyCodeShort')."</td>\n";
print '<td colspan="2"></td>';

View File

@ -50,13 +50,13 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if (isModEnabled('adherent')) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
}
if (isModEnabled('eventorganization')) {
@ -80,7 +80,7 @@ if (!empty($conf->incoterm->enabled)) {
if (!empty($conf->notification->enabled)) {
$langs->load("mails");
}
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$langs->load("products");
}
@ -425,12 +425,12 @@ if (empty($reshook)) {
$error++;
}
if (!empty($conf->mailing->enabled) && !empty($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
if (isModEnabled('mailing') && !empty($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors');
}
if (!empty($conf->mailing->enabled) && GETPOST("private", 'int') == 1 && !empty($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
if (isModEnabled('mailing') && GETPOST("private", 'int') == 1 && !empty($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors');
}
@ -990,7 +990,7 @@ $form = new Form($db);
$formfile = new FormFile($db);
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db);
}
@ -1616,13 +1616,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Email / Web
print '<tr><td>'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', empty($conf->global->SOCIETE_EMAIL_MANDATORY) ? '' : $conf->global->SOCIETE_EMAIL_MANDATORY).'</td>';
print '<td'.(($conf->browser->layout == 'phone') || empty($conf->mailing->enabled) ? ' colspan="3"' : '').'>'.img_picto('', 'object_email', 'class="pictofixedwidth"').' <input type="text" class="maxwidth200 widthcentpercentminusx" name="email" id="email" value="'.$object->email.'"></td>';
if (!empty($conf->mailing->enabled) && !empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
print '<td'.(($conf->browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.img_picto('', 'object_email', 'class="pictofixedwidth"').' <input type="text" class="maxwidth200 widthcentpercentminusx" name="email" id="email" value="'.$object->email.'"></td>';
if (isModEnabled('mailing') && !empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
if ($conf->browser->layout == 'phone') {
print '</tr><tr>';
}
print '<td class="individualline noemail">'.$form->editfieldkey($langs->trans('No_Email') .' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).'</td>';
print '<td class="individualline" '.(($conf->browser->layout == 'phone') || empty($conf->mailing->enabled) ? ' colspan="3"' : '').'>'.$form->selectyesno('contact_no_email', (GETPOSTISSET("contact_no_email") ? GETPOST("contact_no_email", 'alpha') : (empty($object->no_email) ? 0 : 1)), 1, false, 1).'</td>';
print '<td class="individualline" '.(($conf->browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.$form->selectyesno('contact_no_email', (GETPOSTISSET("contact_no_email") ? GETPOST("contact_no_email", 'alpha') : (empty($object->no_email) ? 0 : 1)), 1, false, 1).'</td>';
}
print '</tr>';
print '<tr><td>'.$form->editfieldkey('Web', 'url', '', $object, 0).'</td>';
@ -1892,7 +1892,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<table class="border" width="100%">';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
// Accountancy_code_sell
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td>';
@ -2669,7 +2669,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<br>';
print '<table class="border centpercent">';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
// Accountancy_code_sell
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td>';
@ -3113,7 +3113,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancySellCode");
print '</td><td colspan="2">';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if (!empty($object->accountancy_code_sell)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->accountancy_code_sell, 1);
@ -3129,7 +3129,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="nowrap">';
print $langs->trans("ProductAccountancyBuyCode");
print '</td><td colspan="2">';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
if (!empty($object->accountancy_code_buy)) {
$accountingaccount2 = new AccountingAccount($db);
$accountingaccount2->fetch('', $object->accountancy_code_buy, 1);

View File

@ -1097,7 +1097,7 @@ class Societe extends CommonObject
}
}
if (empty($error) && !empty($conf->mailing->enabled) && !empty($contact->email) && isset($no_email)) {
if (empty($error) && isModEnabled('mailing') && !empty($contact->email) && isset($no_email)) {
$result = $contact->setNoEmail($no_email);
if ($result < 0) {
$this->error = $contact->error;
@ -2711,10 +2711,10 @@ class Societe extends CommonObject
if (!empty($this->code_fournisseur) && $this->fournisseur) {
$label2 .= '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur;
}
if (!empty($conf->accounting->enabled) && ($this->client == 1 || $this->client == 3)) {
if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) {
$label2 .= '<br><b>'.$langs->trans('CustomerAccountancyCode').':</b> '.($this->code_compta ? $this->code_compta : $this->code_compta_client);
}
if (!empty($conf->accounting->enabled) && $this->fournisseur) {
if (isModEnabled('accounting') && $this->fournisseur) {
$label2 .= '<br><b>'.$langs->trans('SupplierAccountancyCode').':</b> '.$this->code_compta_fournisseur;
}
$label .= ($label2 ? '<br>'.$label2 : '').'</div>';

View File

@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
}

View File

@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
}

View File

@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
}

View File

@ -574,7 +574,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
}
// Accountancy code
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
print '<td>'.$object->accountancy_code.'</td></tr>';
}

View File

@ -1156,7 +1156,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// Accountancy code
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
print '<td>';
print '<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(GETPOST('accountancy_code', 'alphanohtml')).'">';
@ -2541,7 +2541,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// Accountancy code
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print "<tr>";
print '<td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
print '<td>';

View File

@ -202,7 +202,7 @@ if (isModEnabled("product") || isModEnabled("service")) {
if (isModEnabled("propal") || isModEnabled('commande') || !empty($conf->ficheinter->enabled) || isModEnabled('contrat')) {
$tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea';
}
if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) {
if (!empty($conf->comptabilite->enabled) || isModEnabled('accounting')) {
$tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea';
}
if (isModEnabled('adherent')) {

View File

@ -83,7 +83,7 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
print __METHOD__." module accouting must be enabled.\n"; exit(-1);
}