From 60b1591f0ea029b2192969d9cf8d3cb54804d30c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 23 Nov 2016 20:30:43 +0100
Subject: [PATCH] Fix the notes must not be into the tooltip of ref.

---
 htdocs/compta/facture/class/facture.class.php | 20 +++++++++++++++++--
 htdocs/compta/facture/list.php                | 11 +++-------
 htdocs/core/class/html.formfile.class.php     |  2 +-
 3 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 83390414905..0604c73d0fb 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -999,11 +999,12 @@ class Facture extends CommonInvoice
 	 *      @param  int		$short           1=Return just URL
 	 *      @param  string  $moretitle       Add more text to title tooltip
      *      @param	int  	$notooltip		 1=Disable tooltip
+     *      @param  int     $addlinktonote   1=Add link to notes
 	 *      @return string 			         String with URL
 	 */
-	function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0)
+	function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0,$addlinktonotes=0)
 	{
-		global $langs, $conf, $user;
+		global $langs, $conf, $user, $form;
 
         if (! empty($conf->dol_no_mouse_hover)) $notooltip=1;   // Force disable tooltips
 
@@ -1058,6 +1059,21 @@ class Facture extends CommonInvoice
         if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
 		if ($withpicto && $withpicto != 2) $result.=' ';
 		if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend;
+
+		if ($addlinktonotes)
+		{
+		    $txttoshow=($user->societe_id>0?$this->note_public:$this->note_private);
+		    if ($txttoshow)
+		    {
+                $notetoshow=$langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow,1);
+    		    $result.=' <span class="note inline-block">';
+    		    $result.='<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">'.img_picto('','object_generic').'</a>';
+    		    //$result.=img_picto($langs->trans("ViewNote"),'object_generic');
+    		    //$result.='</a>';
+    		    $result.='</span>';
+		    }
+		}
+		
 		return $result;
 	}
 
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 48ed568e3f9..c38c8060bd7 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -866,30 +866,25 @@ if ($resql)
             $facturestatic->statut=$obj->fk_statut;
             $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
             $facturestatic->type=$obj->type;
+            $facturestatic->note_public=$obj->note_public;
+            $facturestatic->note_private=$obj->note_private;
             
             print '<tr '.$bc[$var].'>';
     		if (! empty($arrayfields['f.facnumber']['checked']))
     		{
                 print '<td class="nowrap">';
     
-                $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
                 $paiement = $facturestatic->getSommePaiement();
 				$remaintopay = $obj->total_ttc - $paiement;
     
                 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
     
                 print '<td class="nobordernopadding nowrap">';
-                print $facturestatic->getNomUrl(1,'',200,0,$notetoshow);
+                print $facturestatic->getNomUrl(1,'',200,0,'',0,1);
                 print $obj->increment;
                 print '</td>';
     
                 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
-                if (! empty($obj->note_private))
-                {
-    				print ' <span class="note">';
-    				print '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$obj->facid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
-    				print '</span>';
-    			}
                 $filename=dol_sanitizeFileName($obj->facnumber);
                 $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
                 $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->facid;
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index d79eaae65f0..28b9517fe0b 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -802,7 +802,7 @@ class FormFile
 		$out.= '<!-- html.formfile::getDocumentsLink -->'."\n";
     	if (! empty($file_list))
     	{
-    	    $out='<dl class="dropdown">
+    	    $out='<dl class="dropdown inline-block">
     			<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight').'</a></dt>
     			<dd><div class="multichoicedoc"><ul class="ulselectedfields" style="display: none;">';
     	    $tmpout='';
-- 
GitLab