';
$boxwork.='| ';
$text='';
- if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate).')';
+ if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
$text.='. '.$langs->trans("LateDesc");
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
$options='height="64px"';
@@ -686,15 +688,17 @@ $db->close();
function showWeather($totallate,$text,$options)
{
global $conf;
-
+
$out='';
$offset=0;
$factor=10; // By default
- $level0=$offset; if (! empty($conf->global->MAIN_METEO_LEVEL0)) $level0=$conf->global->MAIN_METEO_LEVEL0;
- $level1=$offset+1*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
- $level2=$offset+2*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
- $level3=$offset+3*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
+ $used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL';
+
+ $level0=$offset; if (! empty($conf->global->{$used_conf.'0'})) $level0=$conf->global->{$used_conf.'0'};
+ $level1=$offset+1*$factor; if (! empty($conf->global->{$used_conf.'1'})) $level1=$conf->global->{$used_conf.'1'};
+ $level2=$offset+2*$factor; if (! empty($conf->global->{$used_conf.'2'})) $level2=$conf->global->{$used_conf.'2'};
+ $level3=$offset+3*$factor; if (! empty($conf->global->{$used_conf.'3'})) $level3=$conf->global->{$used_conf.'3'};
if ($totallate <= $level0) $out.=img_weather($text,'weather-clear.png',$options);
if ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text,'weather-few-clouds.png',$options);
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index da8188e7a75..bd868cf4e9e 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1089,6 +1089,11 @@ ShowProfIdInAddress=Show professionnal id with addresses on documents
ShowVATIntaInAddress=Hide VAT Intra num with addresses on documents
TranslationUncomplete=Partial translation
MAIN_DISABLE_METEO=Disable meteo view
+MeteoStdMod=Standard mode
+MeteoStdModEnabled=Standard mode enabled
+MeteoPercentageMod=Percentage mode
+MeteoPercentageModEnabled=Percentage mode enabled
+MeteoUseMod=Click to use %s
TestLoginToAPI=Test login to API
ProxyDesc=Some features of Dolibarr need to have an Internet access to work. Define here parameters for this. If the Dolibarr server is behind a Proxy server, those parameters tells Dolibarr how to access Internet through it.
ExternalAccess=External access
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 10a78e017c8..32ae678b016 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -1693,8 +1693,8 @@ class Task extends CommonObject
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
-
-
+
+
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
@@ -1703,65 +1703,114 @@ class Task extends CommonObject
*/
function load_board($user)
{
- global $conf, $langs;
-
- $mine=0; $socid=$user->societe_id;
-
- $projectstatic = new Project($this->db);
- $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
-
- // List of tasks (does not care about permissions. Filtering will be done later)
- $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
- $sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
- $sql.= " t.dateo as date_start, t.datee as datee";
- $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
- if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
- $sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
- $sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
- $sql.= " AND p.fk_statut = 1";
- $sql.= " AND t.fk_projet = p.rowid";
- $sql.= " AND t.progress < 100"; // tasks to do
- if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
- // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
- //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
- if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
- if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
- //print $sql;
- $resql=$this->db->query($sql);
- if ($resql)
- {
- $task_static = new Task($this->db);
-
- $response = new WorkboardResponse();
- $response->warning_delay = $conf->projet->task->warning_delay/60/60/24;
- $response->label = $langs->trans("OpenedTasks");
- if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
- else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project';
- $response->img = img_object('',"task");
-
- // This assignment in condition is not a bug. It allows walking the results.
- while ($obj=$this->db->fetch_object($resql))
- {
- $response->nbtodo++;
-
- $task_static->projectstatus = $obj->projectstatus;
- $task_static->progress = $obj->progress;
- $task_static->fk_statut = $obj->status;
- $task_static->date_end = $this->db->jdate($obj->datee);
-
- if ($task_static->hasDelay()) {
- $response->nbtodolate++;
- }
- }
-
- return $response;
- }
- else
- {
- $this->error=$this->db->error();
- return -1;
- }
+ global $conf, $langs;
+
+ $mine=0; $socid=$user->societe_id;
+
+ $projectstatic = new Project($this->db);
+ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
+
+ // List of tasks (does not care about permissions. Filtering will be done later)
+ $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
+ $sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
+ $sql.= " t.dateo as date_start, t.datee as datee";
+ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
+ if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
+ $sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
+ $sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
+ $sql.= " AND p.fk_statut = 1";
+ $sql.= " AND t.fk_projet = p.rowid";
+ $sql.= " AND t.progress < 100"; // tasks to do
+ if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
+ // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
+ //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
+ if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
+ if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
+ //print $sql;
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $task_static = new Task($this->db);
+
+ $response = new WorkboardResponse();
+ $response->warning_delay = $conf->projet->task->warning_delay/60/60/24;
+ $response->label = $langs->trans("OpenedTasks");
+ if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
+ else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project';
+ $response->img = img_object('',"task");
+
+ // This assignment in condition is not a bug. It allows walking the results.
+ while ($obj=$this->db->fetch_object($resql))
+ {
+ $response->nbtodo++;
+
+ $task_static->projectstatus = $obj->projectstatus;
+ $task_static->progress = $obj->progress;
+ $task_static->fk_statut = $obj->status;
+ $task_static->date_end = $this->db->jdate($obj->datee);
+
+ if ($task_static->hasDelay()) {
+ $response->nbtodolate++;
+ }
+ }
+
+ return $response;
+ }
+ else
+ {
+ $this->error=$this->db->error();
+ return -1;
+ }
+ }
+
+
+ /**
+ * Charge indicateurs this->nb de tableau de bord
+ *
+ * @return int <0 if ko, >0 if ok
+ */
+ function load_state_board()
+ {
+ global $user;
+
+ $mine=0; $socid=$user->societe_id;
+
+ $projectstatic = new Project($this->db);
+ $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
+
+ // List of tasks (does not care about permissions. Filtering will be done later)
+ $sql = "SELECT count(p.rowid) as nb";
+ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
+ if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
+ $sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
+ $sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
+ $sql.= " AND t.fk_projet = p.rowid"; // tasks to do
+ if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
+ // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
+ //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
+ if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
+ if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+
+ // This assignment in condition is not a bug. It allows walking the results.
+ while ($obj=$this->db->fetch_object($resql))
+ {
+ $this->nb["tasks"]=$obj->nb;
+ }
+ $this->db->free($resql);
+ return 1;
+ }
+ else
+ {
+ dol_print_error($this->db);
+ $this->error=$this->db->error();
+ return -1;
+ }
}
/**
|