Fix warning when setup not complete.

This commit is contained in:
Laurent Destailleur 2020-11-30 19:14:18 +01:00
parent 9fed0ca970
commit cf2dd28a21
4 changed files with 41 additions and 25 deletions

View File

@ -178,6 +178,7 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_DKIM_DOMAIN").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_DKIM_SELECTOR").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").prop("disabled", true);
jQuery(".smtp_method").hide();
jQuery(".dkim").hide();
';
if ($linuxlike)
@ -191,7 +192,7 @@ if ($action == 'edit')
print '
jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);
jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();';
}
print '
@ -220,7 +221,8 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".dkim").hide();
jQuery(".smtp_method").show();
jQuery(".dkim").hide();
}
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\')
{
@ -246,6 +248,7 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
jQuery(".smtp_method").show();
jQuery(".dkim").show();
}
}
@ -318,13 +321,15 @@ if ($action == 'edit')
print '</td></tr>';
// Host server
print '<tr class="oddeven"><td>';
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
print '<tr class="oddeven">';
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail') {
print '<td>';
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
print '</td><td>';
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
print '</td>';
} else {
print '<td>';
$mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '');
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
@ -333,17 +338,19 @@ if ($action == 'edit')
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="'.$mainserver.'" autocomplete="off">';
print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" value="'.$mainserver.'" autocomplete="off">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_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" name="MAIN_MAIL_SMTP_SERVER" value="'.$mainserver.'">';
}
print '</td>';
}
print '</td></tr>';
print '</tr>';
// Port
print '<tr class="oddeven"><td>';

View File

@ -717,17 +717,18 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$langs->loadLangs(array("admin", "help"));
$warnpicto = '';
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY))
if (!empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY))
{
$langs->load("errors");
$warnpicto = ' '.img_warning($langs->trans("WarningMandatorySetupNotComplete"));
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
}
$newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto, 1);
$warnpicto = '';
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
if (1 || count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
{
$langs->load("errors");
$warnpicto = ' '.img_warning($langs->trans("WarningMandatorySetupNotComplete"));
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
}
$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto, 1);
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"), 1);
@ -740,7 +741,18 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"), 1);
$newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"), 1);
$newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1);
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"), 1);
$warnpicto = '';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningPHPMailD"));
}
if (in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete"));
}
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails").$warnpicto, 1);
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"), 1);
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"), 1);
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"), 1);
@ -1985,17 +1997,14 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu = false;
// Begin of new left menu block
if (empty($menu_array[$i]['level']) && $showmenu)
{
if (empty($menu_array[$i]['level']) && $showmenu) {
$altok++;
$blockvmenuopened = true;
$lastopened = true;
for ($j = ($i + 1); $j < $num; $j++)
{
for ($j = ($i + 1); $j < $num; $j++) {
if (empty($menu_array[$j]['level'])) $lastopened = false;
}
if ($altok % 2 == 0)
{
if ($altok % 2 == 0) {
print '<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
} else {
print '<div class="blockvmenu blockvmenupair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
@ -2005,10 +2014,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Add tabulation
$tabstring = '';
$tabul = ($menu_array[$i]['level'] - 1);
if ($tabul > 0)
{
for ($j = 0; $j < $tabul; $j++)
{
if ($tabul > 0) {
for ($j = 0; $j < $tabul; $j++) {
$tabstring .= '&nbsp;&nbsp;&nbsp;';
}
}
@ -2048,7 +2055,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if ($menu_array[$i]['enabled']) // Enabled so visible
{
print '<div class="menu_titre">'.$tabstring;
if ($shorturlwithoutparam) print '<a class="vmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
if ($shorturlwithoutparam) print '<a class="vmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
else print '<span class="vmenu">';
print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
if ($shorturlwithoutparam) print '</a>';
@ -2077,7 +2084,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled.
{
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
if ($shorturlwithoutparam) print '<a class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
if ($shorturlwithoutparam) print '<a class="vsmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
else print '<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'">';
print $menu_array[$i]['titre'];
if ($shorturlwithoutparam) print '</a>';

View File

@ -2083,4 +2083,5 @@ CountryIfSpecificToOneCountry=Country (if specific to a given country)
YouMayFindSecurityAdviceHere=You may find security advisory here
ModuleActivatedMayExposeInformation=This module may expose sensitive data. If you don't need it, disable it.
ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment.
CombinationsSeparator=Separator character for product combinations
CombinationsSeparator=Separator character for product combinations
SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples

View File

@ -49,6 +49,7 @@ ErrorFieldsRequired=Some required fields were not filled.
ErrorSubjectIsRequired=The email topic is required
ErrorFailedToCreateDir=Failed to create a directory. Check that Web server user has permissions to write into Dolibarr documents directory. If parameter <b>safe_mode</b> is enabled on this PHP, check that Dolibarr php files owns to web server user (or group).
ErrorNoMailDefinedForThisUser=No mail defined for this user
ErrorSetupOfEmailsNotComplete=Setup of emails is not complete
ErrorFeatureNeedJavascript=This feature need javascript to be activated to work. Change this in setup - display.
ErrorTopMenuMustHaveAParentWithId0=A menu of type 'Top' can't have a parent menu. Put 0 in parent menu or choose a menu of type 'Left'.
ErrorLeftMenuMustHaveAParentId=A menu of type 'Left' must have a parent id.