From daa1ac9e600ce303640acb52f87e91cba0a9e9fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 May 2023 14:22:32 +0200 Subject: [PATCH] NEW option MAIN_ACTIVATE_FILECACHE to cache widgets --- htdocs/admin/boxes.php | 17 +- htdocs/core/boxes/box_actions_future.php | 2 +- htdocs/core/boxes/box_activity.php | 246 ++++++++----------- htdocs/core/boxes/box_birthdays.php | 69 ++---- htdocs/core/boxes/box_birthdays_members.php | 56 ++--- htdocs/core/boxes/box_project.php | 2 +- htdocs/core/boxes/box_validated_projects.php | 2 +- htdocs/core/modules/modProjet.class.php | 9 +- htdocs/langs/en_US/projects.lang | 1 + 9 files changed, 170 insertions(+), 234 deletions(-) diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index cbab8027e43..2c79c34978d 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -439,6 +439,7 @@ print load_fiche_titre($langs->trans("Other"), '', ''); print '
'; print ''; print ''; +print ''; print '
'; print ''; @@ -452,22 +453,20 @@ print ''."\n"; print ''; print ''; -// Activate FileCache - Developement -if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { - print ''; - print ''; -} +// Activate FileCache (so content of file boxes are stored into a cache file int boxes/temp for 3600 seconds) +print ''; +print ''; print '
'; print $langs->trans("MaxNbOfLinesForBoxes"); print ''; -print ''; +print ''; print '
'.$langs->trans("EnableFileCache").''; - print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', (!empty($conf->global->MAIN_ACTIVATE_FILECACHE) ? $conf->global->MAIN_ACTIVATE_FILECACHE : 0), 1); - print '
'.$langs->trans("EnableFileCache").''; +print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', getDolGlobalInt('MAIN_ACTIVATE_FILECACHE', 0), 1); +print '
'; print '
'; -print $form->buttonsSaveCancel("Save", ''); +print $form->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); print '
'; print "\n".''."\n"; diff --git a/htdocs/core/boxes/box_actions_future.php b/htdocs/core/boxes/box_actions_future.php index bded39e4774..61340ca8c85 100644 --- a/htdocs/core/boxes/box_actions_future.php +++ b/htdocs/core/boxes/box_actions_future.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/core/boxes/box_actions.php + * \file htdocs/core/boxes/box_actions_future.php * \ingroup actions * \brief Module to build boxe for events */ diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 8fa2592811e..8b179365bbc 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -86,12 +86,14 @@ class box_activity extends ModeleBoxes $now = dol_now(); $nbofperiod = 3; - $cachetime = 3600; - $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->hasRight("societe", "client", "voir") ? '1' : '0').'.cache'; + // Force use of cache for this box as it has very bad performances + $savMAIN_ACTIVATE_FILECACHE = getDolGlobalInt('MAIN_ACTIVATE_FILECACHE'); + $conf->global->MAIN_ACTIVATE_FILECACHE = 1; if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) { $nbofperiod = $conf->global->MAIN_BOX_ACTIVITY_DURATION; } + $textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod); $this->info_box_head = array( 'text' => $textHead, @@ -107,49 +109,41 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic = new Propal($this->db); - $cachedir = DOL_DATA_ROOT.'/propale/temp'; - $filename = '/boxactivity-propal'.$fileid; - $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); - if ($refresh) { - $sql = "SELECT p.fk_statut, SUM(p.total_ttc) as Mnttot, COUNT(*) as nb"; - $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; - if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - } - $sql .= ")"; - $sql .= " WHERE p.entity IN (".getEntity('propal').")"; - $sql .= " AND p.fk_soc = s.rowid"; - if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); - } - if ($user->socid) { - $sql .= " AND s.rowid = ".((int) $user->socid); - } - $sql .= " AND p.datep >= '".$this->db->idate($tmpdate)."'"; - $sql .= " AND p.date_cloture IS NULL"; // just unclosed - $sql .= " GROUP BY p.fk_statut"; - $sql .= " ORDER BY p.fk_statut DESC"; - $result = $this->db->query($sql); - if ($result) { - $num = $this->db->num_rows($result); + $sql = "SELECT p.fk_statut, SUM(p.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; + if (empty($user->rights->societe->client->voir) && !$user->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= ")"; + $sql .= " WHERE p.entity IN (".getEntity('propal').")"; + $sql .= " AND p.fk_soc = s.rowid"; + if (empty($user->rights->societe->client->voir) && !$user->socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + if ($user->socid) { + $sql .= " AND s.rowid = ".((int) $user->socid); + } + $sql .= " AND p.datep >= '".$this->db->idate($tmpdate)."'"; + $sql .= " AND p.date_cloture IS NULL"; // just unclosed + $sql .= " GROUP BY p.fk_statut"; + $sql .= " ORDER BY p.fk_statut DESC"; - $line = 0; - while ($line < $num) { - $data[$line] = $this->db->fetch_object($result); + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); - $line++; - } - if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { - dol_filecache($cachedir, $filename, $data); - } - $this->db->free($result); - } else { - dol_print_error($this->db); + $line = 0; + while ($line < $num) { + $data[$line] = $this->db->fetch_object($result); + + $line++; } + + $this->db->free($result); } else { - $data = dol_readcachefile($cachedir, $filename); + dol_print_error($this->db); } if (!empty($data)) { @@ -204,47 +198,38 @@ class box_activity extends ModeleBoxes $langs->load("orders"); - $cachedir = DOL_DATA_ROOT.'/commande/temp'; - $filename = '/boxactivity-order'.$fileid; - $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); - if ($refresh) { - $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; - $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; - if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - } - $sql .= ")"; - $sql .= " WHERE c.entity IN (".getEntity('commande').")"; - $sql .= " AND c.fk_soc = s.rowid"; - if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); - } - if ($user->socid) { - $sql .= " AND s.rowid = ".((int) $user->socid); - } - $sql .= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'"; - $sql .= " GROUP BY c.fk_statut"; - $sql .= " ORDER BY c.fk_statut DESC"; + $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; + $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; + if (empty($user->rights->societe->client->voir) && !$user->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= ")"; + $sql .= " WHERE c.entity IN (".getEntity('commande').")"; + $sql .= " AND c.fk_soc = s.rowid"; + if (empty($user->rights->societe->client->voir) && !$user->socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + if ($user->socid) { + $sql .= " AND s.rowid = ".((int) $user->socid); + } + $sql .= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'"; + $sql .= " GROUP BY c.fk_statut"; + $sql .= " ORDER BY c.fk_statut DESC"; - $result = $this->db->query($sql); - if ($result) { - $num = $this->db->num_rows($result); - $j = 0; - while ($j < $num) { - $data[$j] = $this->db->fetch_object($result); - $j++; - } - if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { - dol_filecache($cachedir, $filename, $data); - } - $this->db->free($result); - } else { - dol_print_error($this->db); + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); + $j = 0; + while ($j < $num) { + $data[$j] = $this->db->fetch_object($result); + $j++; } + + $this->db->free($result); } else { - $data = dol_readcachefile($cachedir, $filename); + dol_print_error($this->db); } if (!empty($data)) { @@ -299,47 +284,37 @@ class box_activity extends ModeleBoxes $facturestatic = new Facture($this->db); // part 1 - $cachedir = DOL_DATA_ROOT.'/facture/temp'; - $filename = '/boxactivity-invoice'.$fileid; - - $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); - if ($refresh) { - $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; - $sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - } - $sql .= ")"; - $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; - if (empty($user->rights->societe->client->voir) && !$user->socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); - } - if ($user->socid) { - $sql .= " AND s.rowid = ".((int) $user->socid); - } - $sql .= " AND f.fk_soc = s.rowid"; - $sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1"; - $sql .= " GROUP BY f.fk_statut"; - $sql .= " ORDER BY f.fk_statut DESC"; + $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + if (empty($user->rights->societe->client->voir) && !$user->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= ")"; + $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; + if (empty($user->rights->societe->client->voir) && !$user->socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + if ($user->socid) { + $sql .= " AND s.rowid = ".((int) $user->socid); + } + $sql .= " AND f.fk_soc = s.rowid"; + $sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1"; + $sql .= " GROUP BY f.fk_statut"; + $sql .= " ORDER BY f.fk_statut DESC"; - $result = $this->db->query($sql); - if ($result) { - $num = $this->db->num_rows($result); - $j = 0; - while ($j < $num) { - $data[$j] = $this->db->fetch_object($result); - $j++; - } - if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { - dol_filecache($cachedir, $filename, $data); - } - $this->db->free($result); - } else { - dol_print_error($this->db); + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); + $j = 0; + while ($j < $num) { + $data[$j] = $this->db->fetch_object($result); + $j++; } + + $this->db->free($result); } else { - $data = dol_readcachefile($cachedir, $filename); + dol_print_error($this->db); } if (!empty($data)) { @@ -390,38 +365,27 @@ class box_activity extends ModeleBoxes } // part 2 - $cachedir = DOL_DATA_ROOT.'/facture/temp'; - $filename = '/boxactivity-invoice2'.$fileid; - - $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); - $data = array(); - if ($refresh) { - $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; - $sql .= " AND f.fk_soc = s.rowid"; - $sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=0"; - $sql .= " GROUP BY f.fk_statut"; - $sql .= " ORDER BY f.fk_statut DESC"; + $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; + $sql .= " AND f.fk_soc = s.rowid"; + $sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=0"; + $sql .= " GROUP BY f.fk_statut"; + $sql .= " ORDER BY f.fk_statut DESC"; - $result = $this->db->query($sql); - if ($result) { - $num = $this->db->num_rows($result); - $j = 0; - while ($j < $num) { - $data[$j] = $this->db->fetch_object($result); - $j++; - } - if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { - dol_filecache($cachedir, $filename, $data); - } - $this->db->free($result); - } else { - dol_print_error($this->db); + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); + $j = 0; + while ($j < $num) { + $data[$j] = $this->db->fetch_object($result); + $j++; } + + $this->db->free($result); } else { - $data = dol_readcachefile($cachedir, $filename); + dol_print_error($this->db); } if (!empty($data)) { @@ -476,6 +440,8 @@ class box_activity extends ModeleBoxes $this->info_box_contents[$line][2] = array('td' => 'class="liste_total right" ', 'text' => $totalnb); $this->info_box_contents[$line][3] = array('td' => 'class="liste_total right" ', 'text' => ''); $this->info_box_contents[$line][4] = array('td' => 'class="liste_total right" ', 'text' => ""); + + $conf->global->MAIN_ACTIVATE_FILECACHE = $savMAIN_ACTIVATE_FILECACHE; } diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index ce813deb351..28e613ca882 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -74,63 +74,48 @@ class box_birthdays extends ModeleBoxes global $conf, $user, $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $userstatic = new User($this->db); + $langs->load("boxes"); $this->max = $max; - $cachetime = 3600; - $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'.cache'; - - include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - $userstatic = new User($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleUserBirthdaysOfMonth")); if ($user->hasRight('user', 'user', 'lire')) { - $cachedir = DOL_DATA_ROOT.'/users/temp'; - $filename = '/boxbirthdays-'.$fileid; - $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); - if ($refresh) { - $tmparray = dol_getdate(dol_now(), true); - $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth as datea, date_format(u.birth, '%d') as daya, 'birth' as typea, u.email, u.statut as status"; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.entity IN (".getEntity('user').")"; - $sql .= " AND u.statut = ".User::STATUS_ENABLED; - $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); - $sql .= ' UNION '; - $sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, date_format(u.dateemployment, '%d') as daya, 'employment' as typea, u.email, u.statut as status"; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.entity IN (".getEntity('user').")"; - $sql .= " AND u.statut = ".User::STATUS_ENABLED; - $sql .= dolSqlDateFilter('u.dateemployment', 0, $tmparray['mon'], 0); - $sql .= " ORDER BY daya ASC"; // We want to have date of the month sorted by the day without taking into consideration the year - $sql .= $this->db->plimit($max, 0); + $tmparray = dol_getdate(dol_now(), true); - dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); + $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth as datea, date_format(u.birth, '%d') as daya, 'birth' as typea, u.email, u.statut as status"; + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE u.entity IN (".getEntity('user').")"; + $sql .= " AND u.statut = ".User::STATUS_ENABLED; + $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); + $sql .= ' UNION '; + $sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, date_format(u.dateemployment, '%d') as daya, 'employment' as typea, u.email, u.statut as status"; + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE u.entity IN (".getEntity('user').")"; + $sql .= " AND u.statut = ".User::STATUS_ENABLED; + $sql .= dolSqlDateFilter('u.dateemployment', 0, $tmparray['mon'], 0); + $sql .= " ORDER BY daya ASC"; // We want to have date of the month sorted by the day without taking into consideration the year + $sql .= $this->db->plimit($max, 0); - $line = 0; - while ($line < $num) { - $data[$line] = $this->db->fetch_object($resql); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); - $line++; - } + $line = 0; + while ($line < $num) { + $data[$line] = $this->db->fetch_object($resql); - if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { - dol_filecache($cachedir, $filename, $data); - } - - $this->db->free($resql); + $line++; } - } else { - $data = dol_readcachefile($cachedir, $filename); + + $this->db->free($resql); } if (!empty($data)) { diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 7f17e74302d..cbd9bfa56f0 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -74,57 +74,41 @@ class box_birthdays_members extends ModeleBoxes global $conf, $user, $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + $memberstatic = new Adherent($this->db); $langs->load("boxes"); $this->max = $max; - $cachetime = 3600; - $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'.cache'; - - include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $memberstatic = new Adherent($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleMemberNextBirthdays")); if ($user->hasRight('adherent', 'lire')) { - $cachedir = DOL_DATA_ROOT.'/users/temp'; - $filename = '/boxbirthdays-members'.$fileid; - $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); - if ($refresh) { - $tmparray = dol_getdate(dol_now(), true); - $sql = "SELECT u.rowid, u.firstname, u.lastname, u.societe, u.birth, date_format(u.birth, '%d') as daya, u.email, u.statut as status, u.datefin"; - $sql .= " FROM ".MAIN_DB_PREFIX."adherent as u"; - $sql .= " WHERE u.entity IN (".getEntity('adherent').")"; - $sql .= " AND u.statut = ".Adherent::STATUS_VALIDATED; - $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); - $sql .= " ORDER BY daya ASC"; // We want to have date of the month sorted by the day without taking into consideration the year - $sql .= $this->db->plimit($max, 0); + $tmparray = dol_getdate(dol_now(), true); - dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); + $sql = "SELECT u.rowid, u.firstname, u.lastname, u.societe, u.birth, date_format(u.birth, '%d') as daya, u.email, u.statut as status, u.datefin"; + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as u"; + $sql .= " WHERE u.entity IN (".getEntity('adherent').")"; + $sql .= " AND u.statut = ".Adherent::STATUS_VALIDATED; + $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); + $sql .= " ORDER BY daya ASC"; // We want to have date of the month sorted by the day without taking into consideration the year + $sql .= $this->db->plimit($max, 0); - $line = 0; - while ($line < $num) { - $data[$line] = $this->db->fetch_object($resql); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); - $line++; - } + $line = 0; + while ($line < $num) { + $data[$line] = $this->db->fetch_object($resql); - if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { - dol_filecache($cachedir, $filename, $data); - } - - $this->db->free($resql); + $line++; } - } else { - $data = dol_readcachefile($cachedir, $filename); + + $this->db->free($resql); } if (!empty($data)) { diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 6c3db843523..62af7a3c239 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -21,7 +21,7 @@ /** * \file htdocs/core/boxes/box_project.php - * \ingroup projet + * \ingroup project * \brief Module to show Projet activity of the current Year */ include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php index c59f3973c3a..87944907352 100644 --- a/htdocs/core/boxes/box_validated_projects.php +++ b/htdocs/core/boxes/box_validated_projects.php @@ -22,7 +22,7 @@ /** * \file htdocs/core/boxes/box_validated_projects.php - * \ingroup projet + * \ingroup project * \brief Module to show validated projects whose tasks are assigned to the connected person, without any time entered by the connected person */ include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 8f931499077..d520e696c68 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -127,10 +127,11 @@ class modProjet extends DolibarrModules // Boxes $this->boxes = array( - 0=>array('file'=>'box_project.php', 'enabledbydefaulton'=>'Home'), - 1=>array('file'=>'box_task.php', 'enabledbydefaulton'=>'Home'), - 2=>array('file'=>'box_validated_projects.php', 'enabledbydefaulton'=>'Home'), - 3=>array('file'=>'box_funnel_of_prospection.php', 'enabledbydefaulton'=>'Home'), + 0=>array('file'=>'box_project.php', 'enabledbydefaulton'=>'Home'), // open projects + 1=>array('file'=>'box_project_opportunities.php', 'enabledbydefaulton'=>'Home'), // open opportunities + 2=>array('file'=>'box_task.php', 'enabledbydefaulton'=>'Home'), + 3=>array('file'=>'box_validated_projects.php', 'enabledbydefaulton'=>'Home'), // task without timespent + 4=>array('file'=>'box_funnel_of_prospection.php', 'enabledbydefaulton'=>'Home'), ); // Permissions diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index d2ceab30337..79b64cdcdf3 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -33,6 +33,7 @@ DeleteATask=Delete a task ConfirmDeleteAProject=Are you sure you want to delete this project? ConfirmDeleteATask=Are you sure you want to delete this task? OpenedProjects=Open projects +OpenedProjectsOpportunities=Open opportunities OpenedTasks=Open tasks OpportunitiesStatusForOpenedProjects=Leads amount of open projects by status OpportunitiesStatusForProjects=Leads amount of projects by status