Module e-maillling : Correctif et evolution Accusé de lecture et
desinscription
This commit is contained in:
parent
c57063878d
commit
5bfff3920f
@ -192,7 +192,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
$substitutionarray=array(
|
||||
'__ID__' => $obj->source_id,
|
||||
'__EMAIL__' => $obj->email,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" style="width:0px;height:0px" border="0"/>',
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="0" height="0" style="width:0px;height:0px" border="0"/>',
|
||||
'__UNSUSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-usubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank"/>'.$langs->trans("MailUnsubcribe").'</a>',
|
||||
'__LASTNAME__' => $obj->nom,
|
||||
'__FIRSTNAME__' => $obj->prenom,
|
||||
@ -257,6 +257,34 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if cheack read is use then update prospect contact status
|
||||
if (strpos($message, '__CHECK_READ__') !== false)
|
||||
{
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")";
|
||||
dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG);
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
//Update status communication of contact prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//test if CHECK READ change statut prospect contact
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -184,13 +184,24 @@ class MailingTargets // This can't be abstract as it is used for some method
|
||||
|
||||
dol_syslog(get_class($this)."::add_to_target: mailing ".$j." targets added");
|
||||
|
||||
//Update the status to show poelple that don't want to be contacted anymore'
|
||||
//Update the status to show thirdparty mail that don't want to be contacted anymore'
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=3";
|
||||
$sql .= " WHERE fk_mailing=".$mailing_id." and email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)";
|
||||
$sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)";
|
||||
$sql .= " AND source_type='thirdparty'";
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
dol_syslog("MailingTargets::add_to_target: mailing update status to display people that do not want to be contacted sql:".$sql);
|
||||
dol_syslog(get_class($this)."::add_to_target: mailing update status to display thirdparty mail that do not want to be contacted sql:".$sql);
|
||||
|
||||
//Update the status to show contact mail that don't want to be contacted anymore'
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=3";
|
||||
$sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.fk_stcomm=-1 AND s.rowid=sc.fk_soc)";
|
||||
$sql .= " AND source_type='contact'";
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
dol_syslog(get_class($this)."::add_to_target: mailing update status to display contact mail that do not want to be contacted sql:".$sql);
|
||||
|
||||
|
||||
$this->update_nb($mailing_id);
|
||||
|
||||
@ -41,13 +41,23 @@ if ($id!='')
|
||||
dol_syslog("public/emailing/mailing-read.php : Mail read : ".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$id."')";
|
||||
dol_syslog("public/emailing/mailing-read.php : Mail read : ".$sql, LOG_DEBUG);
|
||||
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$id."' AND source_type='thirdparty' AND source_id is not null)";
|
||||
dol_syslog("public/emailing/mailing-read.php : Mail read thirdparty : ".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
//Update status communication of contact prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$id."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -49,9 +49,15 @@ if (($id!='') && ($unsuscrib=='1'))
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
//Update status communication of prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$id."' AND source_type='thirdparty')";
|
||||
dol_syslog("public/emailing/mailing-usubscribe.php : Mail unsubcribe : ".$sql, LOG_DEBUG);
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$id."' AND source_type='thirdparty' AND source_id is not null)";
|
||||
dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe thirdparty : ".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
//Update status communication of contact prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$id."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe contact : ".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ if ($resql)
|
||||
$substitutionarray=array(
|
||||
'__ID__' => $obj->source_id,
|
||||
'__EMAIL__' => $obj->email,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" style="width:0px;height:0px" border="0"/>',
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="0" height="0" style="width:0px;height:0px" border="0"/>',
|
||||
'__UNSUSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-usubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank"/>'.$langs->trans("MailUnsubcribe").'</a>',
|
||||
'__LASTNAME__' => $obj->lastname,
|
||||
'__FIRSTNAME__' => $obj->firstname,
|
||||
@ -199,6 +199,31 @@ if ($resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if cheack read is use then update prospect contact status
|
||||
if (strpos($message, '__CHECK_READ__') !== false)
|
||||
{
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")";
|
||||
dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG);
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
//Update status communication of contact prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user