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

This commit is contained in:
Laurent Destailleur 2022-07-14 11:54:30 +02:00
commit 4f54fb4f00
17 changed files with 105 additions and 38 deletions

View File

@ -427,11 +427,15 @@ if ($action == 'edit') {
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')];
if (empty($text)) {
$text = $langs->trans("Undefined").img_warning();
}
print $text;
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'default') {
print '<span class="opacitymedium">'.$text.'</span>';
} else {
print $text;
}
print '</td></tr>';
if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {

View File

@ -394,11 +394,15 @@ if ($action == 'edit') {
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_TICKET];
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')];
if (empty($text)) {
$text = $langs->trans("Undefined").img_warning();
}
print $text;
if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'default') {
print '<span class="opacitymedium">'.$text.'</span>';
} else {
print $text;
}
print '</td></tr>';
if (!empty($conf->global->MAIN_MAIL_SENDMODE_TICKET) && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') {

View File

@ -89,6 +89,7 @@ $configfileparameters = array(
'separator',
'?dolibarr_mailing_limit_sendbyweb',
'?dolibarr_mailing_limit_sendbycli',
'?dolibarr_mailing_limit_sendbyday',
'?dolibarr_strict_mode'
);
$configfilelib = array(

View File

@ -360,6 +360,7 @@ $configfileparameters = array(
'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only',
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
'?dolibarr_mailing_limit_sendbyday' => 'Limit nb of email sent per day',
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_nocsrfcheck' => 'Disable CSRF security checks'
);

View File

@ -801,13 +801,20 @@ if ($action == 'create') {
// MAILING_NO_USING_PHPMAIL may be defined or not.
// MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden).
// MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit).
// MAILING_LIMIT_SENDBYDAY may be defined ot not (0 or undefined=no limit).
if (!empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
// You ensure that every user is using its own SMTP server when using the mass emailing module.
$linktoadminemailbefore = '<a href="'.DOL_URL_ROOT.'/admin/mails_emailing.php">';
$linktoadminemailend = '</a>';
setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings');
$messagetoshow = $langs->trans("MailSendSetupIs2", '{s1}', '{s2}', '{s3}', '{s4}');
$messagetoshow = str_replace('{s1}', $linktoadminemailbefore, $messagetoshow);
$messagetoshow = str_replace('{s2}', $linktoadminemailend, $messagetoshow);
$messagetoshow = str_replace('{s3}', $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $messagetoshow);
$messagetoshow = str_replace('{s4}', $listofmethods['smtps'], $messagetoshow);
setEventMessages($messagetoshow, null, 'warnings');
if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) {
setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
}
@ -836,14 +843,21 @@ if ($action == 'create') {
}
$text = '';
if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) {
$text .= $langs->trans("MailingNeedCommand");
$text .= '<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';
if (isset($conf->global->MAILING_LIMIT_SENDBYDAY) && $conf->global->MAILING_LIMIT_SENDBYDAY >= 0) {
$text .= $langs->trans('WarningLimitSendByDay', $conf->global->MAILING_LIMIT_SENDBYDAY);
$text .= '<br><br>';
}
$text .= $langs->trans('ConfirmSendingEmailing').'<br>';
$text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600);
if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) {
$text .= '<br><br>';
$text .= $langs->trans("MailingNeedCommand");
$text .= '<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft" disabled>php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';
}
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600, 0, $langs->trans("Confirm"), $langs->trans("Cancel"));
}
}

View File

@ -1038,12 +1038,15 @@ class Conf
if (!empty($this->file->mailing_limit_sendbyweb)) {
$this->global->MAILING_LIMIT_SENDBYWEB = $this->file->mailing_limit_sendbyweb;
}
if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) {
if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) { // Limit by web can't be 0
$this->global->MAILING_LIMIT_SENDBYWEB = 25;
}
if (!empty($this->file->mailing_limit_sendbycli)) {
$this->global->MAILING_LIMIT_SENDBYCLI = $this->file->mailing_limit_sendbycli;
}
if (!empty($this->file->mailing_limit_sendbyday)) {
$this->global->MAILING_LIMIT_SENDBYDAY = $this->file->mailing_limit_sendbyday;
}
return 0;
}

