From ff31fff2d7a5248837d31edd7a6202b595a98d7e Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 21:34:18 +0200 Subject: [PATCH 01/11] Create box_task.php add boxes of tasks --- htdocs/core/boxes/box_task.php | 128 +++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 htdocs/core/boxes/box_task.php diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php new file mode 100644 index 00000000000..6e3b73b65db --- /dev/null +++ b/htdocs/core/boxes/box_task.php @@ -0,0 +1,128 @@ + + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_task.php + * \ingroup Projet + * \brief Module to Task activity of the current year + * \version $Id: box_task.php,v 1.1 2012/09/11 Charles-François BENKE + */ + +include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); + +class box_task extends ModeleBoxes { + + var $boxcode="projet"; + var $boximg="object_projecttask"; + var $boxlabel; + //var $depends = array("projet"); + var $db; + var $param; + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + */ + function box_task() + { + global $langs; + $langs->load("boxes"); + $langs->load("projects"); + $this->boxlabel="Tasks"; + } + + /** + * \brief Charge les donnees en memoire pour affichage ulterieur + * \param $max Nombre maximum d'enregistrements a charger + */ + function loadBox($max=5) + { + global $conf, $user, $langs, $db; + + $this->max=$max; + + $totalMnt = 0; + $totalnb = 0; + $totalDuree=0; + include_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php"); + $taskstatic=new Task($db); + + + $textHead = $langs->trans("Tasks")." ".date("Y"); + $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); + + // list the summary of the orders + if ($user->rights->projet->lire) + { + + $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(pt.total_ht) as Mnttot, sum(pt.planned_workload) as Dureetot"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; + $sql.= " WHERE DATE_FORMAT(pt.datec,'%Y') = ".date("Y")." "; + $sql.= " GROUP BY pt.fk_statut "; + $sql.= " ORDER BY pt.fk_statut DESC"; + $sql.= $db->plimit($max, 0); + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask'); + + $objp = $db->fetch_object($result); + $this->info_box_contents[$i][1] = array('td' => 'align="left"', + 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0) + ); + + $this->info_box_contents[$i][2] = array('td' => 'align="right"', + 'text' => $objp->nb." ".$langs->trans("Tasks"), + 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut + ); + $totalnb += $objp->nb; + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->Dureetot,'all',25200,5)); + $totalDuree += $objp->Dureetot; + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format($objp->Mnttot, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + $totalMnt += $objp->Mnttot; + + $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3)); + + $i++; + } + } + } + + + // Add the sum à the bottom of the boxes + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalDuree,'all',25200,5)); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); + + } + + function showBox($head = null, $contents = null) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } +} +?> From c963a6d8a15b291522229f45ae3db3d7281bf6a5 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 21:36:00 +0200 Subject: [PATCH 02/11] Create box_project.php add box for project --- htdocs/core/boxes/box_project.php | 150 ++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 htdocs/core/boxes/box_project.php diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php new file mode 100644 index 00000000000..206c54aafa0 --- /dev/null +++ b/htdocs/core/boxes/box_project.php @@ -0,0 +1,150 @@ + + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_activite.php + * \ingroup projet + * \brief Module to show Projet activity of the current Year + * \version $Id: box_projet.php,v 1.1 2012/09/11 Charles-François BENKE + */ + +include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); + +class box_projet extends ModeleBoxes { + + var $boxcode="projet"; + var $boximg="object_projectpub"; + var $boxlabel; + //var $depends = array("projet"); + var $db; + var $param; + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + */ + function box_projet() + { + global $langs; + $langs->load("boxes"); + $langs->load("projects"); + + $this->boxlabel="Projet"; + } + + /** + * \brief Charge les donnees en memoire pour affichage ulterieur + * \param $max Nombre maximum d'enregistrements a charger + */ + function loadBox($max=5) + { + global $conf, $user, $langs, $db; + + $this->max=$max; + + $totalMnt = 0; + $totalnb = 0; + $totalnbTask=0; + include_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); + require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php"); + $projectstatic=new Project($db); + + + + $textHead = $langs->trans("Projet")." ".date("Y"); + $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); + + // list the summary of the orders + if ($user->rights->projet->lire) + { + + $sql = "SELECT p.fk_statut, count(p.rowid) as nb"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."projet as p"; + $sql.= ")"; + $sql.= " WHERE p.fk_soc = s.rowid"; + $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND DATE_FORMAT(p.datec,'%Y') = ".date("Y")." "; + $sql.= " GROUP BY p.fk_statut "; + $sql.= " ORDER BY p.fk_statut DESC"; + $sql.= $db->plimit($max, 0); + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projectpub'); + + $objp = $db->fetch_object($result); + $this->info_box_contents[$i][1] = array('td' => 'align="left"', + 'text' =>$langs->trans("Project")." ".$projectstatic->LibStatut($objp->fk_statut,0) + ); + + $this->info_box_contents[$i][2] = array('td' => 'align="right"', + 'text' => $objp->nb." ".$langs->trans("Projects"), + 'url' => DOL_URL_ROOT."/projet/liste.php?mainmenu=project&viewstatut=".$objp->fk_statut + ); + $totalnb += $objp->nb; + + $sql = "SELECT sum(pt.total_ht) as Mnttot, count(*) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; + $sql.= " WHERE pt.fk_projet = p.rowid"; + $sql.= " AND p.entity = ".$conf->entity; + $sql.= " AND (DATE_FORMAT(p.datec,'%Y') = ".date("Y").")"; + $sql.= " AND p.fk_statut=".$objp->fk_statut; + $resultTask = $db->query($sql); + if ($resultTask) + { + $objTask = $db->fetch_object($resultTask); + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb , 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format($objTask->Mnttot, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + + $totalMnt += $objTask->Mnttot; + $totalnbTask += $objTask->nb; + } + else + { + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0 , 0, ',', ' ')); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_trunc(number_format(0 , 0, ',', ' '),40)." ".$langs->trans("Currency".$conf->currency)); + } + $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $projectstatic->LibStatut($objp->fk_statut,3)); + + $i++; + } + } + } + + + // Add the sum à the bottom of the boxes + $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Projects")); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); + + } + + function showBox($head = null, $contents = null) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } +} +?> From 66dc82621dc69a2b0bdd1ee6ca8d6345c841bb38 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 21:37:56 +0200 Subject: [PATCH 03/11] Update modProjet.class.php add boxe definition on projet module --- htdocs/core/modules/modProjet.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 0d8a09aa7e5..d9d2817759f 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Charles-Fr BENKE * * 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 @@ -116,6 +117,11 @@ class modProjet extends DolibarrModules // Boxes $this->boxes = array(); + $r=0; + $this->boxes[$r][1] = "box_project.php"; + $r++; + $this->boxes[$r][1] = "box_task.php"; + $r++; // Permissions $this->rights = array(); From 31c2815d0fee2934f167d19e37ff33d3855c2e87 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 21:50:17 +0200 Subject: [PATCH 04/11] Update box_task.php --- htdocs/core/boxes/box_task.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 6e3b73b65db..1cdda61b766 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -71,9 +71,10 @@ class box_task extends ModeleBoxes { if ($user->rights->projet->lire) { - $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(pt.total_ht) as Mnttot, sum(pt.planned_workload) as Dureetot"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; + $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt"; $sql.= " WHERE DATE_FORMAT(pt.datec,'%Y') = ".date("Y")." "; + $sql.= " AND pt.rowid = ptt.fk_task"; $sql.= " GROUP BY pt.fk_statut "; $sql.= " ORDER BY pt.fk_statut DESC"; $sql.= $db->plimit($max, 0); @@ -98,10 +99,10 @@ class box_task extends ModeleBoxes { 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut ); $totalnb += $objp->nb; - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->Dureetot,'all',25200,5)); - $totalDuree += $objp->Dureetot; - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format($objp->Mnttot, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); - $totalMnt += $objp->Mnttot; + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); + $totalplannedtot += $objp->plannedtot; + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5)); + $totaldurationtot += $objp->durationtot; $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3)); @@ -114,8 +115,8 @@ class box_task extends ModeleBoxes { // Add the sum à the bottom of the boxes $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalDuree,'all',25200,5)); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); + $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); + $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); } From 754b028ec6c377a5711e72d42fc8d90ff37fd178 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 18 Jun 2014 22:19:28 +0200 Subject: [PATCH 05/11] Update box_project.php --- htdocs/core/boxes/box_project.php | 36 ++++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 206c54aafa0..9e5bca479f4 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -66,21 +66,20 @@ class box_projet extends ModeleBoxes { - $textHead = $langs->trans("Projet")." ".date("Y"); + $textHead = $langs->trans("Projet"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders if ($user->rights->projet->lire) { - $sql = "SELECT p.fk_statut, count(p.rowid) as nb"; + $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."projet as p"; $sql.= ")"; $sql.= " WHERE p.fk_soc = s.rowid"; $sql.= " AND s.entity = ".$conf->entity; - $sql.= " AND DATE_FORMAT(p.datec,'%Y') = ".date("Y")." "; - $sql.= " GROUP BY p.fk_statut "; - $sql.= " ORDER BY p.fk_statut DESC"; + $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts + $sql.= " ORDER BY p.datec DESC"; $sql.= $db->plimit($max, 0); $result = $db->query($sql); @@ -94,38 +93,36 @@ class box_projet extends ModeleBoxes { $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projectpub'); $objp = $db->fetch_object($result); + $projectstatic->fetch($objp->rowid); + $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' =>$langs->trans("Project")." ".$projectstatic->LibStatut($objp->fk_statut,0) + 'text' =>$projectstatic->getNomUrl(1) ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $objp->nb." ".$langs->trans("Projects"), - 'url' => DOL_URL_ROOT."/projet/liste.php?mainmenu=project&viewstatut=".$objp->fk_statut + $this->info_box_contents[$i][2] = array('td' => 'align="left"', + 'text' => $objp->title ); - $totalnb += $objp->nb; - $sql = "SELECT sum(pt.total_ht) as Mnttot, count(*) as nb"; + $sql = "SELECT count(*) as nb, sum(progress) as totprogress"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; $sql.= " WHERE pt.fk_projet = p.rowid"; $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND (DATE_FORMAT(p.datec,'%Y') = ".date("Y").")"; - $sql.= " AND p.fk_statut=".$objp->fk_statut; $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb , 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format($objTask->Mnttot, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); - - $totalMnt += $objTask->Mnttot; + if ($objTask->nb > 0 ) + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb) , 0, ',', ' ')." % ".$langs->trans("Progress")); + else + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0 , 0, ',', ' ')); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => dol_trunc(number_format(0 , 0, ',', ' '),40)." ".$langs->trans("Currency".$conf->currency)); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); } - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', 'text' => $projectstatic->LibStatut($objp->fk_statut,3)); $i++; } @@ -135,9 +132,8 @@ class box_projet extends ModeleBoxes { // Add the sum à the bottom of the boxes $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'colspan=2 align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Projects")); + $this->info_box_contents[$i][1] = array('td' => 'align="right" ', 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects")); $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalMnt, 0, ',', ' ')." ".$langs->trans("Currency".$conf->currency)); $this->info_box_contents[$i][4] = array('td' => 'colspan=2', 'text' => ""); } From ec1a6e1c29e5b0c316b3974ee840fa1b5f361b75 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:17:26 +0200 Subject: [PATCH 06/11] Update box_task.php --- htdocs/core/boxes/box_task.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 1cdda61b766..6dfe65d78d7 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -24,7 +24,11 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); -class box_task extends ModeleBoxes { +/** + * Class to manage the box to show last task + */ +class box_task extends ModeleBoxes +{ var $boxcode="projet"; var $boximg="object_projecttask"; @@ -38,6 +42,7 @@ class box_task extends ModeleBoxes { /** * \brief Constructeur de la classe + * @return void */ function box_task() { From 8070030c4576124f42b7d7d706069271bac10efe Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:19:57 +0200 Subject: [PATCH 07/11] Update box_project.php --- htdocs/core/boxes/box_project.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 9e5bca479f4..237b5c04064 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -23,9 +23,13 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); -class box_projet extends ModeleBoxes { +/** + * Class to manage the box to show last projet + */ +class box_project extends ModeleBoxes +{ - var $boxcode="projet"; + var $boxcode="project"; var $boximg="object_projectpub"; var $boxlabel; //var $depends = array("projet"); @@ -38,7 +42,7 @@ class box_projet extends ModeleBoxes { /** * \brief Constructeur de la classe */ - function box_projet() + function box_project() { global $langs; $langs->load("boxes"); @@ -49,7 +53,8 @@ class box_projet extends ModeleBoxes { /** * \brief Charge les donnees en memoire pour affichage ulterieur - * \param $max Nombre maximum d'enregistrements a charger + * @param int $max Maximum number of records to load + * @return void */ function loadBox($max=5) { @@ -103,10 +108,10 @@ class box_projet extends ModeleBoxes { 'text' => $objp->title ); - $sql = "SELECT count(*) as nb, sum(progress) as totprogress"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; - $sql.= " WHERE pt.fk_projet = p.rowid"; - $sql.= " AND p.entity = ".$conf->entity; + $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; + $sql.=" FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; + $sql.=" WHERE pt.fk_projet = p.rowid"; + $sql.=" AND p.entity = ".$conf->entity; $resultTask = $db->query($sql); if ($resultTask) { From a31d5cc193b4d880684e547751315c3e431ed831 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:38:15 +0200 Subject: [PATCH 08/11] Update box_project.php --- htdocs/core/boxes/box_project.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 237b5c04064..2339a63c92f 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -28,7 +28,6 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); */ class box_project extends ModeleBoxes { - var $boxcode="project"; var $boximg="object_projectpub"; var $boxlabel; @@ -52,7 +51,8 @@ class box_project extends ModeleBoxes } /** - * \brief Charge les donnees en memoire pour affichage ulterieur + * Load data for box to show them later + * * @param int $max Maximum number of records to load * @return void */ @@ -143,6 +143,13 @@ class box_project extends ModeleBoxes } + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void + */ function showBox($head = null, $contents = null) { parent::showBox($this->info_box_head, $this->info_box_contents); From 24e780cb0c3904de1ecd3018a9e64dd2b70b1ce0 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:39:43 +0200 Subject: [PATCH 09/11] Update box_task.php --- htdocs/core/boxes/box_task.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 6dfe65d78d7..d850a7e0107 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -52,10 +52,12 @@ class box_task extends ModeleBoxes $this->boxlabel="Tasks"; } - /** - * \brief Charge les donnees en memoire pour affichage ulterieur - * \param $max Nombre maximum d'enregistrements a charger - */ + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ function loadBox($max=5) { global $conf, $user, $langs, $db; @@ -126,6 +128,13 @@ class box_task extends ModeleBoxes } + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void + */ function showBox($head = null, $contents = null) { parent::showBox($this->info_box_head, $this->info_box_contents); From 496379ced895a6cee3017cf23f0a3574f218f03c Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 20 Jun 2014 23:56:03 +0200 Subject: [PATCH 10/11] fix travis error --- htdocs/core/boxes/box_factures.php | 3 +-- htdocs/core/boxes/box_project.php | 14 ++++++-------- htdocs/core/boxes/box_task.php | 23 +++++++++++------------ 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 18d276b0130..23ab2df8556 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -24,7 +24,6 @@ */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; - /** * Class to manage the box to show last invoices */ @@ -159,4 +158,4 @@ class box_factures extends ModeleBoxes } } - +?> \ No newline at end of file diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 2339a63c92f..e9cf2f24202 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -18,15 +18,13 @@ * \file htdocs/core/boxes/box_activite.php * \ingroup projet * \brief Module to show Projet activity of the current Year - * \version $Id: box_projet.php,v 1.1 2012/09/11 Charles-François BENKE */ - include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); /** * Class to manage the box to show last projet */ -class box_project extends ModeleBoxes +class box_project extends ModeleBoxes { var $boxcode="project"; var $boximg="object_projectpub"; @@ -51,11 +49,11 @@ class box_project extends ModeleBoxes } /** - * Load data for box to show them later - * - * @param int $max Maximum number of records to load - * @return void - */ + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ function loadBox($max=5) { global $conf, $user, $langs, $db; diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index d850a7e0107..a0accd74b3a 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -27,9 +27,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); /** * Class to manage the box to show last task */ -class box_task extends ModeleBoxes +class box_task extends ModeleBoxes { - var $boxcode="projet"; var $boximg="object_projecttask"; var $boxlabel; @@ -41,9 +40,9 @@ class box_task extends ModeleBoxes var $info_box_contents = array(); /** - * \brief Constructeur de la classe - * @return void - */ + * \brief Constructeur de la classe + * @return void + */ function box_task() { global $langs; @@ -51,13 +50,13 @@ class box_task extends ModeleBoxes $langs->load("projects"); $this->boxlabel="Tasks"; } - - /** - * Load data for box to show them later - * - * @param int $max Maximum number of records to load - * @return void - */ + + /** + * Load data for box to show them later + * + * @param int $max Maximum number of records to load + * @return void + */ function loadBox($max=5) { global $conf, $user, $langs, $db; From b34947b37cd5850ec4d0cb233ce84b642dfe7f2d Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Sat, 21 Jun 2014 00:08:13 +0200 Subject: [PATCH 11/11] fix travis error --- htdocs/core/boxes/box_project.php | 6 +++--- htdocs/core/boxes/box_task.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index e9cf2f24202..5155c92b251 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -114,16 +114,16 @@ 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, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks")); if ($objTask->nb > 0 ) - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb) , 0, ',', ' ')." % ".$langs->trans("Progress")); + $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')." % ".$langs->trans("Progress")); else $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0 , 0, ',', ' ')); + $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' ')); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index a0accd74b3a..20a0871bc7e 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -41,6 +41,7 @@ class box_task extends ModeleBoxes /** * \brief Constructeur de la classe + * * @return void */ function box_task()