From fe43d10c79b38f30f2427ec618aad86ff3a91a59 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Tue, 6 May 2014 23:42:19 +0200
Subject: [PATCH] Fix: [ bug #1360 ] note indicator for member tab.

---
 ChangeLog                      | 1 +
 htdocs/adherents/note.php      | 4 ++--
 htdocs/core/lib/member.lib.php | 7 ++++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 319162f5a11..07cd416c214 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@ Fix: Navigation on notes for shipments was not working.
 Fix: [ bug #1353 ] Email notifications, wrong URL.
 Fix: [ bug #1362 ] Note is not saved.
 Fix: tr/td balance.
+Fix: [ bug #1360 ] note indicator for member tab.
 
 ***** ChangeLog for 3.5.2 compared to 3.5.1 *****
 Fix: Can't add user for a task.
diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php
index d92447434d4..9b9a466dbdd 100644
--- a/htdocs/adherents/note.php
+++ b/htdocs/adherents/note.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2004      Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2007 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2014 Laurent Destailleur  <eldy@users.sourceforge.net>
  *
  * 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
@@ -19,7 +19,7 @@
 /**
  *      \file       htdocs/adherents/note.php
  *      \ingroup    member
- *      \brief      Fiche de notes sur un adherent
+ *      \brief      Tabe for note of a member
 */
 
 require '../main.inc.php';
diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php
index 8ec1fdd4070..2c775b6d739 100644
--- a/htdocs/core/lib/member.lib.php
+++ b/htdocs/core/lib/member.lib.php
@@ -81,9 +81,14 @@ function member_prepare_head($object)
     // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
     complete_head_from_modules($conf,$langs,$object,$head,$h,'member');
 
+    $nbNote = 0;
+    if(!empty($object->note)) $nbNote++;
+    if(!empty($object->note_private)) $nbNote++;
+    if(!empty($object->note_public)) $nbNote++;
     $head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id;
 	$head[$h][1] = $langs->trans("Note");
 	$head[$h][2] = 'note';
+    if($nbNote > 0) $head[$h][1].= ' ('.$nbNote.')';
 	$h++;
 
     $head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
@@ -130,7 +135,7 @@ function member_admin_prepare_head()
     $head[$h][1] = $langs->trans("ExtraFieldsMember");
     $head[$h][2] = 'attributes';
     $h++;
-    
+
     $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_type_extrafields.php';
     $head[$h][1] = $langs->trans("ExtraFieldsMemberType");
     $head[$h][2] = 'attributes_type';
-- 
GitLab