New: Add number of active notification into tab title (like we do for

notes and documents)
This commit is contained in:
Laurent Destailleur 2014-10-12 12:22:45 +02:00
parent f08759a17e
commit 65f47f7d10
2 changed files with 23 additions and 1 deletions

View File

@ -5,6 +5,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
- New: Add number of active notification into tab title (like we do for notes and documents)
- New: Can add product into category from category card.
- New: PDF event report show project and status of event.
- New: Can filter on status on interventions.

View File

@ -37,7 +37,7 @@
*/
function societe_prepare_head($object)
{
global $langs, $conf, $user;
global $db, $langs, $conf, $user;
$h = 0;
$head = array();
@ -109,8 +109,29 @@ function societe_prepare_head($object)
// Notifications
if (! empty($conf->notification->enabled))
{
$nbNote = 0;
$sql = "SELECT COUNT(n.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";
$sql.= " WHERE fk_soc = ".$object->id;
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$nbNote=$obj->nb;
$i++;
}
}
else {
dol_print_error($db);
}
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Notifications");
if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
$head[$h][2] = 'notify';
$h++;
}