From 36630b94046af3f7b35c961632ab0d62bf8ef145 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Tue, 21 Mar 2017 13:01:32 +0100
Subject: [PATCH] FIX Picto of project on dol_banner and box

Conflicts:
	htdocs/core/boxes/box_project.php
---
 htdocs/core/boxes/box_project.php | 14 +++++++-------
 htdocs/core/lib/functions.lib.php |  6 ++++--
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php
index 4c0689cd282..8b5cbc342e6 100644
--- a/htdocs/core/boxes/box_project.php
+++ b/htdocs/core/boxes/box_project.php
@@ -78,7 +78,7 @@ class box_project extends ModeleBoxes
 		// list the summary of the orders
 		if ($user->rights->projet->lire) {
 
-			$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut ";
+			$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
 			$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
             if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
 			$sql.= " WHERE p.entity = ".$conf->entity;
@@ -98,7 +98,7 @@ class box_project extends ModeleBoxes
                     $tooltip = $langs->trans('Project') . ': ' . $objp->ref;
                     $this->info_box_contents[$i][0] = array(
                         'td' => 'align="left" width="16"',
-                        'logo' => 'object_project',
+                        'logo' => 'object_project'.($objp->public?'pub':''),
                         'tooltip' => $tooltip,
                         'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid,
                     );
@@ -123,13 +123,13 @@ class box_project extends ModeleBoxes
 					if ($resultTask) {
 						$objTask = $db->fetch_object($resultTask);
                         $this->info_box_contents[$i][3] = array(
-                            'td' => 'align="right"',
-                            'text' => number_format($objTask->nb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"),
+                            'td' => 'class="right"',
+                            'text' => $objTask->nb."&nbsp;".$langs->trans("Tasks"),
                         );
-						if ($objTask->nb  > 0 )
+						if ($objTask->nb  > 0)
                             $this->info_box_contents[$i][4] = array(
-                                'td' => 'align="right"',
-                                'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%",
+                                'td' => 'class="right"',
+                                'text' => round($objTask->totprogress/$objTask->nb, 0)."%",
                             );
 						else
 							$this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A&nbsp;");
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 709dc58d769..b2de5ff9d54 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1024,7 +1024,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
                     $morehtmlleft.='</div>';
                 }
             }
-            elseif ($conf->browser->layout != 'phone')      // Show no photo link
+            elseif ($conf->browser->layout != 'phone')      // Show No photo link (picto of pbject)
             {
                 $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
                 if ($object->element == 'action') 
@@ -1036,7 +1036,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
                 else
                 {
                     $width=14; $cssclass='photorefcenter';
-    				$nophoto=img_picto('', 'object_'.$object->picto, '', false, 1);
+                    $picto = $object->picto;
+                    if ($object->element == 'project' && ! $object->public) $picto = 'project'; // instead of projectpub
+    				$nophoto=img_picto('', 'object_'.$picto, '', false, 1);
     				$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.$nophoto.'"></div></div>';
                 }
                 $morehtmlleft.='</div>';
-- 
GitLab