From dddbc37d35ecae2f2fcb63082d2c4e254aa4714d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 28 Apr 2014 17:18:11 +0200 Subject: [PATCH 1/4] Enable option clone target emailing --- ChangeLog | 1 + htdocs/comm/mailing/class/mailing.class.php | 51 ++++++++++++++++++- htdocs/comm/mailing/fiche.php | 2 +- .../modules/mailings/modules_mailings.php | 2 +- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2aa466a76dd..ad210c55c0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index a0094c2f3f6..a6db4738bb5 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -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); + } } diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 03caf79d9d5..9d6a31cdfac 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -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); diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 4f0599bfb3b..6f4a573ccfc 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -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) From 79fabb05b56361e84642fec82175087b84e00621 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 28 Apr 2014 17:23:13 +0200 Subject: [PATCH 2/4] changelog --- ChangeLog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 892acc629a4..065e8c8127d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,7 +58,6 @@ TODO - New: Predefined product and free product use same form. - New: [ task #926 ] Add extrafield feature on order lines. - New: [ task #927 ] Add extrafield feature on Proposal lines. -- New: [ task #928 ] Add extrafield feature on invoice lines. For translators: - Update language files. @@ -76,6 +75,9 @@ For developers: - New: Normalize code for barcode generation to match other modules. - New: Uniformize code for contacts forms. - New: Add some hooks for financial reports. +- New: A module can add its own ECM view. +- New: A module can disable a standard ECM view. +- New: Add multilang support into product webservice. WARNING: Following change may create regression for some external modules, but was necessary to make Dolibarr better: @@ -94,6 +96,10 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f ***** ChangeLog for 3.5.3 compared to 3.5.2 ***** Fix: Error on field accountancy code for export profile of invoices. +Fix: [ bug #1351 ] VIES verification link broken. +Fix: [ bug #1352 ] Removing a shipping does not remove the delivery. +Fix: Option MAIN_INVERT_SENDER_RECIPIENT broken with typhon template. + ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. From 91505fdebe72083254ecb497f9e1d59e0e3b17fc Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 28 Apr 2014 17:24:14 +0200 Subject: [PATCH 3/4] changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 065e8c8127d..030a0f68c4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,6 +58,7 @@ TODO - New: Predefined product and free product use same form. - New: [ task #926 ] Add extrafield feature on order lines. - New: [ task #927 ] Add extrafield feature on Proposal lines. +- New: [ task #928 ] Add extrafield feature on invoice lines. For translators: - Update language files. From 596be3ae44924b8fe1936795d1644b6d71fb2873 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 29 Apr 2014 09:43:16 +0200 Subject: [PATCH 4/4] Trad contact card --- htdocs/contact/fiche.php | 4 ++-- htdocs/langs/en_US/mails.lang | 1 + htdocs/langs/fr_FR/mails.lang | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 98874ba4804..08f3bb2c062 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -711,7 +711,7 @@ else if (! empty($conf->mailing->enabled)) { $langs->load("mails"); - print ''.$langs->trans("NbOfEMailingsReceived").''; + print ''.$langs->trans("NbOfEMailingsSend").''; print ''.$object->getNbOfEMailings().''; } else @@ -936,7 +936,7 @@ else if (! empty($conf->mailing->enabled)) { $langs->load("mails"); - print ''.$langs->trans("NbOfEMailingsReceived").''; + print ''.$langs->trans("NbOfEMailingsSend").''; print ''.$object->getNbOfEMailings().''; } else diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 78d59e4c93d..2fd9c09c534 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -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 comma separator to specify several recipients. diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index 80f159ffa26..2fad3fb790e 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -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 virgule pour spécifier plusieurs destinataires.