diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php
index a3f71eb1742..c423645d5c8 100644
--- a/htdocs/admin/mailing.php
+++ b/htdocs/admin/mailing.php
@@ -123,7 +123,7 @@ print '';
-
+// TODO the precedent values are deleted after turn on this switch
$var=!$var;
print '
';
print $langs->trans("ActivateCheckRead").'
';
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 70d81cc70ce..df3b4725bf9 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -57,6 +57,8 @@ $search_email=GETPOST("search_email");
// Search modules dirs
$modulesdir = dolGetModulesDirs('/mailings');
+$object = new Mailing($db);
+
/*
@@ -97,7 +99,7 @@ if ($action == 'add')
if ($result > 0)
{
- Header("Location: cibles.php?id=".$id);
+ Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
if ($result == 0)
@@ -117,14 +119,14 @@ if ($action == 'clear')
$obj = new $classname($db);
$obj->clear_target($id);
- Header("Location: cibles.php?id=".$id);
+ Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
if ($action == 'delete')
{
// Ici, rowid indique le destinataire et id le mailing
- $sql="DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles where rowid=".$id;
+ $sql="DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$id;
$resql=$db->query($sql);
if ($resql)
{ //on récurpére l'id du mailing
@@ -139,7 +141,7 @@ if ($action == 'delete')
$obj = new $classname($db);
$obj->update_nb($id);
- Header("Location: cibles.php?id=".$id);
+ Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
else
@@ -171,11 +173,9 @@ llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:M
$form = new Form($db);
-$mil = new Mailing($db);
-
-if ($mil->fetch($id) >= 0)
+if ($object->fetch($id) >= 0)
{
- $head = emailing_prepare_head($mil);
+ $head = emailing_prepare_head($object);
dol_fiche_head($head, 'targets', $langs->trans("Mailing"), 0, 'email');
@@ -184,25 +184,25 @@ if ($mil->fetch($id) >= 0)
print '