Skip to content
Snippets Groups Projects
Commit 756919de authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix deadlock feature: could not solve a situation where an emailing was

validated by error.
parent b4b81d8d
No related branches found
No related tags found
No related merge requests found
......@@ -602,6 +602,29 @@ if (empty($reshook))
}
}
// Action confirmation validation
if ($action == 'confirm_settodraft' && $confirm == 'yes')
{
if ($object->id > 0)
{
$result = $object->setStatut(0);
if ($result > 0)
{
//setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
{
dol_print_error($db);
}
}
// Resend
if ($action == 'confirm_reset' && $confirm == 'yes')
{
......@@ -727,7 +750,12 @@ else
dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
// Confirmation de la validation du mailing
// Confirmation back to draft
if ($action == 'settodraft')
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("SetToDraft"),$langs->trans("ConfirmUnvalidateEmailing"),"confirm_settodraft",'','',1);
}
// Confirmation validation of mailing
if ($action == 'valid')
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1);
......@@ -900,10 +928,15 @@ else
* Boutons d'action
*/
if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('valid','delete','sendall','clone')))
if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('settodraft', 'valid','delete','sendall','clone')))
{
print "\n\n<div class=\"tabsAction\">\n";
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id))
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&amp;id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
}
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("EditMailing").'</a>';
......@@ -1212,7 +1245,7 @@ else
print '<div style="padding-top: 10px">';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor->Create();
print '</div>';
......
......@@ -231,7 +231,7 @@ if ($object->fetch($id) >= 0)
$var=!$var;
$allowaddtarget=($object->statut == 0 || $object->statut == 1);
$allowaddtarget=($object->statut == 0);
// Show email selectors
if ($allowaddtarget && $user->rights->mailing->creer)
......
......@@ -2771,6 +2771,7 @@ abstract class CommonObject
$this->db->begin();
$fieldstatus="fk_statut";
if ($elementTable == 'mailing') $fieldstatus="statut";
if ($elementTable == 'user') $fieldstatus="statut";
if ($elementTable == 'expensereport') $fieldstatus="fk_statut";
if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus="status";
......
......@@ -74,6 +74,7 @@ ResultOfMailSending=Result of mass EMail sending
NbSelected=Nb selected
NbIgnored=Nb ignored
NbSent=Nb sent
ConfirmUnvalidateEmailing=Are you sure you want to change email <b>%s</b> to draft status?
MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters
MailingModuleDescContactsByCompanyCategory=Contacts by third party category
MailingModuleDescContactsByCategory=Contacts by categories
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment