NEW option MAIN_ACTIVATE_FILECACHE to cache widgets

This commit is contained in:
Laurent Destailleur 2023-05-05 14:22:32 +02:00
parent e0ef2870a4
commit daa1ac9e60
9 changed files with 170 additions and 234 deletions

View File

@ -439,6 +439,7 @@ print load_fiche_titre($langs->trans("Other"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="addconst">'; print '<input type="hidden" name="action" value="addconst">';
print '<input type="hidden" name="page_y" value="">';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -452,22 +453,20 @@ print '<td>';
print $langs->trans("MaxNbOfLinesForBoxes"); print $langs->trans("MaxNbOfLinesForBoxes");
print '</td>'."\n"; print '</td>'."\n";
print '<td>'; print '<td>';
print '<input type="text" class="flat" size="6" name="MAIN_BOXES_MAXLINES" value="'.(!empty($conf->global->MAIN_BOXES_MAXLINES) ? $conf->global->MAIN_BOXES_MAXLINES : '').'">'; print '<input type="text" class="flat" size="6" name="MAIN_BOXES_MAXLINES" value="'.(getDolGlobalString('MAIN_BOXES_MAXLINES')).'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Activate FileCache - Developement // Activate FileCache (so content of file boxes are stored into a cache file int boxes/temp for 3600 seconds)
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { print '<tr class="oddeven"><td>'.$langs->trans("EnableFileCache").'</td><td>';
print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>'; print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', getDolGlobalInt('MAIN_ACTIVATE_FILECACHE', 0), 1);
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', (!empty($conf->global->MAIN_ACTIVATE_FILECACHE) ? $conf->global->MAIN_ACTIVATE_FILECACHE : 0), 1); print '</td>';
print '</td>'; print '</tr>';
print '</tr>';
}
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print $form->buttonsSaveCancel("Save", ''); print $form->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
print '</form>'; print '</form>';
print "\n".'<!-- End Other Const -->'."\n"; print "\n".'<!-- End Other Const -->'."\n";

View File

@ -20,7 +20,7 @@
*/ */
/** /**
* \file htdocs/core/boxes/box_actions.php * \file htdocs/core/boxes/box_actions_future.php
* \ingroup actions * \ingroup actions
* \brief Module to build boxe for events * \brief Module to build boxe for events
*/ */

View File

@ -86,12 +86,14 @@ class box_activity extends ModeleBoxes
$now = dol_now(); $now = dol_now();
$nbofperiod = 3; $nbofperiod = 3;
$cachetime = 3600; // Force use of cache for this box as it has very bad performances
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->hasRight("societe", "client", "voir") ? '1' : '0').'.cache'; $savMAIN_ACTIVATE_FILECACHE = getDolGlobalInt('MAIN_ACTIVATE_FILECACHE');
$conf->global->MAIN_ACTIVATE_FILECACHE = 1;
if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) { if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) {
$nbofperiod = $conf->global->MAIN_BOX_ACTIVITY_DURATION; $nbofperiod = $conf->global->MAIN_BOX_ACTIVITY_DURATION;
} }
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod); $textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod);
$this->info_box_head = array( $this->info_box_head = array(
'text' => $textHead, 'text' => $textHead,
@ -107,49 +109,41 @@ class box_activity extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propalstatic = new Propal($this->db); $propalstatic = new Propal($this->db);
$cachedir = DOL_DATA_ROOT.'/propale/temp';
$filename = '/boxactivity-propal'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array(); $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); $sql = "SELECT p.fk_statut, SUM(p.total_ttc) as Mnttot, COUNT(*) as nb";
if ($result) { $sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
$num = $this->db->num_rows($result); 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; $result = $this->db->query($sql);
while ($line < $num) { if ($result) {
$data[$line] = $this->db->fetch_object($result); $num = $this->db->num_rows($result);
$line++; $line = 0;
} while ($line < $num) {
if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) { $data[$line] = $this->db->fetch_object($result);
dol_filecache($cachedir, $filename, $data);
} $line++;
$this->db->free($result);
} else {
dol_print_error($this->db);
} }
$this->db->free($result);
} else { } else {
$data = dol_readcachefile($cachedir, $filename); dol_print_error($this->db);
} }
if (!empty($data)) { if (!empty($data)) {
@ -204,47 +198,38 @@ class box_activity extends ModeleBoxes
$langs->load("orders"); $langs->load("orders");
$cachedir = DOL_DATA_ROOT.'/commande/temp';
$filename = '/boxactivity-order'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array(); $data = array();
if ($refresh) { $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
$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";
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; if (empty($user->rights->societe->client->voir) && !$user->socid) {
if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; }
} $sql .= ")";
$sql .= ")"; $sql .= " WHERE c.entity IN (".getEntity('commande').")";
$sql .= " WHERE c.entity IN (".getEntity('commande').")"; $sql .= " AND c.fk_soc = s.rowid";
$sql .= " AND c.fk_soc = s.rowid"; if (empty($user->rights->societe->client->voir) && !$user->socid) {
if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); }
} if ($user->socid) {
if ($user->socid) { $sql .= " AND s.rowid = ".((int) $user->socid);
$sql .= " AND s.rowid = ".((int) $user->socid); }
} $sql .= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'";
$sql .= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'"; $sql .= " GROUP BY c.fk_statut";
$sql .= " GROUP BY c.fk_statut"; $sql .= " ORDER BY c.fk_statut DESC";
$sql .= " ORDER BY c.fk_statut DESC";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$j = 0; $j = 0;
while ($j < $num) { while ($j < $num) {
$data[$j] = $this->db->fetch_object($result); $data[$j] = $this->db->fetch_object($result);
$j++; $j++;
}
if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) {
dol_filecache($cachedir, $filename, $data);
}
$this->db->free($result);
} else {
dol_print_error($this->db);
} }
$this->db->free($result);
} else { } else {
$data = dol_readcachefile($cachedir, $filename); dol_print_error($this->db);
} }
if (!empty($data)) { if (!empty($data)) {
@ -299,47 +284,37 @@ class box_activity extends ModeleBoxes
$facturestatic = new Facture($this->db); $facturestatic = new Facture($this->db);
// part 1 // part 1
$cachedir = DOL_DATA_ROOT.'/facture/temp';
$filename = '/boxactivity-invoice'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array(); $data = array();
if ($refresh) { $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$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 .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; if (empty($user->rights->societe->client->voir) && !$user->socid) {
if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; }
} $sql .= ")";
$sql .= ")"; $sql .= " WHERE f.entity IN (".getEntity('invoice').')';
$sql .= " WHERE f.entity IN (".getEntity('invoice').')'; if (empty($user->rights->societe->client->voir) && !$user->socid) {
if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); }
} if ($user->socid) {
if ($user->socid) { $sql .= " AND s.rowid = ".((int) $user->socid);
$sql .= " AND s.rowid = ".((int) $user->socid); }
} $sql .= " AND f.fk_soc = s.rowid";
$sql .= " AND f.fk_soc = s.rowid"; $sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1";
$sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1"; $sql .= " GROUP BY f.fk_statut";
$sql .= " GROUP BY f.fk_statut"; $sql .= " ORDER BY f.fk_statut DESC";
$sql .= " ORDER BY f.fk_statut DESC";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$j = 0; $j = 0;
while ($j < $num) { while ($j < $num) {
$data[$j] = $this->db->fetch_object($result); $data[$j] = $this->db->fetch_object($result);
$j++; $j++;
}
if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) {
dol_filecache($cachedir, $filename, $data);
}
$this->db->free($result);
} else {
dol_print_error($this->db);
} }
$this->db->free($result);
} else { } else {
$data = dol_readcachefile($cachedir, $filename); dol_print_error($this->db);
} }
if (!empty($data)) { if (!empty($data)) {
@ -390,38 +365,27 @@ class box_activity extends ModeleBoxes
} }
// part 2 // part 2
$cachedir = DOL_DATA_ROOT.'/facture/temp';
$filename = '/boxactivity-invoice2'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array(); $data = array();
if ($refresh) { $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$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 .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql .= " WHERE f.entity IN (".getEntity('invoice').')';
$sql .= " WHERE f.entity IN (".getEntity('invoice').')'; $sql .= " AND f.fk_soc = s.rowid";
$sql .= " AND f.fk_soc = s.rowid"; $sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=0";
$sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=0"; $sql .= " GROUP BY f.fk_statut";
$sql .= " GROUP BY f.fk_statut"; $sql .= " ORDER BY f.fk_statut DESC";
$sql .= " ORDER BY f.fk_statut DESC";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$j = 0; $j = 0;
while ($j < $num) { while ($j < $num) {
$data[$j] = $this->db->fetch_object($result); $data[$j] = $this->db->fetch_object($result);
$j++; $j++;
}
if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) {
dol_filecache($cachedir, $filename, $data);
}
$this->db->free($result);
} else {
dol_print_error($this->db);
} }
$this->db->free($result);
} else { } else {
$data = dol_readcachefile($cachedir, $filename); dol_print_error($this->db);
} }
if (!empty($data)) { 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][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][3] = array('td' => 'class="liste_total right" ', 'text' => '');
$this->info_box_contents[$line][4] = 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;
} }

