Skip to content

Commit

Permalink
Merge branch 'patch-noncounting-stock' of https://github.com/DaBootO/…
Browse files Browse the repository at this point in the history
…dolibarr into patch-noncounting-stock
  • Loading branch information
DaBootO committed Jun 29, 2024
2 parents 0d069b4 + 7a3cd72 commit ebc3950
Show file tree
Hide file tree
Showing 26 changed files with 328 additions and 223 deletions.
213 changes: 110 additions & 103 deletions htdocs/admin/mails.php
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ function change_smtp_auth_method() {
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br><br>\n";


if (!getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">';
Expand Down Expand Up @@ -833,135 +834,141 @@ function change_smtp_auth_method() {
}

print '<br>';
}


print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("ParametersForTestEnvironment").'</td><td></td></tr>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("ParametersForTestEnvironment").'</td><td></td></tr>';

// Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn(getDolGlobalString('MAIN_DISABLE_ALL_MAILS'));
// Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>';
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff('MAIN_DISABLE_ALL_MAILS', array(), null, 0, 0, 1, 2, 0, 0, '_red').'</a>';
} else {
print yn(getDolGlobalString('MAIN_DISABLE_ALL_MAILS'));
if (getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
print img_warning($langs->trans("Disabled"));
}
print '</td></tr>';
}
print '</td></tr>';

if (!getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
// Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO');
if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) {
if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
print img_warning($langs->trans("ErrorBadEMail"));
} else {
print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue"));
}
if (!getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
// Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO');
if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) {
if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
print img_warning($langs->trans("ErrorBadEMail"));
} else {
print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue"));
}
print '</td></tr>';
}
print '</td></tr>';
}

print '</table>';
print '</div>';
print '</table>';
print '</div>';


print '<br>';
print '<br>';


print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';

// From
$help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM"));
print '<tr class="oddeven"><td>';
print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined"));
print ' '.$help;
print '</td>';
print '<td>' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) {
print img_warning($langs->trans("Mandatory"));
} elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) {
print img_warning($langs->trans("ErrorBadEMail"));
}
print '</td></tr>';
// From
$help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM"));
print '<tr class="oddeven"><td>';
print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined"));
print ' '.$help;
print '</td>';
print '<td>' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) {
print img_warning($langs->trans("Mandatory"));
} elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) {
print img_warning($langs->trans("ErrorBadEMail"));
}
print '</td></tr>';

// Default from type
$liste = array();
$liste['user'] = $langs->trans('UserEmail');
$liste['company'] = $langs->trans('CompanyEmail').' ('.(!getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.((int) $user->id).')';
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj) {
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
}
$i++;
// Default from type
$liste = array();
$liste['user'] = $langs->trans('UserEmail');
$liste['company'] = $langs->trans('CompanyEmail').' ('.(!getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.((int) $user->id).')';
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj) {
$liste['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
}
} else {
dol_print_error($db);
$i++;
}
} else {
dol_print_error($db);
}

print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
print '<td>';
if (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'robot') {
print $langs->trans('RobotEmail');
} elseif (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'user') {
print $langs->trans('UserEmail');
} elseif (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'company') {
print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>');
} else {
$id = preg_replace('/senderprofile_/', '', getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE'));
if ($id > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php';
$emailsenderprofile = new EmailSenderProfile($db);
$emailsenderprofile->fetch($id);
print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>');
}
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
print '<td>';
if (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'robot') {
print $langs->trans('RobotEmail');
} elseif (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'user') {
print $langs->trans('UserEmail');
} elseif (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'company') {
print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>');
} else {
$id = preg_replace('/senderprofile_/', '', getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE'));
if ($id > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php';
$emailsenderprofile = new EmailSenderProfile($db);
$emailsenderprofile->fetch($id);
print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>');
}
print '</td></tr>';
}
print '</td></tr>';

// Errors To
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
print '<td>'.(getDolGlobalString('MAIN_MAIL_ERRORS_TO'));
if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) {
print img_warning($langs->trans("ErrorBadEMail"));
}
print '</td></tr>';
// Errors To
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
print '<td>'.(getDolGlobalString('MAIN_MAIL_ERRORS_TO'));
if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) {
print img_warning($langs->trans("ErrorBadEMail"));
}
print '</td></tr>';

// Autocopy to
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td>';
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')) {
$listofemail = explode(',', getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO'));
$i = 0;
foreach ($listofemail as $key => $val) {
if ($i) {
print ', ';
}
$val = trim($val);
print $val;
if (!isValidEmail($val, 0, 1)) {
print img_warning($langs->trans("ErrorBadEMail", $val));
}
$i++;
// Autocopy to
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td>';
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')) {
$listofemail = explode(',', getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO'));
$i = 0;
foreach ($listofemail as $key => $val) {
if ($i) {
print ', ';
}
} else {
print '&nbsp;';
$val = trim($val);
print $val;
if (!isValidEmail($val, 0, 1)) {
print img_warning($langs->trans("ErrorBadEMail", $val));
}
$i++;
}
print '</td></tr>';
} else {
print '&nbsp;';
}
print '</td></tr>';

//Add user to select destinaries list
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn(getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')).'</td></tr>';
//Disable autoselect to
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_NO_WITH_TO_SELECTED").'</td><td>'.yn(getDolGlobalString('MAIN_MAIL_NO_WITH_TO_SELECTED')).'</td></tr>';
//Add user to select destinaries list
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn(getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')).'</td></tr>';
//Disable autoselect to
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_NO_WITH_TO_SELECTED").'</td><td>'.yn(getDolGlobalString('MAIN_MAIL_NO_WITH_TO_SELECTED')).'</td></tr>';

print '</table>';
print '</div>';

print '</table>';
print '</div>';
}

print dol_get_fiche_end();

Expand Down
Loading

0 comments on commit ebc3950

Please sign in to comment.