'
+ } elseif ($action == 'settitle' && empty($object->title)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
}
- if (!$mesg)
- {
- if ($object->update($user) >= 0)
- {
+ if (!$mesg) {
+ if ($object->update($user) >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
@@ -526,8 +525,7 @@ if (empty($reshook))
/*
* Add file in email form
*/
- if (!empty($_POST['addfile']))
- {
+ if (!empty($_POST['addfile'])) {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -539,8 +537,7 @@ if (empty($reshook))
}
// Action of file remove
- if (!empty($_POST["removedfile"]))
- {
+ if (!empty($_POST["removedfile"])) {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -551,20 +548,18 @@ if (empty($reshook))
}
// Action of emailing update
- if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
- {
+ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"])) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$isupload = 0;
- if (!$isupload)
- {
+ if (!$isupload) {
$mesgs = array();
- $object->sujet = GETPOST("sujet");
- $object->body = GETPOST("bodyemail", 'restricthtml');
- $object->bgcolor = GETPOST("bgcolor");
- $object->bgimage = GETPOST("bgimage");
+ $object->sujet = (string) GETPOST("sujet");
+ $object->body = (string) GETPOST("bodyemail", 'restricthtml');
+ $object->bgcolor = (string) GETPOST("bgcolor");
+ $object->bgimage = (string) GETPOST("bgimage");
if (!$object->sujet) {
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTopic"));
@@ -573,10 +568,8 @@ if (empty($reshook))
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailMessage"));
}
- if (!count($mesgs))
- {
- if ($object->update($user) >= 0)
- {
+ if (!count($mesgs)) {
+ if ($object->update($user) >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
@@ -591,10 +584,8 @@ if (empty($reshook))
}
// Action of validation confirmation
- if ($action == 'confirm_valid' && $confirm == 'yes')
- {
- if ($object->id > 0)
- {
+ if ($action == 'confirm_valid' && $confirm == 'yes') {
+ if ($object->id > 0) {
$object->valid($user);
setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
@@ -605,13 +596,10 @@ if (empty($reshook))
}
// Action of validation confirmation
- if ($action == 'confirm_settodraft' && $confirm == 'yes')
- {
- if ($object->id > 0)
- {
+ if ($action == 'confirm_settodraft' && $confirm == 'yes') {
+ if ($object->id > 0) {
$result = $object->setStatut(0);
- if ($result > 0)
- {
+ if ($result > 0) {
//setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
@@ -624,20 +612,16 @@ if (empty($reshook))
}
// Resend
- if ($action == 'confirm_reset' && $confirm == 'yes')
- {
- if ($object->id > 0)
- {
+ if ($action == 'confirm_reset' && $confirm == 'yes') {
+ if ($object->id > 0) {
$db->begin();
$result = $object->valid($user);
- if ($result > 0)
- {
+ if ($result > 0) {
$result = $object->reset_targets_status($user);
}
- if ($result > 0)
- {
+ if ($result > 0) {
$db->commit();
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
@@ -651,18 +635,15 @@ if (empty($reshook))
}
// Action of delete confirmation
- if ($action == 'confirm_delete' && $confirm == 'yes')
- {
- if ($object->delete($object->id))
- {
+ if ($action == 'confirm_delete' && $confirm == 'yes') {
+ if ($object->delete($object->id)) {
$url = (!empty($urlfrom) ? $urlfrom : 'list.php');
header("Location: ".$url);
exit;
}
}
- if (!empty($_POST["cancel"]))
- {
+ if (!empty($_POST["cancel"])) {
$action = '';
}
}
@@ -676,24 +657,30 @@ $form = new Form($db);
$htmlother = new FormOther($db);
$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
-llxHeader('', $langs->trans("Mailing"), $help_url, '', 0, 0,
+llxHeader(
+ '',
+ $langs->trans("Mailing"),
+ $help_url,
+ '',
+ 0,
+ 0,
array(
- '/includes/ace/src/ace.js',
- '/includes/ace/src/ext-statusbar.js',
- '/includes/ace/src/ext-language_tools.js',
- //'/includes/ace/src/ext-chromevox.js'
- ), array());
+ '/includes/ace/src/ace.js',
+ '/includes/ace/src/ext-statusbar.js',
+ '/includes/ace/src/ext-language_tools.js',
+ //'/includes/ace/src/ext-chromevox.js'
+ ),
+ array()
+);
-if ($action == 'create')
-{
+if ($action == 'create') {
// EMailing in creation mode
print '';
} else {
- if ($object->id > 0)
- {
+ if ($object->id > 0) {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
$head = emailing_prepare_head($object);
- // Confirmation back to draft
- if ($action == 'settodraft')
- {
+ if ($action == 'settodraft') {
+ // Confirmation back to draft
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("SetToDraft"), $langs->trans("ConfirmUnvalidateEmailing"), "confirm_settodraft", '', '', 1);
- }
- // Confirmation of mailing validation
- if ($action == 'valid')
- {
+ } elseif ($action == 'valid') {
+ // Confirmation of mailing validation
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ValidMailing"), $langs->trans("ConfirmValidMailing"), "confirm_valid", '', '', 1);
- } // Confirm reset
- elseif ($action == 'reset')
- {
+ } elseif ($action == 'reset') {
+ // Confirm reset
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ResetMailing"), $langs->trans("ConfirmResetMailing", $object->ref), "confirm_reset", '', '', 2);
- } // Confirm delete
- elseif ($action == 'delete')
- {
+ } elseif ($action == 'delete') {
+ // Confirm delete
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(!empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''), $langs->trans("DeleteAMailing"), $langs->trans("ConfirmDeleteMailing"), "confirm_delete", '', '', 1);
}
-
- if ($action != 'edit' && $action != 'edithtml')
- {
+ if ($action != 'edit' && $action != 'edithtml') {
print dol_get_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
/*
* View mode mailing
*/
- if ($action == 'sendall')
- {
+ if ($action == 'sendall') {
// Define message to recommand from command line
$sendingmode = $conf->global->EMAILING_MAIL_SENDMODE;
- if (empty($sendingmode)) $sendingmode = $conf->global->MAIN_MAIL_SENDMODE;
- if (empty($sendingmode)) $sendingmode = 'mail'; // If not defined, we use php mail function
+ if (empty($sendingmode)) {
+ $sendingmode = $conf->global->MAIN_MAIL_SENDMODE;
+ }
+ if (empty($sendingmode)) {
+ $sendingmode = 'mail'; // If not defined, we use php mail function
+ }
// 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).
- if (!empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
- {
+ 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 = '';
$linktoadminemailend = ' ';
setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), 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');
+ if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) {
+ setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
+ }
$_GET["action"] = '';
} elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) {
- if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
- if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
+ if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') {
+ setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
+ }
+ if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') {
+ setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
+ }
// The feature is forbidden from GUI, we show just message to use from command line.
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
setEventMessages('', null, 'warnings');
- if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it.
- {
+ if ($conf->file->mailing_limit_sendbyweb != '-1') { // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it.
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant...
}
$_GET["action"] = '';
} else {
- if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
- if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
+ if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') {
+ setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
+ }
+ if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') {
+ setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
+ }
$text = '';
- if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0)
- {
+ if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) {
$text .= $langs->trans("MailingNeedCommand");
$text .= ' ';
$text .= ' ';
@@ -832,13 +820,14 @@ if ($action == 'create')
$morehtmlright = '';
$nbtry = $nbok = 0;
- if ($object->statut == 2 || $object->statut == 3)
- {
+ if ($object->statut == 2 || $object->statut == 3) {
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail;
- if ($nbko) $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
+ if ($nbko) {
+ $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
+ }
$morehtmlright .= ') ';
}
@@ -892,21 +881,19 @@ if ($action == 'create')
print $langs->trans("TotalNbOfDistinctRecipients");
print '';
$nbemail = ($object->nbemail ? $object->nbemail : 0);
- if (is_numeric($nbemail))
- {
+ if (is_numeric($nbemail)) {
$text = '';
- if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
- {
- if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
- {
+ if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) {
+ if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) {
$text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
} else {
$text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
}
}
- if (empty($nbemail)) $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").' ';
- if ($text)
- {
+ if (empty($nbemail)) {
+ $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").' ';
+ }
+ if ($text) {
print $form->textwithpicto($nbemail, $text, 1, 'warning');
} else {
print $nbemail;
@@ -925,8 +912,7 @@ if ($action == 'create')
// Clone confirmation
- if ($action == 'clone')
- {
+ if ($action == 'clone') {
// Create an array for form
$formquestion = array(
'text' => $langs->trans("ConfirmClone"),
@@ -941,81 +927,67 @@ if ($action == 'create')
* Actions Buttons
*/
- if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test')))
- {
+ if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
print "\n\n\n";
- if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id))
- {
+ if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) {
print '
'.$langs->trans("SetToDraft").' ';
}
- if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer)
- {
- if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING))
- {
+ if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) {
+ if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) {
print '
'.$langs->trans("EditWithEditor").' ';
} else {
print '
'.$langs->trans("EditWithTextEditor").' ';
}
- if (!empty($conf->use_javascript_ajax)) print '
'.$langs->trans("EditHTMLSource").' ';
+ if (!empty($conf->use_javascript_ajax)) {
+ print '
'.$langs->trans("EditHTMLSource").' ';
+ }
}
//print '
'.$langs->trans("PreviewMailing").' ';
- if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send)
- {
+ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) {
print '
'.$langs->trans("TestMailing").' ';
} else {
print '
'.$langs->trans("TestMailing").' ';
}
- if ($object->statut == 0)
- {
- if ($object->nbemail <= 0)
- {
+ if ($object->statut == 0) {
+ if ($object->nbemail <= 0) {
print '
'.$langs->trans("ValidMailing").' ';
- } elseif (empty($user->rights->mailing->valider))
- {
+ } elseif (empty($user->rights->mailing->valider)) {
print '
'.$langs->trans("ValidMailing").' ';
} else {
print '
'.$langs->trans("ValidMailing").' ';
}
}
- if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->rights->mailing->valider)
- {
- if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
- {
+ if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->rights->mailing->valider) {
+ if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) {
print '
'.$langs->trans("SendMailing").' ';
- } elseif (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send)
- {
+ } elseif (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) {
print '
'.$langs->trans("SendMailing").' ';
} else {
print '
'.$langs->trans("SendMailing").' ';
}
}
- if ($user->rights->mailing->creer)
- {
+ if ($user->rights->mailing->creer) {
print '
'.$langs->trans("ToClone").' ';
}
- if (($object->statut == 2 || $object->statut == 3) && $user->rights->mailing->valider)
- {
- if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send)
- {
+ if (($object->statut == 2 || $object->statut == 3) && $user->rights->mailing->valider) {
+ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) {
print '
'.$langs->trans("ResetMailing").' ';
} else {
print '
'.$langs->trans("ResetMailing").' ';
}
}
- if (($object->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer)
- {
- if ($object->statut > 0 && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->delete))
- {
+ if (($object->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer) {
+ if ($object->statut > 0 && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->delete)) {
print '
'.$langs->trans("DeleteMailing").' ';
} else {
print '
'.$langs->trans("DeleteMailing").' ';
@@ -1026,8 +998,7 @@ if ($action == 'create')
}
// Display of the TEST form
- if ($action == 'test')
- {
+ if ($action == 'test') {
print '
';
print load_fiche_titre($langs->trans("TestMailing"));
@@ -1069,8 +1040,7 @@ if ($action == 'create')
$htmltext = '
'.$langs->trans("FollowingConstantsWillBeSubstituted").': ';
- foreach ($object->substitutionarray as $key => $val)
- {
+ foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).' ';
}
$htmltext .= ' ';
@@ -1089,10 +1059,8 @@ if ($action == 'create')
print '
'.$langs->trans("MailFile").' ';
// List of files
$listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
- if (count($listofpaths))
- {
- foreach ($listofpaths as $key => $val)
- {
+ if (count($listofpaths)) {
+ foreach ($listofpaths as $key => $val) {
print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
print ' ';
}
@@ -1103,21 +1071,22 @@ if ($action == 'create')
// Background color
/*print ' '.$langs->trans("BackgroundColorByDefault").' ';
- print $htmlother->selectColor($object->bgcolor,'bgcolor','',0);
- print ' ';*/
+ print $htmlother->selectColor($object->bgcolor,'bgcolor','',0);
+ print '
';*/
print '';
// Message
print '';
- if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') // CKEditor does not apply the color of the div into its content area
- {
+ if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') { // CKEditor does not apply the color of the div into its content area
$readonly = 1;
// wysiwyg editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, empty($conf->global->FCKEDITOR_ENABLE_MAILING) ? 0 : 1, 20, '90%', $readonly);
$doleditor->Create();
- } else print dol_htmlentitiesbr($object->body);
+ } else {
+ print dol_htmlentitiesbr($object->body);
+ }
print '
';
print dol_get_fiche_end();
@@ -1131,7 +1100,9 @@ if ($action == 'create')
$linkback = ''.$langs->trans("BackToList").' ';
$morehtmlright = '';
- if ($object->statut == 2) $morehtmlright .= ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
+ if ($object->statut == 2) {
+ $morehtmlright .= ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
+ }
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
@@ -1159,21 +1130,19 @@ if ($action == 'create')
print $langs->trans("TotalNbOfDistinctRecipients");
print '';
$nbemail = ($object->nbemail ? $object->nbemail : 0);
- if (is_numeric($nbemail))
- {
+ if (is_numeric($nbemail)) {
$text = '';
- if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2))
- {
- if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
- {
+ if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) {
+ if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) {
$text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
} else {
$text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
}
}
- if (empty($nbemail)) $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").' ';
- if ($text)
- {
+ if (empty($nbemail)) {
+ $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").' ';
+ }
+ if ($text) {
print $form->textwithpicto($nbemail, $text, 1, 'warning');
} else {
print $nbemail;
@@ -1185,8 +1154,7 @@ if ($action == 'create')
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
- if (empty($reshook))
- {
+ if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
}
@@ -1205,8 +1173,7 @@ if ($action == 'create')
print ' ';
$htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").': ';
- foreach ($object->substitutionarray as $key => $val)
- {
+ foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).' ';
}
$htmltext .= ' ';
@@ -1240,10 +1207,8 @@ if ($action == 'create')
$out .= ' });';
$out .= '})';
$out .= ''."\n";
- if (count($listofpaths))
- {
- foreach ($listofpaths as $key => $val)
- {
+ if (count($listofpaths)) {
+ foreach ($listofpaths as $key => $val) {
$out .= '';
$out .= img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name'];
$out .= '
';
@@ -1269,15 +1234,13 @@ if ($action == 'create')
// Message
print '
';
- if ($action == 'edit')
- {
+ if ($action == 'edit') {
// wysiwyg editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
$doleditor->Create();
}
- if ($action == 'edithtml')
- {
+ if ($action == 'edithtml') {
// HTML source editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, 'ace', 20, '90%');
diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php
index 17b5a779617..2961218f148 100644
--- a/htdocs/comm/mailing/class/mailing.class.php
+++ b/htdocs/comm/mailing/class/mailing.class.php
@@ -118,36 +118,48 @@ class Mailing extends CommonObject
/**
* @var int id of user create
- * @deprecated
*/
public $user_creation;
/**
* @var int id of user create
+ * @deprecated
*/
public $user_creat;
/**
* @var int id of user validate
- * @deprecated
*/
public $user_validation;
/**
* @var int id of user validate
+ * @deprecated
*/
public $user_valid;
/**
* @var integer|string date_creation
+ * @deprecated
*/
public $date_creat;
+ /**
+ * @var integer|string date_creation
+ */
+ public $date_creation;
+
/**
* @var int date validate
+ * @deprecated
*/
public $date_valid;
+ /**
+ * @var int date validate
+ */
+ public $date_validation;
+
/**
* @var array extraparams
*/
@@ -314,10 +326,14 @@ class Mailing extends CommonObject
$this->email_errorsto = $obj->email_errorsto;
$this->user_creat = $obj->fk_user_creat;
+ $this->user_creation = $obj->fk_user_creat;
$this->user_valid = $obj->fk_user_valid;
+ $this->user_validation = $obj->fk_user_valid;
$this->date_creat = $this->db->jdate($obj->date_creat);
+ $this->date_creation = $this->db->jdate($obj->date_creat);
$this->date_valid = $this->db->jdate($obj->date_valid);
+ $this->date_validation = $this->db->jdate($obj->date_valid);
$this->date_envoi = $this->db->jdate($obj->date_envoi);
$this->extraparams = (array) json_decode($obj->extraparams, true);
diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php
index 199a5caad8b..4bd39309701 100644
--- a/htdocs/comm/mailing/info.php
+++ b/htdocs/comm/mailing/info.php
@@ -33,8 +33,9 @@ $id = GETPOST('id', 'int');
$langs->load("mails");
// Security check
-if (!$user->rights->mailing->lire || $user->socid > 0)
-accessforbidden();
+if (!$user->rights->mailing->lire || $user->socid > 0) {
+ accessforbidden();
+}
@@ -48,8 +49,7 @@ $form = new Form($db);
$object = new Mailing($db);
-if ($object->fetch($id) >= 0)
-{
+if ($object->fetch($id) >= 0) {
$head = emailing_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("Mailing"), -1, 'email');
@@ -58,13 +58,14 @@ if ($object->fetch($id) >= 0)
$morehtmlright = '';
$nbtry = $nbok = 0;
- if ($object->statut == 2 || $object->statut == 3)
- {
+ if ($object->statut == 2 || $object->statut == 3) {
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail;
- if ($nbko) $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
+ if ($nbko) {
+ $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
+ }
$morehtmlright .= ') ';
}
@@ -73,10 +74,6 @@ if ($object->fetch($id) >= 0)
print '
';
//print '
';
- $object->user_creation = $object->user_creat;
- $object->date_creation = $object->date_creat;
- $object->user_validation = $object->user_valid;
- $object->date_validation = $object->date_valid;
dol_print_object_info($object, 0);
//print '
';