View File

@ -777,7 +777,7 @@ function isInEEC($object)
*/
function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatelink = 0, $morehtmlright = '')
{
global $user;
global $user, $action, $hookmanager;
$i = -1;
@ -791,8 +791,9 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
print "\n";
print load_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"), $newcardbutton.$morehtmlright, '');
print '<div class="div-table-responsive">';
print "\n".'<table class="noborder" width=100%>';
print '<div class="div-table-responsive">'."\n";
print '<table class="noborder centpercent">';
$sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount";
$sql .= ", cls.code as opp_status_code";
@ -877,6 +878,11 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
} else {
dol_print_error($db);
}
$parameters = array('sql'=>$sql, 'function'=>'show_projects');
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>";
print '</div>';

View File

@ -84,7 +84,7 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid
protected function getMailInfo()
{
global $conf, $langs;
global $dolibarr_mailing_limit_sendbyweb;
global $dolibarr_mailing_limit_sendbyweb, $dolibarr_mailing_limit_sendbycli, $dolibarr_mailing_limit_sendbyday;
$info = $langs->trans('Method').': <strong>'.getDolGlobalString("MAIN_MAIL_SENDMODE").'</strong><br>';
$info .= $langs->trans('Server').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTP_SERVER").'</strong><br>';
@ -94,6 +94,8 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid
$info .= $langs->trans('TLS/STARTTLS').': <strong>'.getDolGlobalString("MAIN_MAIL_EMAIL_TLS").'</strong> / <strong>'.getDolGlobalString("MAIN_MAIL_EMAIL_STARTTLS").'</strong><br>';
$info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': <strong>'.(empty($conf->global->MAIN_DISABLE_ALL_MAILS) ? $langs->trans('No') : $langs->trans('Yes')).'</strong><br>';
$info .= 'dolibarr_mailing_limit_sendbyweb = <strong>'.$dolibarr_mailing_limit_sendbyweb.'</strong><br>';
$info .= 'dolibarr_mailing_limit_sendbycli = <strong>'.$dolibarr_mailing_limit_sendbycli.'</strong><br>';
$info .= 'dolibarr_mailing_limit_sendbyday = <strong>'.$dolibarr_mailing_limit_sendbyday.'</strong><br>';
return $info;
}

View File

@ -179,6 +179,9 @@ if (empty($dolibarr_mailing_limit_sendbyweb)) {
if (empty($dolibarr_mailing_limit_sendbycli)) {
$dolibarr_mailing_limit_sendbycli = 0;
}
if (empty($dolibarr_mailing_limit_sendbyday)) {
$dolibarr_mailing_limit_sendbyday = 0;
}
if (empty($dolibarr_strict_mode)) {
$dolibarr_strict_mode = 0; // For debug in php strict mode
}

View File

@ -129,6 +129,10 @@ a.button.runupgrade {
padding: 10px;
}
tr.title.tablesupport-title {
height: 100px;
}
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
@ -464,7 +468,7 @@ table.login.tablesupport .title {
}
table.tablesupport {
min-height: 250px;
min-height: 300px;
border: 1px solid #E0E0E0;
background: #FFF;
}

View File

@ -419,6 +419,7 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl
// We force the content charset
header("Content-type: text/html; charset=".$conf->file->character_set_client);
header("X-Content-Type-Options: nosniff");
header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
print '<!DOCTYPE HTML>'."\n";
print '<html>'."\n";

View File

@ -911,6 +911,8 @@ function write_conf_file($conffile)
fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';');
fputs($fp, "\n");
fputs($fp, '$dolibarr_mailing_limit_sendbycli=\'0\';');
fputs($fp, "\n");
// Write params to overwrites default lib path
fputs($fp, "\n");

View File

@ -178,3 +178,4 @@ IsAnAnswer=Is an answer of an initial email
RecordCreatedByEmailCollector=Record created by the Email Collector %s from email %s
DefaultBlacklistMailingStatus=Default value for field '%s' when creating a new contact
DefaultStatusEmptyMandatory=Empty but mandatory
WarningLimitSendByDay=WARNING: The setup or contract of your instance limits your number of emails per day to <b>%s</b>. Trying to send more may result in having your instance slow down or suspended. Please contact your support if you need a higher quota.

