fix 4672
This commit is contained in:
parent
388bd5ca48
commit
37ee64ae9b
@ -221,7 +221,7 @@ if ($action == 'add') {
|
|||||||
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
|
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
|
||||||
// Add targets into database
|
// Add targets into database
|
||||||
$obj = new mailing_advthirdparties($db);
|
$obj = new mailing_advthirdparties($db);
|
||||||
$result = $obj->add_to_target($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines);
|
$result = $obj->add_to_target_spec($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines);
|
||||||
} else {
|
} else {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
}
|
}
|
||||||
@ -967,11 +967,11 @@ if ($object->fetch($id) >= 0) {
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3))
|
|
||||||
|
if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3))
|
||||||
{
|
{
|
||||||
// List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content)
|
// List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,14 +39,14 @@ function emailing_prepare_head(Mailing $object)
|
|||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient))
|
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("MailRecipients");
|
$head[$h][1] = $langs->trans("MailRecipients");
|
||||||
$head[$h][2] = 'targets';
|
$head[$h][2] = 'targets';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) // Still need debug
|
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
||||||
@ -54,7 +54,7 @@ function emailing_prepare_head(Mailing $object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("Info");
|
$head[$h][1] = $langs->trans("Info");
|
||||||
$head[$h][2] = 'info';
|
$head[$h][2] = 'info';
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class mailing_advthirdparties extends MailingTargets
|
|||||||
* @param array $contactid Array of contact id to add
|
* @param array $contactid Array of contact id to add
|
||||||
* @return int <0 if error, number of emails added if ok
|
* @return int <0 if error, number of emails added if ok
|
||||||
*/
|
*/
|
||||||
function add_to_target($mailing_id,$socid,$type_of_target, $contactid)
|
function add_to_target_spec($mailing_id,$socid,$type_of_target, $contactid)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -80,14 +80,14 @@ class mailing_advthirdparties extends MailingTargets
|
|||||||
{
|
{
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found", LOG_DEBUG);
|
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found", LOG_DEBUG);
|
||||||
|
|
||||||
$old = '';
|
$old = '';
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) {
|
if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) {
|
||||||
if (!array_key_exists($obj->email, $cibles)) {
|
if (!array_key_exists($obj->email, $cibles)) {
|
||||||
$cibles[$obj->email] = array(
|
$cibles[$obj->email] = array(
|
||||||
@ -102,7 +102,7 @@ class mailing_advthirdparties extends MailingTargets
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,21 +129,21 @@ class mailing_advthirdparties extends MailingTargets
|
|||||||
$sql.= " AND socp.fk_soc IN (".implode(',',$socid).")";
|
$sql.= " AND socp.fk_soc IN (".implode(',',$socid).")";
|
||||||
}
|
}
|
||||||
$sql.= " ORDER BY email";
|
$sql.= " ORDER BY email";
|
||||||
|
|
||||||
// Stock recipients emails into targets table
|
// Stock recipients emails into targets table
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found");
|
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found");
|
||||||
|
|
||||||
$old = '';
|
$old = '';
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) {
|
if (!empty($obj->email) && filter_var($obj->email, FILTER_VALIDATE_EMAIL)) {
|
||||||
if (!array_key_exists($obj->email, $cibles)) {
|
if (!array_key_exists($obj->email, $cibles)) {
|
||||||
$cibles[$obj->email] = array(
|
$cibles[$obj->email] = array(
|
||||||
@ -158,7 +158,7 @@ class mailing_advthirdparties extends MailingTargets
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ class mailing_advthirdparties extends MailingTargets
|
|||||||
*
|
*
|
||||||
* @return int Nb of recipients
|
* @return int Nb of recipients
|
||||||
*/
|
*/
|
||||||
function getNbOfRecipients()
|
function getNbOfRecipients($sql)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user