diff --git a/ChangeLog b/ChangeLog index 310d618d0ef..0e8f03346db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,7 @@ For users: from their email on gravatar.com. - New: Include Dolibarr version in suggested dump filename. - New: Enhancement in project module. +- New: Add log tab on emailing module. - Fix: Error Call to a member function trans when refusing a supplier order. - Fix: Fix payment conditions on commercial proposals. - Fix: Nb of orders to process was wrong. diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 7b723da0320..e49326dd665 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -25,9 +25,13 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/emailing.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); $langs->load("mails"); +// Security check if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden(); @@ -150,28 +154,15 @@ if ($_POST["button_removefilter"]) llxHeader("","",$langs->trans("MailCard")); +$html = new Form($db); + $mil = new Mailing($db); -$html = new Form($db); if ($mil->fetch($_REQUEST["id"]) >= 0) { + $head = emailing_prepare_head($mil); - $h=0; - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id; - $head[$h][1] = $langs->trans("MailCard"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$mil->id; - $head[$h][1] = $langs->trans("MailRecipients"); - $hselected = $h; - $h++; - - /* - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$mil->id; - $head[$h][1] = $langs->trans("MailHistory"); - $h++; - */ - dol_fiche_head($head, $hselected, $langs->trans("Mailing")); + dol_fiche_head($head, 'targets', $langs->trans("Mailing"), 0, 'email'); print ''; @@ -180,10 +171,22 @@ if ($mil->fetch($_REQUEST["id"]) >= 0) print ''; + print ''; + print ''; + + // Errors to + print ''; + + // Status print ''; + + // Nb of distinct emails print ''; + print '
'; print $html->showrefnav($mil,'id'); print '
'.$langs->trans("MailTitle").''.$mil->titre.'
'.$langs->trans("MailFrom").''.htmlentities($mil->email_from).'
'.$langs->trans("MailErrorsTo").''.htmlentities($mil->email_errorsto); + if (! empty($mil->email_errorsto) && ! isValidEMail($mil->email_errorsto)) print img_warning($langs->trans("BadEMail")); + print '
'.$langs->trans("Status").''.$mil->getLibStatut(4).'
'.$langs->trans("TotalNbOfDistinctRecipients").''.($mil->nbemail?$mil->nbemail:'0').'
'; print ""; @@ -195,15 +198,14 @@ if ($mil->fetch($_REQUEST["id"]) >= 0) // Affiche les listes de selection if ($mil->statut == 0) { - print_titre($langs->trans("ToAddRecipientsChooseHere")); + print_fiche_titre($langs->trans("ToAddRecipientsChooseHere"),($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''),''); + print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; clearstatcache(); @@ -317,7 +319,7 @@ if ($mil->fetch($_REQUEST["id"]) >= 0) print_titre($langs->trans("ToClearAllRecipientsClickHere")); print '
'.$langs->trans("RecipientSelectionModules"); - if ($user->admin) print ' '.info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1); - print ''.$langs->trans("NbOfUniqueEMails").''.$langs->trans("Filter").' '.$langs->trans("RecipientSelectionModules").''.$langs->trans("NbOfUniqueEMails").''.$langs->trans("Filter").' 
'; print ''; - print ''; + print ''; print ''; print '
'; print ''; @@ -367,7 +369,7 @@ if ($mil->fetch($_REQUEST["id"]) >= 0) // Date if ($mil->statut < 2) { - print ' '; + print ' '; } else { diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 67b269954b6..8fbd85bdcb4 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -25,6 +25,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/emailing.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/comm/mailing/mailing.class.php"); @@ -526,22 +527,9 @@ else { if ($mil->fetch($_GET["id"]) >= 0) { - $h=0; - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id; - $head[$h][1] = $langs->trans("MailCard"); - $hselected = $h; - $h++; + $head = emailing_prepare_head($mil); - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$mil->id; - $head[$h][1] = $langs->trans('MailRecipients'); - $h++; - - /* - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$mil->id; - $head[$h][1] = $langs->trans("MailHistory"); - $h++; - */ - dol_fiche_head($head, $hselected, $langs->trans("Mailing")); + dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email'); // Confirmation de la validation du mailing if ($_GET["action"] == 'valide') @@ -601,34 +589,18 @@ else print ''.$langs->trans("MailFrom").''.htmlentities($mil->email_from); if (! isValidEMail($mil->email_from)) print img_warning($langs->trans("BadEMail")); print ''; + + // Errors to print ''.$langs->trans("MailErrorsTo").''.htmlentities($mil->email_errorsto); if (! empty($mil->email_errorsto) && ! isValidEMail($mil->email_errorsto)) print img_warning($langs->trans("BadEMail")); print ''; + + // Status print ''.$langs->trans("Status").''.$mil->getLibStatut(4).''; + + // Nb of distinct emails print ''.$langs->trans("TotalNbOfDistinctRecipients").''.($mil->nbemail?$mil->nbemail:''.$langs->trans("NoTargetYet").'').''; - $uc = new User($db, $mil->user_creat); - $uc->fetch(); - print ''.$langs->trans("CreatedBy").''.$uc->getNomUrl(1).''; - print ''.$langs->trans("Date").''; - print ''.dol_print_date($mil->date_creat,"dayhour").''; - - if ($mil->statut > 0) - { - $uv = new User($db, $mil->user_valid); - $uv->fetch(); - print ''.$langs->trans("ValidatedBy").''.$uv->getNomUrl(1).''; - print ''.$langs->trans("Date").''; - print ''.dol_print_date($mil->date_valid,"dayhour").''; - } - - if ($mil->statut > 1) - { - print ''.$langs->trans("SentBy").''.$langs->trans("Unknown").''; - print ''.$langs->trans("Date").''; - print ''.dol_print_date($mil->date_envoi,"dayhour").''; - } - // Subject print ''.$langs->trans("MailTopic").''.$mil->sujet.''; diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php new file mode 100644 index 00000000000..160615fcf64 --- /dev/null +++ b/htdocs/comm/mailing/info.php @@ -0,0 +1,69 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/comm/mailing/info.php + * \ingroup mailing + * \brief Page with log information for emailing + * \version $Id$ + */ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/emailing.lib.php"); + +$langs->load("mails"); + +// Security check +if (! $user->rights->mailing->lire || $user->societe_id > 0) +accessforbidden(); + + + +/* + * View + */ + +llxHeader(); + +$html = new Form($db); + +$mil = new Mailing($db); + +if ($mil->fetch($_REQUEST["id"]) >= 0) +{ + $head = emailing_prepare_head($mil); + + dol_fiche_head($head, 'info', $langs->trans("Mailing"), 0, 'email'); + + + print '
'; + $mil->user_creation=$mil->user_creat; + $mil->date_creation=$mil->date_creat; + $mil->user_validation=$mil->user_valid; + $mil->date_validation=$mil->date_valid; + dol_print_object_info($mil); + print '
'; + + print ''; +} + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/includes/modules/mailings/kiwi.modules.php b/htdocs/includes/modules/mailings/kiwi.modules.php index 3cb03e6219a..865ac175f46 100644 --- a/htdocs/includes/modules/mailings/kiwi.modules.php +++ b/htdocs/includes/modules/mailings/kiwi.modules.php @@ -10,10 +10,10 @@ */ /** - \file htdocs/includes/modules/mailings/kiwi.modules.php - \ingroup mailing - \brief Example file to provide a list of recipients for mailing module - \version $Revision$ + * \file htdocs/includes/modules/mailings/kiwi.modules.php + * \ingroup mailing + * \brief Example file to provide a list of recipients for mailing module + * \version $Revision$ */ include_once DOL_DOCUMENT_ROOT.'/includes/modules/mailings/modules_mailings.php'; @@ -181,7 +181,7 @@ class mailing_kiwi extends MailingTargets $type=''; if ($obj->type == 1) $type=$langs->trans("Supplier"); if ($obj->type == 2) $type=$langs->trans("Customer"); - $s.=''; $i++; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 3807c4bf82a..3ed27d0730f 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -66,6 +66,7 @@ CloneEMailing=Clone Emailing ConfirmCloneEMailing=Are you sure you want to clone this emailing ? CloneContent=Clone message CloneReceivers=Cloner recipients +DateLastSend=Date of last sending # Libelle des modules de liste de destinataires mailing MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...) diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index 26bc686a539..9d2bd88ebdd 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -50,7 +50,7 @@ ConfirmValidMailing=Confirmez-vous la validation du mailing ? ConfirmResetMailing=Attention, en réinitialisation le mailing %s, vous autorisez son émission en masse une nouvelle fois. Est-ce bien ce que vous voulez faire ? ConfirmDeleteMailing=Confirmez-vous la suppression du mailing ? NbOfRecipients=Nombre de destinataires -NbOfUniqueEMails=Nb d'e-mails uniques +NbOfUniqueEMails=Nb d'emails uniques NbOfEMails=Nbre d'EMails TotalNbOfDistinctRecipients=Nombre de destinataires uniques NoTargetYet=Aucun destinataire défini (Aller sur l'onglet Destinataires) @@ -66,6 +66,7 @@ CloneEMailing=Cloner Emailing ConfirmCloneEMailing=Etes-vous sur de vouloir cloner cet emailing ? CloneContent=Cloner message CloneReceivers=Cloner destinataires +DateLastSend=Date du dernier envoi # Libelle des modules de liste de destinataires mailing MailingModuleDescContactCompanies=Contacts des tiers (prospects, clients, fournisseurs...) @@ -91,7 +92,7 @@ MailingNeedCommand=Pour des raisons de sécurité, il est recommandé de faire l MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer en ligne en ajoutant le parametre MAILING_LIMIT_SENDBYWEB avec la valeur du nombre max de mails envoyés par session d'envoi. ConfirmSendingEmailing=Confirmez-vous l'envoi de l'emailing ?
L'envoi en ligne des emailings sont limités par sécurité à %s destinataires par session d'envoi. TargetsReset=Vider liste -ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de ce mailing, cliquer le bouton +ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de cet emailing, cliquer le bouton ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous NbOfEMailingsReceived=EMailings de masse reçus IdRecord=ID enregistrement diff --git a/htdocs/lib/emailing.lib.php b/htdocs/lib/emailing.lib.php new file mode 100644 index 00000000000..a0c30e1dedf --- /dev/null +++ b/htdocs/lib/emailing.lib.php @@ -0,0 +1,57 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/lib/emailing.lib.php + * \brief Library file with function for emailing module + * \version $Id$ + */ + +/** + * Enter description here... + * + * @param unknown_type $contrat + * @return unknown + */ +function emailing_prepare_head($mil) +{ + global $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id; + $head[$h][1] = $langs->trans("MailCard"); + $head[$h][2] = 'card'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$mil->id; + $head[$h][1] = $langs->trans("MailRecipients"); + $head[$h][2] = 'targets'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$mil->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + + return $head; +} + +?> \ No newline at end of file