diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index c7eb5bf5c27..57124e15868 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -106,4 +106,5 @@ NoNotificationsWillBeSent=No email notifications are planned for this event and ANotificationsWillBeSent=1 notification will be sent by email SomeNotificationsWillBeSent=%s notifications will be sent by email AddNewNotification=Activate a new email notification request -ListOfActiveNotifications=List all active email notification requests \ No newline at end of file +ListOfActiveNotifications=List all active email notification requests +ListOfNotificationsDone=List all email notifications sent \ No newline at end of file diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index c3c0591c009..d3d755f5bab 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -106,4 +106,5 @@ NoNotificationsWillBeSent=Aucune notification par email n'est prévue pour cet ANotificationsWillBeSent=1 notification va être envoyée par email SomeNotificationsWillBeSent=%s notifications vont être envoyées par email AddNewNotification=Activer une nouvelle demande de notification email -ListOfActiveNotifications=Liste des demandes de notifications emails actives \ No newline at end of file +ListOfActiveNotifications=Liste des demandes de notifications emails actives +ListOfNotificationsDone=Liste des notifications emails envoyées \ No newline at end of file diff --git a/htdocs/notify.class.php b/htdocs/notify.class.php index 84ec110a696..6dfdb1b43ee 100644 --- a/htdocs/notify.class.php +++ b/htdocs/notify.class.php @@ -130,7 +130,7 @@ class Notify dol_syslog("Notify::send action=$action, socid=$socid, texte=$texte, objet_type=$objet_type, objet_id=$objet_id, file=$file"); - $sql = "SELECT s.nom, c.email, c.rowid, c.name, c.firstname,"; + $sql = "SELECT s.nom, c.email, c.rowid as cid, c.name, c.firstname,"; $sql.= " a.rowid as adid, a.titre, a.code, n.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; @@ -177,7 +177,7 @@ class Notify $sendto = htmlentities($sendto); $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)"; - $sql.= " VALUES (".$this->db->idate(mktime()).", ".$actiondefid." ,".$obj->rowid." , '".$objet_type."', ".$objet_id.", '".addslashes($obj->email)."')"; + $sql.= " VALUES (".$this->db->idate(mktime()).", ".$actiondefid." ,".$obj->cid." , '".$objet_type."', ".$objet_id.", '".addslashes($obj->email)."')"; dol_syslog("Notify::send sql=".$sql); if (! $this->db->query($sql) ) { diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index aa57ff6cf96..e1efdd38521 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -191,7 +191,7 @@ if ( $soc->fetch($soc->id) ) print ''; $html->select_array("actionid",$actions); print ''; - print ''; + print ''; print ''; } else @@ -245,7 +245,7 @@ if ( $soc->fetch($soc->id) ) print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); print ''; print ''.$obj->titre.''; - print''.img_delete().''; + print ''.img_delete().''; print ''; $i++; } @@ -257,7 +257,59 @@ if ( $soc->fetch($soc->id) ) } print ''; + print '
'; + + // List of notifications done + print_fiche_titre($langs->trans("ListOfNotificationsDone"),'',''); + $var=true; + + // Ligne de titres + print ''; + print ''; + print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',"&socid=$socid",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),"fiche.php","a.titre",'',"&socid=$socid",'align="right"',$sortfield,$sortorder); + print ''; + + // Liste + $sql = "SELECT c.rowid as id, c.name, c.firstname, c.email, a.titre, n.rowid, n.daten, n.email"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify as n"; + $sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; + + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + $contactstatic=new Contact($db); + + while ($i < $num) + { + $var = !$var; + + $obj = $db->fetch_object($resql); + + $contactstatic->id=$obj->id; + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + print ''; + print ''; + print''; + print ''; + $i++; + } + $db->free($resql); + } + else + { + dol_print_error($db); + } + + print '
'.$contactstatic->getNomUrl(1); + print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); + print ''.$obj->titre.''.dol_print_date($db->jdate($obj->daten)).'
'; } $db->close();