mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Enable option clone target emailing
This commit is contained in:
parent
ff597a899f
commit
dddbc37d35
|
|
@ -46,6 +46,7 @@ For users:
|
|||
- Fix: Project Task numbering customs rule works.
|
||||
- Fix: Add actions events not implemented.
|
||||
- New: Add filter date in bank writing list page
|
||||
- New: Enable option "clone target emailing"
|
||||
|
||||
TODO
|
||||
- New: Predefined product and free product use same form.
|
||||
|
|
|
|||
|
|
@ -305,8 +305,55 @@ class Mailing extends CommonObject
|
|||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
//Clone target
|
||||
if (!empty($option2)) {
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/mailings/modules_mailings.php';
|
||||
|
||||
$mailing_target = new MailingTargets($this->db);
|
||||
|
||||
$target_array=array();
|
||||
|
||||
$sql = "SELECT fk_contact, ";
|
||||
$sql.=" lastname, ";
|
||||
$sql.=" firstname,";
|
||||
$sql.=" email,";
|
||||
$sql.=" other,";
|
||||
$sql.=" source_url,";
|
||||
$sql.=" source_id ,";
|
||||
$sql.=" source_type ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles ";
|
||||
$sql.= " WHERE fk_mailing = ".$fromid;
|
||||
|
||||
dol_syslog(get_class($this)."::createFromClone sql=".$sql);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($result)) {
|
||||
|
||||
$target_array[]=array('fk_contact'=>$obj->fk_contact,
|
||||
'lastname'=>$obj->lastname,
|
||||
'firstname'=>$obj->firstname,
|
||||
'email'=>$obj->email,
|
||||
'other'=>$obj->other,
|
||||
'source_url'=>$obj->source_url,
|
||||
'source_id'=>$obj->source_id,
|
||||
'source_type'=>$obj->source_type);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Mailing::createFromClone ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$mailing_target->add_to_target($object->id, $target_array);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -822,7 +822,7 @@ else
|
|||
$formquestion=array(
|
||||
'text' => $langs->trans("ConfirmClone"),
|
||||
array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1),
|
||||
array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true)
|
||||
array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0)
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$object->ref),'confirm_clone',$formquestion,'yes',2,240);
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class MailingTargets // This can't be abstract as it is used for some method
|
|||
$sql.= "'".$this->db->escape($targetarray['other'])."',";
|
||||
$sql.= "'".$this->db->escape($targetarray['source_url'])."',";
|
||||
$sql.= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
|
||||
$sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
|
||||
$sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['lastname'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
|
||||
$sql .= "'".$this->db->escape($targetarray['source_type'])."')";
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user