Merge pull request #1556 from FHenry/develop
Enable option clone target emailing
This commit is contained in:
commit
569d4cfd41
@ -52,6 +52,7 @@ For users:
|
||||
- Fix: Price min of composition is not supplier price min by quantity
|
||||
- Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers
|
||||
- New: Add categories translation
|
||||
- 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);
|
||||
|
||||
@ -711,7 +711,7 @@ else
|
||||
if (! empty($conf->mailing->enabled))
|
||||
{
|
||||
$langs->load("mails");
|
||||
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsReceived").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsSend").'</td>';
|
||||
print '<td>'.$object->getNbOfEMailings().'</td>';
|
||||
}
|
||||
else
|
||||
@ -936,7 +936,7 @@ else
|
||||
if (! empty($conf->mailing->enabled))
|
||||
{
|
||||
$langs->load("mails");
|
||||
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsReceived").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsSend").'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/liste.php?filteremail='.urlencode($object->email).'">'.$object->getNbOfEMailings().'</a></td>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -119,6 +119,7 @@ TargetsReset=Clear list
|
||||
ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing
|
||||
ToAddRecipientsChooseHere=Add recipients by choosing from the lists
|
||||
NbOfEMailingsReceived=Mass emailings received
|
||||
NbOfEMailingsSend=Mass emailings sent
|
||||
IdRecord=ID record
|
||||
DeliveryReceipt=Delivery Receipt
|
||||
YouCanUseCommaSeparatorForSeveralRecipients=You can use the <b>comma</b> separator to specify several recipients.
|
||||
|
||||
@ -121,6 +121,7 @@ TargetsReset=Vider liste
|
||||
ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de cet emailing, cliquez sur le bouton
|
||||
ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous
|
||||
NbOfEMailingsReceived=Emailings de masse reçus
|
||||
NbOfEMailingsSend=Emailings de masse envoyé(s)
|
||||
IdRecord=ID enregistrement
|
||||
DeliveryReceipt=Accusé de réception
|
||||
YouCanUseCommaSeparatorForSeveralRecipients=Vous pouvez utiliser le caractère de séparation <b>virgule</b> pour spécifier plusieurs destinataires.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user