Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-08-23 22:42:35 +02:00
commit e73f44e2aa
18 changed files with 52 additions and 31 deletions

View File

@ -313,7 +313,7 @@ print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_SUP
print '</td>';
print '</tr>';
if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') != '-1') {
if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') != '-1') {
print '<tr class="oddeven">';
print '<td>' . img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnSupplierDeposit") . '</td>';
if (getDolGlobalInt('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {

View File

@ -151,7 +151,7 @@ if ($id > 0) {
$object = new Adherent($db);
$result = $object->fetch($id);
if (!empty($conf->notification->enabled)) {
if (isModEnabled('notification')) {
$langs->load("mails");
}

View File

@ -271,7 +271,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$action = 'addsubscription';
} else {
// If an amount has been provided, we check also fields that becomes mandatory when amount is not null.
if (!empty($conf->banque->enabled) && GETPOST("paymentsave") != 'none') {
if (isModEnabled('banque') && GETPOST("paymentsave") != 'none') {
if (GETPOST("subscription")) {
if (!GETPOST("label")) {
$errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
@ -475,7 +475,7 @@ if ($rowid > 0) {
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
$rowspan++;
}
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
$rowspan++;
}
@ -571,7 +571,7 @@ if ($rowid > 0) {
print '<table class="border tableforfield centpercent">';
// Tags / Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
@ -589,7 +589,7 @@ if ($rowid > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Third party Dolibarr
if (!empty($conf->societe->enabled)) {
if (isModEnabled('societe')) {
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrThirdParty");
@ -718,7 +718,7 @@ if ($rowid > 0) {
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
}
print "</tr>\n";
@ -753,7 +753,7 @@ if ($rowid > 0) {
print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n";
print '<td class="right">'.price($objp->subscription).'</td>';
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print '<td class="right">';
if ($objp->bid) {
$accountstatic->label = $objp->label;
@ -762,7 +762,7 @@ if ($rowid > 0) {
$accountstatic->account_number = $objp->account_number;
$accountstatic->currency_code = $objp->currency_code;
if (!empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0) {
if (isModEnabled('accounting') && $objp->fk_accountancy_journal > 0) {
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->fk_accountancy_journal);
@ -782,7 +782,7 @@ if ($rowid > 0) {
if (empty($num)) {
$colspan = 6;
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
@ -797,7 +797,7 @@ if ($rowid > 0) {
if (($action != 'addsubscription' && $action != 'create_thirdparty')) {
// Shon online payment link
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
$useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox'));
if ($useonlinepayment) {
print '<br>';
@ -831,11 +831,11 @@ if ($rowid > 0) {
$bankviainvoice = 1;
}
} else {
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) {
$bankviainvoice = 1;
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) {
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && isModEnabled('banque')) {
$bankdirect = 1;
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) {
$invoiceonly = 1;
}
}
@ -982,7 +982,7 @@ if ($rowid > 0) {
print '"></td></tr>';
// Complementary action
if ((!empty($conf->banque->enabled) || isModEnabled('facture')) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) {
if ((isModEnabled('banque') || isModEnabled('facture')) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) {
$company = new Societe($db);
if ($object->fk_soc) {
$result = $company->fetch($object->fk_soc);
@ -998,12 +998,12 @@ if ($rowid > 0) {
print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice) ? ' checked' : '').'>';
print '<label for="none"> '.$langs->trans("None").'</label><br>';
// Add entry into bank accoun
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(!empty($bankdirect) ? ' checked' : '');
print '><label for="bankdirect"> '.$langs->trans("MoreActionBankDirect").'</label><br>';
}
// Add invoice with no payments
if (!empty($conf->societe->enabled) && isModEnabled('facture')) {
if (isModEnabled('societe') && isModEnabled('facture')) {
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ? ' checked' : '');
//if (empty($object->fk_soc)) print ' disabled';
print '><label for="invoiceonly"> '.$langs->trans("MoreActionInvoiceOnly");
@ -1022,7 +1022,7 @@ if ($rowid > 0) {
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
}
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (isModEnabled('product') || isModEnabled('service'))) {
$prodtmp = new Product($db);
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
if ($result < 0) {
@ -1033,7 +1033,7 @@ if ($rowid > 0) {
print '</label><br>';
}
// Add invoice with payments
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
if (isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) {
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(!empty($bankviainvoice) ? ' checked' : '');
//if (empty($object->fk_soc)) print ' disabled';
print '><label for="bankviainvoice"> '.$langs->trans("MoreActionBankViaInvoice");
@ -1052,7 +1052,7 @@ if ($rowid > 0) {
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
}
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (isModEnabled('product')|| isModEnabled('service'))) {
$prodtmp = new Product($db);
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
if ($result < 0) {

View File

@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09');
*/
// Shipment note
if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
if (isModEnabled('expedition') && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
}

View File

@ -142,7 +142,7 @@ $permissiontodelete = $user->admin;
if (!$user->admin) {
accessforbidden();
}
if (empty($conf->emailcollector->enabled)) {
if (!isModEnabled('emailcollector')) {
accessforbidden('Module not enabled');
}

View File

@ -637,7 +637,7 @@ print "</tr>\n";
print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
print "<td>";
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
$sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE clos = 0";

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
$langs->loadLangs(array('admin', 'multicurrency'));
// Access control
if (!$user->admin || empty($conf->multicurrency->enabled)) {
if (!$user->admin || !isModEnabled('multicurrency')) {
accessforbidden();
}

View File

@ -102,7 +102,7 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
if (!empty($conf->propal->enabled)) {
if (isModEnabled('propal')) {
print load_fiche_titre($langs->trans("Proposal"), '', '');
print '<div class="div-table-responsive-no-min">';

View File

@ -47,7 +47,7 @@ $type = 'reception';
* Actions
*/
if (!empty($conf->reception->enabled) && empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
if (isModEnabled('reception') && empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_RECEPTION", "1", 'chaine', 0, '', $conf->entity);
}

View File

@ -498,7 +498,7 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
print "</td></tr>\n";
print '</form>';
if (!empty($conf->banque->enabled)) {
if (isModEnabled('banque')) {
print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td class="right">';
if (!empty($conf->use_javascript_ajax)) {

View File

@ -293,7 +293,7 @@ print '<option value="'.LOG_DEBUG.'" '.($conf->global->SYSLOG_LEVEL >= LOG_DEBUG
print '</select>';
print '</td></tr>';
if (!empty($conf->loghandlers['mod_syslog_file']) && !empty($conf->cron->enabled)) {
if (!empty($conf->loghandlers['mod_syslog_file']) && isModEnabled('cron')) {
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogFileNumberOfSaves").'</td>';
print '<td colspan="2"><input type="number" name="file_saves" placeholder="14" min="0" step="1" value="'.getDolGlobalString('SYSLOG_FILE_SAVES').'" />';
print ' (<a href="'.dol_buildpath('/cron/list.php', 1).'?search_label=CompressSyslogs&status=-1">'.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').'</a>)</td></tr>';

View File

@ -539,7 +539,7 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp
print '</td>';
print '</tr>';
if (! empty($conf->product->enabled)) {
if (isModEnabled('product')) {
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
print '<td class="left">';
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');

View File

@ -109,7 +109,7 @@ $tabrowid[1] = "";
// Condition to show dictionary in setup page
$tabcond = array();
$tabcond[1] = (!empty($conf->website->enabled));
$tabcond[1] = (isModEnabled('website'));
// List of help for fields
$tabhelp = array();

View File

@ -1163,6 +1163,14 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
//#21654: add account number used for the debit
if ($object->mode_reglement_code == "PRE") {
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $object->thirdparty->id);
$iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
$lib_mode_reg .= $langs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
}
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
$posy = $pdf->GetY();

View File

@ -1271,6 +1271,16 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
//#21654: add account number used for the debit
if ($object->mode_reglement_code == "PRE") {
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $object->thirdparty->id);
$iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
$lib_mode_reg .= $langs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
}
$pdf->MultiCell($posxend - $posxval, 5, $lib_mode_reg, 0, 'L');
$posy = $pdf->GetY();
@ -1291,6 +1301,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
global $langs;

View File

@ -446,6 +446,7 @@ ErrorPaymentConditionsNotEligibleToDepositCreation=The chose payment conditions
PaymentTypeVIR=Bank transfer
PaymentTypeShortVIR=Bank transfer
PaymentTypePRE=Direct debit payment order
PaymentTypePREdetails=(on account *-%s)
PaymentTypeShortPRE=Debit payment order
PaymentTypeLIQ=Cash
PaymentTypeShortLIQ=Cash
@ -620,4 +621,4 @@ NoPaymentAvailable=No payment available for %s
PaymentRegisteredAndInvoiceSetToPaid=Payment registered and invoice %s set to paid
SendEmailsRemindersOnInvoiceDueDate=Send reminder by email for unpaid invoices
MakePaymentAndClassifyPayed=Record payment
BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status)
BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status)

View File

@ -437,6 +437,7 @@ VarAmountAllLines=Montant variable (%% tot.) - toutes les lignes identiques
PaymentTypeVIR=Virement bancaire
PaymentTypeShortVIR=Virement bancaire
PaymentTypePRE=Ordre de prélèvement
PaymentTypePREdetails=(compte *-%s)
PaymentTypeShortPRE=Ordre de prélèvement
PaymentTypeLIQ=Espèce
PaymentTypeShortLIQ=Espèce