View File

@ -74,63 +74,48 @@ class box_birthdays extends ModeleBoxes
global $conf, $user, $langs; global $conf, $user, $langs;
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; 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"); $langs->load("boxes");
$this->max = $max; $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")); $this->info_box_head = array('text' => $langs->trans("BoxTitleUserBirthdaysOfMonth"));
if ($user->hasRight('user', 'user', 'lire')) { if ($user->hasRight('user', 'user', 'lire')) {
$cachedir = DOL_DATA_ROOT.'/users/temp';
$filename = '/boxbirthdays-'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array(); $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"; $tmparray = dol_getdate(dol_now(), true);
$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);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $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";
$resql = $this->db->query($sql); $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
if ($resql) { $sql .= " WHERE u.entity IN (".getEntity('user').")";
$num = $this->db->num_rows($resql); $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; dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
while ($line < $num) { $resql = $this->db->query($sql);
$data[$line] = $this->db->fetch_object($resql); 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')) { $line++;
dol_filecache($cachedir, $filename, $data);
}
$this->db->free($resql);
} }
} else {
$data = dol_readcachefile($cachedir, $filename); $this->db->free($resql);
} }
if (!empty($data)) { if (!empty($data)) {

View File

@ -74,57 +74,41 @@ class box_birthdays_members extends ModeleBoxes
global $conf, $user, $langs; global $conf, $user, $langs;
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; 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"); $langs->load("boxes");
$this->max = $max; $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")); $this->info_box_head = array('text' => $langs->trans("BoxTitleMemberNextBirthdays"));
if ($user->hasRight('adherent', 'lire')) { if ($user->hasRight('adherent', 'lire')) {
$cachedir = DOL_DATA_ROOT.'/users/temp';
$filename = '/boxbirthdays-members'.$fileid;
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array(); $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"; $tmparray = dol_getdate(dol_now(), true);
$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);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $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";
$resql = $this->db->query($sql); $sql .= " FROM ".MAIN_DB_PREFIX."adherent as u";
if ($resql) { $sql .= " WHERE u.entity IN (".getEntity('adherent').")";
$num = $this->db->num_rows($resql); $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; dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
while ($line < $num) { $resql = $this->db->query($sql);
$data[$line] = $this->db->fetch_object($resql); 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')) { $line++;
dol_filecache($cachedir, $filename, $data);
}
$this->db->free($resql);
} }
} else {
$data = dol_readcachefile($cachedir, $filename); $this->db->free($resql);
} }
if (!empty($data)) { if (!empty($data)) {

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/core/boxes/box_project.php * \file htdocs/core/boxes/box_project.php
* \ingroup projet * \ingroup project
* \brief Module to show Projet activity of the current Year * \brief Module to show Projet activity of the current Year
*/ */
include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";

View File

@ -22,7 +22,7 @@
/** /**
* \file htdocs/core/boxes/box_validated_projects.php * \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 * \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"; include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";

View File

@ -127,10 +127,11 @@ class modProjet extends DolibarrModules
// Boxes // Boxes
$this->boxes = array( $this->boxes = array(
0=>array('file'=>'box_project.php', 'enabledbydefaulton'=>'Home'), 0=>array('file'=>'box_project.php', 'enabledbydefaulton'=>'Home'), // open projects
1=>array('file'=>'box_task.php', 'enabledbydefaulton'=>'Home'), 1=>array('file'=>'box_project_opportunities.php', 'enabledbydefaulton'=>'Home'), // open opportunities
2=>array('file'=>'box_validated_projects.php', 'enabledbydefaulton'=>'Home'), 2=>array('file'=>'box_task.php', 'enabledbydefaulton'=>'Home'),
3=>array('file'=>'box_funnel_of_prospection.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 // Permissions

View File

@ -33,6 +33,7 @@ DeleteATask=Delete a task
ConfirmDeleteAProject=Are you sure you want to delete this project? ConfirmDeleteAProject=Are you sure you want to delete this project?
ConfirmDeleteATask=Are you sure you want to delete this task? ConfirmDeleteATask=Are you sure you want to delete this task?
OpenedProjects=Open projects OpenedProjects=Open projects
OpenedProjectsOpportunities=Open opportunities
OpenedTasks=Open tasks OpenedTasks=Open tasks
OpportunitiesStatusForOpenedProjects=Leads amount of open projects by status OpportunitiesStatusForOpenedProjects=Leads amount of open projects by status
OpportunitiesStatusForProjects=Leads amount of projects by status OpportunitiesStatusForProjects=Leads amount of projects by status