New: Add list of notifications sent in notification module
This commit is contained in:
parent
46fafeab6a
commit
950555a2fc
@ -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
|
||||
ListOfActiveNotifications=List all active email notification requests
|
||||
ListOfNotificationsDone=List all email notifications sent
|
||||
@ -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
|
||||
ListOfActiveNotifications=Liste des demandes de notifications emails actives
|
||||
ListOfNotificationsDone=Liste des notifications emails envoyées
|
||||
@ -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) )
|
||||
{
|
||||
|
||||
@ -191,7 +191,7 @@ if ( $soc->fetch($soc->id) )
|
||||
print '<td>';
|
||||
$html->select_array("actionid",$actions);
|
||||
print '</td>';
|
||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
@ -245,7 +245,7 @@ if ( $soc->fetch($soc->id) )
|
||||
print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail");
|
||||
print '</td>';
|
||||
print '<td>'.$obj->titre.'</td>';
|
||||
print'<td align="center"><a href="fiche.php?socid='.$socid.'&action=delete&actid='.$obj->rowid.'">'.img_delete().'</a>';
|
||||
print '<td align="right"><a href="fiche.php?socid='.$socid.'&action=delete&actid='.$obj->rowid.'">'.img_delete().'</a></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -257,7 +257,59 @@ if ( $soc->fetch($soc->id) )
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
// List of notifications done
|
||||
print_fiche_titre($langs->trans("ListOfNotificationsDone"),'','');
|
||||
$var=true;
|
||||
|
||||
// Ligne de titres
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
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 '</tr>';
|
||||
|
||||
// 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 '<tr '.$bc[$var].'><td>'.$contactstatic->getNomUrl(1);
|
||||
print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail");
|
||||
print '</td>';
|
||||
print '<td>'.$obj->titre.'</td>';
|
||||
print'<td align="right">'.dol_print_date($db->jdate($obj->daten)).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user