Merge pull request #21861 from grandoc/new_branch_24_08_2022

FIX php8 compatibility
This commit is contained in:
Laurent Destailleur 2022-08-25 12:19:58 +02:00 committed by GitHub
commit c3f5b4b524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 104 additions and 103 deletions

View File

@ -186,12 +186,12 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print getTitleFieldOfList('Name', 0, $_SERVER['PHP_SELF'], 'name', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList('Name', 0, $_SERVER['PHP_SELF'], 'name', '', $param, '', $sortfield, $sortorder, '') . "\n";
print getTitleFieldOfList("Value", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print getTitleFieldOfList("Comment", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
if (!empty($conf->multicompany->enabled) && !$user->entity) {
print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ') . "\n";
if (isModEnabled('multicompany') && !$user->entity) {
print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ') . "\n";
}
print getTitleFieldOfList("", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print "</tr>\n";
@ -212,14 +212,14 @@ print '</td>';
print '<td>';
print '</td>';
// Limit to superadmin
if (!empty($conf->multicompany->enabled) && !$user->entity) {
if (isModEnabled('multicompany') && !$user->entity) {
print '<td>';
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
print '<input type="text" class="flat" size="1" name="entity" value="' . $conf->entity . '">';
print '</td>';
print '<td class="center">';
} else {
print '<td class="center">';
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
print '<input type="hidden" name="entity" value="' . $conf->entity . '">';
}
print '<input type="submit" class="button button-add small" name="add" value="'.$langs->trans("Add").'">';
print "</td>\n";
@ -281,7 +281,7 @@ if ($result) {
print '</td>';
// Entity limit to superadmin
if (!empty($conf->multicompany->enabled) && !$user->entity) {
if (isModEnabled('multicompany') && !$user->entity) {
print '<td>';
print '<input type="text" class="flat" size="1" name="const['.$i.'][entity]" value="'.((int) $obj->entity).'">';
print '</td>';

View File

@ -185,13 +185,13 @@ $message .= ajax_autoselect('webdavpublicurl');
$message .= '<br>';
if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) {
$urlEntity = (!empty($conf->multicompany->enabled) ? '?entity='.$conf->entity : '');
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank" rel="noopener noreferrer">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>';
$urlEntity = (isModEnabled('multicompany') ? '?entity=' . $conf->entity : '');
$url = '<a href="' . $urlwithroot . '/dav/fileserver.php/public/' . $urlEntity . '" target="_blank" rel="noopener noreferrer">' . $urlwithroot . '/dav/fileserver.php/public/' . $urlEntity . '</a>';
$message .= img_picto('', 'globe').' '.str_replace('{url}', $url, $langs->trans("WebDavServer", 'WebDAV public', ''));
$message .= '<div class="urllink"><input type="text" id="webdavurl" class="quatrevingtpercent" value="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'">';
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank" rel="noopener noreferrer">';
$message .= ' '.img_picto('', 'globe');
$message .= img_picto('', 'globe') . ' ' . str_replace('{url}', $url, $langs->trans("WebDavServer", 'WebDAV public', ''));
$message .= '<div class="urllink"><input type="text" id="webdavurl" class="quatrevingtpercent" value="' . $urlwithroot . '/dav/fileserver.php/public/' . $urlEntity . '">';
$message .= '<a href="' . $urlwithroot . '/dav/fileserver.php/public/' . $urlEntity . '" target="_blank" rel="noopener noreferrer">';
$message .= ' ' . img_picto('', 'globe');
$message .= '</a>';
$message .= '</div>';
$message .= ajax_autoselect('webdavurl');

View File

@ -306,7 +306,7 @@ if ($mode != 'focus' && $mode != 'mandatory') {
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
}
// Entity
if (!empty($conf->multicompany->enabled) && !$user->entity) {
if (isModEnabled('multicompany') && !$user->entity) {
print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,page', '', $param, '', $sortfield, $sortorder);
} else {
print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
@ -335,13 +335,13 @@ if ($mode != 'focus' && $mode != 'mandatory') {
print '</td>';
}
// Limit to superadmin
if (!empty($conf->multicompany->enabled) && !$user->entity) {
if (isModEnabled('multicompany') && !$user->entity) {
print '<td>';
print '<input type="text" class="flat" size="1" disabled name="entity" value="'.$conf->entity.'">'; // We see environment, but to change it we must switch on other entity
print '<input type="text" class="flat" size="1" disabled name="entity" value="' . $conf->entity . '">'; // We see environment, but to change it we must switch on other entity
print '</td>';
} else {
print '<td class="center">';
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
print '<input type="hidden" name="entity" value="' . $conf->entity . '">';
print '</td>';
}
print '<td class="center">';

View File

@ -172,7 +172,7 @@ if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
if ($action == 'update') {
foreach ($modules as $module => $delays) {
if (!empty($conf->$module->enabled)) {
if (isModEnabled('module')) {
foreach ($delays as $delay) {
if (GETPOST($delay['code']) != '') {
dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
@ -226,13 +226,13 @@ if ($action == 'edit') {
print '<td class="right">'.$langs->trans("LateWarningAfter").'</td></tr>';
foreach ($modules as $module => $delays) {
if (!empty($conf->$module->enabled)) {
if (isModEnabled('module')) {
foreach ($delays as $delay) {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall right">';
print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
print '<td width="20px">' . img_object('', $delay['img']) . '</td>';
print '<td>' . $langs->trans('Delays_' . $delay['code']) . '</td><td class="nowraponall right">';
print '<input class="right maxwidth75" type="number" name="' . $delay['code'] . '" value="' . $value . '"> ' . $langs->trans("days") . '</td></tr>';
}
}
}
@ -260,13 +260,13 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays) {
if (!empty($conf->$module->enabled)) {
if (isModEnabled('module')) {
foreach ($delays as $delay) {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
print '<td width="20px">' . img_object('', $delay['img']) . '</td>';
print '<td>' . $langs->trans('Delays_' . $delay['code']) . '</td>';
print '<td class="right">' . $value . ' ' . $langs->trans("days") . '</td></tr>';
}
}
}

View File

@ -37,7 +37,7 @@ include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
if (!$user->admin) {
accessforbidden();
}
if (empty($conf->emailcollector->enabled)) {
if (!isModEnabled('emailcollector')) {
accessforbidden();
}
@ -547,20 +547,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</tr>';
$arrayoftypes = array(
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'recordjoinpiece'=>'AttachJoinedDocumentsToObject',
'recordevent'=>'RecordEvent');
'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'recordjoinpiece' => 'AttachJoinedDocumentsToObject',
'recordevent' => 'RecordEvent'
);
$arrayoftypesnocondition = $arrayoftypes;
if (!empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$arrayoftypes['project'] = 'CreateLeadAndThirdParty';
}
$arrayoftypesnocondition['project'] = 'CreateLeadAndThirdParty';
if (!empty($conf->ticket->enabled)) {
if (isModEnabled('ticket')) {
$arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
}
$arrayoftypesnocondition['ticket'] = 'CreateTicketAndThirdParty';
if (!empty($conf->recruitment->enabled)) {
if (isModEnabled('recruitment')) {
$arrayoftypes['candidature'] = 'CreateCandidature';
}
$arrayoftypesnocondition['candidature'] = 'CreateCandidature';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2022 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -148,7 +148,7 @@ if ($action == 'updateMask') {
$res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
$res3 = 0;
if (!empty($conf->project->enabled) && GETPOSTISSET('EXPENSEREPORT_PROJECT_IS_REQUIRED')) { // Option may not be provided
if (isModEnabled('project') && GETPOSTISSET('EXPENSEREPORT_PROJECT_IS_REQUIRED')) { // Option may not be provided
$res3 = dolibarr_set_const($db, 'EXPENSEREPORT_PROJECT_IS_REQUIRED', GETPOST('EXPENSEREPORT_PROJECT_IS_REQUIRED', 'int'), 'chaine', 0, '', $conf->entity);
}
@ -471,7 +471,7 @@ print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htm
print '<input class="flat minwidth200" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('EXPENSEREPORT_DRAFT_WATERMARK')).'">';
print '</td></tr>'."\n";
if (!empty($conf->project->enabled)) {
if (isModEnabled('project')) {
print '<tr class="oddeven"><td>';
print $langs->trans('ProjectIsRequiredOnExpenseReports');
print '</td><td class="right">';

View File

@ -492,14 +492,14 @@ if ($action == 'edit') {
print '</td><td>';
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print '<textarea class="flat" name="' . $constname . '" id="' . $constname . '" cols="50" rows="5" wrap="soft">' . "\n";
print $conf->global->{$constname};
print "</textarea>\n";
} elseif ($val['type']== 'integer') {
print '<input class="flat" name="'.$constname.'" id="'.$constname.'" value="'.$conf->global->$constname.'" type="number" step="1" min="0" max="50" >' . "\n";
} elseif ($val['type']== 'html') {
} elseif ($val['type'] == 'integer') {
print '<input class="flat" name="' . $constname . '" id="' . $constname . '" value="' . $conf->global->$constname . '" type="number" step="1" min="0" max="50" >' . "\n";
} elseif ($val['type'] == 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
$doleditor->Create();
} elseif ($val['type'] == 'yesno') {
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
@ -532,25 +532,25 @@ if ($action == 'edit') {
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
print '<input required="required" type="text" class="flat" id="' . $constname . '" name="' . $constname . '" value="' . (GETPOST($constname, 'alpha') ? GETPOST($constname, 'alpha') : $conf->global->{$constname}) . '" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
print '&nbsp;' . img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token' . $constname . '" class="linkobject"');
}
// Add button to autosuggest a key
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
print dolJSToSetRandomPassword($constname, 'generate_token'.$constname);
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
print dolJSToSetRandomPassword($constname, 'generate_token' . $constname);
} elseif ($val['type'] == 'product') {
if (isModEnabled("product") || isModEnabled("service")) {
if (isModEnabled('product') || isModEnabled('service')) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
$form->select_produits($selected, $constname, '', 0);
}
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . $conf->global->{$constname} . '">';
}
print '</td></tr>';
}

View File

@ -208,12 +208,12 @@ if ($action == 'edit') {
print '</td><td>';
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print '<textarea class="flat" name="' . $constname . '" id="' . $constname . '" cols="50" rows="5" wrap="soft">' . "\n";
print $conf->global->{$constname};
print "</textarea>\n";
} elseif ($val['type']== 'html') {
} elseif ($val['type'] == 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
$doleditor->Create();
} elseif ($val['type'] == 'yesno') {
print $form->selectyesno($constname, $conf->global->{$constname}, 1);

View File

@ -158,24 +158,24 @@ if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && empty($conf->global->LDAP_USER
print '</td></tr>';
// Synchro contact active
if (isModEnabled("societe")) {
if (isModEnabled('societe')) {
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnContactActive").'</td><td>';
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_CONTACT_ACTIVE'), 'activecontact', array(Ldap::SYNCHRO_LDAP_TO_DOLIBARR));
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnContactActiveExample").'</span></td></tr>';
print '</td><td><span class="opacitymedium">' . $langs->trans("LDAPDnContactActiveExample") . '</span></td></tr>';
}
// Synchro member active
if (!empty($conf->adherent->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberActive").'</td><td>';
if (isModEnabled('adherent')) {
print '<tr class="oddeven"><td>' . $langs->trans("LDAPDnMemberActive") . '</td><td>';
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_MEMBER_ACTIVE'), 'activemembers', array(), 2);
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberActiveExample").'</span></td></tr>';
print '</td><td><span class="opacitymedium">' . $langs->trans("LDAPDnMemberActiveExample") . '</span></td></tr>';
}
// Synchro member type active
if (!empty($conf->adherent->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberTypeActive").'</td><td>';
if (isModEnabled('adherent')) {
print '<tr class="oddeven"><td>' . $langs->trans("LDAPDnMemberTypeActive") . '</td><td>';
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE'), 'activememberstypes', array(), 2);
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberTypeActiveExample").'</span></td></tr>';
print '</td><td><span class="opacitymedium">' . $langs->trans("LDAPDnMemberTypeActiveExample") . '</span></td></tr>';
}
// Fields from hook

View File

@ -36,7 +36,7 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09');
$currencycode = GETPOST('currencycode', 'alpha');
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
// When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default.
$currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
}
@ -105,12 +105,12 @@ print load_fiche_titre($title, '', 'title_setup');
$aCurrencies = array($conf->currency); // Default currency always first position
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/multicurrency.lib.php';
$sql = "SELECT rowid, code FROM ".MAIN_DB_PREFIX."multicurrency";
$sql .= " WHERE entity = ".((int) $conf->entity);
$sql .= " AND code <> '".$db->escape($conf->currency)."'"; // Default currency always first position
$sql = "SELECT rowid, code FROM " . MAIN_DB_PREFIX . "multicurrency";
$sql .= " WHERE entity = " . ((int) $conf->entity);
$sql .= " AND code <> '" . $db->escape($conf->currency) . "'"; // Default currency always first position
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
@ -129,11 +129,11 @@ print '<span class="opacitymedium">'.$langs->trans("LimitsDesc")."</span><br>\n"
print "<br>\n";
if ($action == 'edit') {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
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->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
print '<input type="hidden" name="currencycode" value="'.$currencycode.'">';
if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
print '<input type="hidden" name="currencycode" value="' . $currencycode . '">';
}
clearstatcache();
@ -194,7 +194,7 @@ if ($action == 'edit') {
print '</div>';
}
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
if (isModEnabled('multicompany') && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
if (!empty($aCurrencies) && count($aCurrencies) > 1) {
print dol_get_fiche_end();
}

View File

@ -26,7 +26,7 @@ require '../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
}
@ -76,7 +76,7 @@ if ($action == 'update') {
llxHeader();
$form = new Form($db);
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db);
}
@ -100,14 +100,14 @@ foreach ($list as $key) {
// Param
$label = $langs->trans($key);
print '<td><label for="'.$key.'">'.$label.'</label></td>';
print '<td><label for="' . $key . '">' . $label . '</label></td>';
// Value
print '<td>';
if (!empty($conf->accounting->enabled)) {
if (isModEnabled('accounting')) {
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
} else {
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . getDolGlobalString($key) . '">';
}
print '</td></tr>';
}

View File

@ -294,16 +294,16 @@ if ($action == 'edit') {
}
print '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="'.$mainserver.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="'.$mainserver.'">';
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
print ' <span class="opacitymedium smtp_method">'.$langs->trans("SeeLinkToOnlineDocumentation").'</span>';
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="' . $mainserver . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="' . $mainserver . '">';
print '<span id="smtp_server_mess" class="opacitymedium">' . $langs->trans("SeeLocalSendMailSetup") . '</span>';
print ' <span class="opacitymedium smtp_method">' . $langs->trans("SeeLinkToOnlineDocumentation") . '</span>';
} else {
$text = !empty($mainserver) ? $mainserver : $smtpserver;
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="'.$mainserver.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="' . $mainserver . '">';
}
print '</td>';
}
@ -326,15 +326,15 @@ if ($action == 'edit') {
}
print '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="'.$mainport.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="'.$mainport.'">';
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="' . $mainport . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="' . $mainport . '">';
print '<span id="smtp_port_mess" class="opacitymedium">' . $langs->trans("SeeLocalSendMailSetup") . '</span>';
} else {
$text = (!empty($mainport) ? $mainport : $smtpport);
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" value="'.$mainport.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" value="' . $mainport . '">';
}
}
print '</td></tr>';
@ -342,14 +342,14 @@ if ($action == 'edit') {
// ID
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
$mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_ID_EMAILING : '');
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
print '<tr class="drag drop oddeven hideifdefault"><td>' . $langs->trans("MAIN_MAIL_SMTPS_ID") . '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_EMAILING" size="32" value="'.$mainstmpid.'">';
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_EMAILING" size="32" value="' . $mainstmpid . '">';
} else {
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_EMAILING" value="'.$mainstmpid.'">';
print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_EMAILING" value="' . $mainstmpid . '">';
}
print '</td></tr>';
}
@ -357,14 +357,14 @@ if ($action == 'edit') {
// PW
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
$mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_PW_EMAILING : '');
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
print '<tr class="drag drop oddeven hideifdefault"><td>' . $langs->trans("MAIN_MAIL_SMTPS_PW") . '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="'.$mainsmtppw.'">';
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="' . $mainsmtppw . '">';
} else {
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_EMAILING" value="'.$mainsmtppw.'">';
print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_EMAILING" value="' . $mainsmtppw . '">';
}
print '</td></tr>';
}
@ -533,16 +533,16 @@ if ($action == 'edit') {
if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || !$linuxlike) {
if (function_exists('fsockopen') && $port && $server) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=testconnect">' . $langs->trans("DoTestServerAvailability") . '</a>';
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
print '<a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("FeatureNotAvailableOnLinux") . '">' . $langs->trans("DoTestServerAvailability") . '</a>';
}
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=test&amp;mode=init">' . $langs->trans("DoTestSend") . '</a>';
if (!empty($conf->fckeditor->enabled)) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&amp;mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
if (isModEnabled('fckeditor')) {
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=testhtml&amp;mode=init">' . $langs->trans("DoTestSendHTML") . '</a>';
}
}