diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php
index 888459c006b..26e208c979d 100644
--- a/htdocs/societe/notify/card.php
+++ b/htdocs/societe/notify/card.php
@@ -52,7 +52,7 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
-if (! $sortfield) $sortfield="a.daten";
+if (! $sortfield) $sortfield="n.daten";
$now=dol_now();
@@ -264,8 +264,30 @@ if ($result > 0)
print '';
print '
';
+
+ // List of notifications enabled for contacts
+ $sql = "SELECT n.rowid, n.type,";
+ $sql.= " a.code, a.label,";
+ $sql.= " c.rowid as contactid, c.lastname, c.firstname, c.email";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";
+ $sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
+ $sql.= " ".MAIN_DB_PREFIX."socpeople c";
+ $sql.= " WHERE a.rowid = n.fk_action";
+ $sql.= " AND c.rowid = n.fk_contact";
+ $sql.= " AND c.fk_soc = ".$object->id;
+
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+
// List of active notifications
- print load_fiche_titre($langs->trans("ListOfActiveNotifications"),'','');
+ print load_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')','','');
$var=true;
// Line with titles
@@ -280,21 +302,8 @@ if ($result > 0)
$langs->load("errors");
$langs->load("other");
- // List of notifications enabled for contacts
- $sql = "SELECT n.rowid, n.type,";
- $sql.= " a.code, a.label,";
- $sql.= " c.rowid as contactid, c.lastname, c.firstname, c.email";
- $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";
- $sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
- $sql.= " ".MAIN_DB_PREFIX."socpeople c";
- $sql.= " WHERE a.rowid = n.fk_action";
- $sql.= " AND c.rowid = n.fk_contact";
- $sql.= " AND c.fk_soc = ".$object->id;
-
- $resql=$db->query($sql);
- if ($resql)
+ if ($num)
{
- $num = $db->num_rows($resql);
$i = 0;
$contactstatic=new Contact($db);
@@ -336,10 +345,6 @@ if ($result > 0)
}
$db->free($resql);
}
- else
- {
- dol_print_error($db);
- }
// List of notifications enabled for fixed email
/*
@@ -395,20 +400,6 @@ if ($result > 0)
print '
';
- // List of notifications done
- print load_fiche_titre($langs->trans("ListOfNotificationsDone"),'','');
- $var=true;
-
- // Line with titles
- print '