View File

@ -75,8 +75,9 @@ if (defined('TEST_DB_FORCE_TYPE')) {
// Set properties specific to conf file
$conf->file->main_limit_users = $dolibarr_main_limit_users;
$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb;
$conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli;
$conf->file->mailing_limit_sendbyweb = empty($dolibarr_mailing_limit_sendbyweb) ? 0 : $dolibarr_mailing_limit_sendbyweb;
$conf->file->mailing_limit_sendbycli = empty($dolibarr_mailing_limit_sendbycli) ? 0 : $dolibarr_mailing_limit_sendbycli;
$conf->file->mailing_limit_sendbyday = empty($dolibarr_mailing_limit_sendbyday) ? 0 : $dolibarr_mailing_limit_sendbyday;
$conf->file->main_authentication = empty($dolibarr_main_authentication) ? '' : $dolibarr_main_authentication; // Identification mode
$conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https
$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug)

View File

@ -515,6 +515,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
print '<input type="hidden" name="backtopagejsfields" value="'.$backtopagejsfields.'">';
print dol_get_fiche_head();

View File

@ -236,6 +236,7 @@ function pHeader($soutitre, $next, $action = 'none')
// On force contenu dans format sortie
header("Content-type: text/html; charset=".$conf->file->character_set_client);
header("X-Content-Type-Options: nosniff");
header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
print '<head>'."\n";

View File

