From aa6394de85e67aa2f9bff0cfa6f1186efd0653c8 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 7 May 2008 00:43:41 +0000
Subject: [PATCH] Fix: Action shown late when not

---
 htdocs/actioncomm.class.php | 4 ++--
 htdocs/index.php            | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php
index 2e997c7341f..065b1236b99 100644
--- a/htdocs/actioncomm.class.php
+++ b/htdocs/actioncomm.class.php
@@ -374,7 +374,7 @@ class ActionComm
         global $conf, $user;
         
         $this->nbtodo=$this->nbtodolate=0;
-        $sql = "SELECT a.id,".$this->db->pdate("a.datea")." as da";
+        $sql = "SELECT a.id,".$this->db->pdate("a.datep")." as dp";
         if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
         $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
         if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -387,7 +387,7 @@ class ActionComm
             while ($obj=$this->db->fetch_object($resql))
             {
                 $this->nbtodo++;
-                if ($obj->da < (time() - $conf->actions->warning_delay)) $this->nbtodolate++;
+                if ($obj->dp < (time() - $conf->actions->warning_delay)) $this->nbtodolate++;
             }
             return 1;
         }
diff --git a/htdocs/index.php b/htdocs/index.php
index 36622f84af4..b07c619b958 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -254,12 +254,13 @@ print '</tr>';
 
 $nboflate=0;
 $var=true;
+
 //
 // Ne pas inclure de sections sans gestion de permissions
 //
 
 // Nbre actions � faire (en retard)
-if ($conf->commercial->enabled || $conf->compta->enabled || $conf->comptaexpert->enabled)
+if ($conf->agenda->enabled && $user->rights->agenda->myactions->read)
 {
   include_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
   $board=new ActionComm($db);
-- 
GitLab