@ -77,17 +77,22 @@ print '<div style="width: 100%; text-align: center"><div class="inline-block blo
print "\n";
// Forum/wiki support
print '<table class="login tablesupport" width="100%">';
print '<tr class="title" valign="top">';
print '<table class="login tablesupport" width="100%" style="margin-top: 20px">';
print '<tr class="title tablesupport-title" valign="top">';
print '<td width="100%" align="left" valign="middle">';
print '<table summary="who"><tr><td>'.img_picto('', 'who.png', 'class="valignmiddle"', 1).'</td><td>';
print '<table summary="who"><tr><td>'.img_picto('', 'who.png', 'class="valignmiddle paddingright"', 1).'</td><td>';
print '<span style="'.$style1.'">'.$langs->trans("CommunitySupport").'</span>';
print '<span class="small">';
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfSupport").':</span> <span style="'.$style2.'">'.$langs->trans("TypeSupportCommunauty").'</span>';
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").':</span> ';
print $langs->trans("TypeHelpDev").'/'.img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).'/'.img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1);
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfSupport").':</span> ';
print '<span style="'.$style2.'">'.$langs->trans("TypeSupportCommunauty").'</span>';
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfHelp").':</span> ';
print $langs->trans("TypeHelpDev");
print '<br><span class="opacitymedium">'.$langs->trans("Efficiency").':</span> ';
print img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1);
print '<br><span class="opacitymedium">'.$langs->trans("Price").':</span> ';
print img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1);
print '</span>';
print '</td></tr></table>';
@ -109,6 +114,7 @@ if (preg_match('/es/i', $langs->defaultlang)) {
if (preg_match('/de/i', $langs->defaultlang)) {
$urlwiki = 'https://wiki.dolibarr.org/index.php/Hauptseite';
}
print '<div class="wordbreak">';
print '<br>'.$langs->trans("ForDocumentationSeeWiki", $urlwiki, $urlwiki);
print '<br>';
$urlforum = 'https://www.dolibarr.org/forum/';
@ -132,6 +138,7 @@ print '<br>'.$langs->trans("ForAnswersSeeForum", $urlforumlocal, $urlforumlocal)
if ($urlforumlocal != $urlforum) {
print '<b><a href="'.$urlforum.'">'.$urlforum.'</a></b>';
}
print '</div>';
print '</td></tr></table>';
print '</td>';
print '</tr>';
@ -141,17 +148,22 @@ print "\n";
print '</div><div class="inline-block blocksupport">';
// EMail support
print '<table class="login tablesupport" width="100%">';
print '<tr class="title" valign="top">';
print '<table class="login tablesupport" width="100%" style="margin-top: 20px">';
print '<tr class="title tablesupport-title" valign="top">';
print '<td width="100%" align="left" valign="middle">';
print '<table summary="mail"><tr><td>'.img_picto('', 'mail.png', 'class="valignmiddle"', 1).'</td><td>';
print '<table summary="mail"><tr><td>'.img_picto('', 'mail.png', 'class="valignmiddle paddingright"', 1).'</td><td>';
print '<span style="'.$style1.'">'.$langs->trans("EMailSupport").'</span>';
print '<span class="small">';
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfSupport").':</span> <span style="'.$style2.'">'.$langs->trans("TypeSupportCommercial").'</span>';
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").':</span> ';
print $langs->trans("TypeHelpOnly").'/'.img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).'/'.img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1);
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfSupport").':</span> ';
print '<span style="'.$style2.'">'.$langs->trans("TypeSupportCommercial").'</span>';
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfHelp").':</span>';
print $langs->trans("TypeHelpOnly");
print '<br><span class="opacitymedium">'.$langs->trans("Efficiency").':</span>';
print img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1);
print '<br><span class="opacitymedium">'.$langs->trans("Price").':</span> ';
print img_picto_common('', 'star', 'class="valignmiddle"', 1).img_picto_common('', 'star', 'class="valignmiddle"', 1);
print '</span>';
print '</td></tr></table>';
@ -163,8 +175,9 @@ print '<td align="center" valign="top">';
print '<table class="nocellnopadd">';
print '<tr><td align="center">';
print '<br><span class="opacitymedium">'.$langs->trans("ToSeeListOfAvailableRessources").'</span><br>';
print '<br>';
print '<b><a href="'.$urlwiki.'">'.$langs->trans("ClickHere").'</a></b><br>';
print '<br><br>';
print '<br>';
print '<br><br>';
print '</td></tr></table>';
print '</td>';
@ -176,18 +189,22 @@ print '</div><div class="inline-block blocksupport">';
// Other support
print '<table class="login tablesupport" width="100%">';
print '<tr class="title">';
print '<table class="login tablesupport" width="100%" style="margin-top: 20px">';
print '<tr class="title tablesupport-title">';
print '<td width="100%" align="left" valign="middle">';
print '<table summary="special"><tr><td>'.img_picto('', 'pagemaster.png', 'class="valignmiddle"', 1).'</td><td>';
print '<table summary="special"><tr><td>'.img_picto('', 'pagemaster.png', 'class="valignmiddle paddingright"', 1).'</td><td>';
print '<span style="'.$style1.'">'.$langs->trans("OtherSupport").'</span>';
print '<span class="small">';
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfSupport").':</span> <span style="'.$style2.'">'.$langs->trans("TypeSupportCommercial").'</span>';
//print '<br>'.$langs->trans("Efficiency").'/'.$langs->trans("Price").': '.img_picto_common('','redstar').img_picto_common('','redstar').img_picto_common('','redstar').' / '.img_picto_common('','star');
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").':</span> ';
print $langs->trans("TypeHelpDevForm").'/?/?';
print '<br><span class="opacitymedium">'.$langs->trans("TypeOfSupport").':</span> ';
print '<span style="'.$style2.'">'.$langs->trans("TypeSupportCommercial").'</span>';
print '<br><span class="opacitymedium wordbreak">'.$langs->trans("TypeOfHelp").':</span>';
print $langs->trans("TypeHelpDevForm");
print '<br><span class="opacitymedium">'.$langs->trans("Efficiency").':</span>';
print img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1).img_picto_common('', 'redstar', 'class="valignmiddle"', 1);
print '<br><span class="opacitymedium">'.$langs->trans("Price").':</span> ';
print img_picto_common('', 'star', 'class="valignmiddle"', 1);
print '</span>';
print '</td></tr></table>';
@ -199,8 +216,9 @@ print '<td align="center" valign="top">';
print '<table class="nocellnopadd">';
print '<tr><td align="center">';
print '<br><span class="opacitymedium">'.$langs->trans("ToSeeListOfAvailableRessources").'</span><br>';
print '<br>';
print '<b><a href="'.$urlwiki.'">'.$langs->trans("ClickHere").'</a></b><br>';
print '<br><br>';
print '<br>';
print '<br><br>';
print '</td></tr></table>';
print '</td>';