Debug v18
This commit is contained in:
parent
75c3fbf28e
commit
fec7c879d3
@ -148,7 +148,7 @@ function dol_getcache($memoryid)
|
||||
}
|
||||
|
||||
// Using a memcached server
|
||||
if (!empty($conf->memcached->enabled) && class_exists('Memcached')) {
|
||||
if (isModEnabled('memcached') && class_exists('Memcached')) {
|
||||
global $m;
|
||||
if (empty($m) || !is_object($m)) {
|
||||
$m = new Memcached();
|
||||
@ -173,7 +173,7 @@ function dol_getcache($memoryid)
|
||||
} else {
|
||||
return -$rescode;
|
||||
}
|
||||
} elseif (!empty($conf->memcached->enabled) && class_exists('Memcache')) { // This is a really not reliable cache ! Use Memcached instead.
|
||||
} elseif (isModEnabled('memcached') && class_exists('Memcache')) { // This is a really not reliable cache ! Use Memcached instead.
|
||||
global $m;
|
||||
if (empty($m) || !is_object($m)) {
|
||||
$m = new Memcache();
|
||||
|
||||
@ -230,7 +230,7 @@ function project_prepare_head(Project $project, $moreparam = '')
|
||||
$head[$h][1] = $langs->trans("EventOrganization");
|
||||
|
||||
// Enable caching of conf or booth count
|
||||
$nbConfOrBooth = 0;
|
||||
$nbConfOrBooth = 0; $nbAttendees = 0;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_conferenceorbooth_'.$project->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
@ -248,8 +248,30 @@ function project_prepare_head(Project $project, $moreparam = '')
|
||||
}
|
||||
dol_setcache($cachekey, $nbConfOrBooth, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
if ($nbConfOrBooth > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbConfOrBooth . '</span>';
|
||||
$cachekey = 'count_attendees_'.$project->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbAttendees = $dataretrieved;
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
|
||||
$conforboothattendee=new ConferenceOrBoothAttendee($db);
|
||||
$result = $conforboothattendee->fetchAll('', '', 0, 0, array('t.fk_project'=>$project->id));
|
||||
//,
|
||||
if (!is_array($result) && $result<0) {
|
||||
setEventMessages($conforboothattendee->error, $conforboothattendee->errors, 'errors');
|
||||
} else {
|
||||
$nbAttendees = count($result);
|
||||
}
|
||||
dol_setcache($cachekey, $nbAttendees, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
if ($nbConfOrBooth > 0 || $nbAttendees > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">';
|
||||
$head[$h][1] .= '<span title="'.dol_escape_htmltag($langs->trans("ConferenceOrBooth")).'">'.$nbConfOrBooth.'</span>';
|
||||
if ($nbConfOrBooth > 0 && $nbAttendees > 0) {
|
||||
$head[$h][1] .= ' / ';
|
||||
}
|
||||
$head[$h][1] .= '<span title="'.dol_escape_htmltag($langs->trans("Attendees")).'">'.$nbAttendees.'</span>';
|
||||
$head[$h][1] .= '</span>';
|
||||
}
|
||||
$head[$h][2] = 'eventorganisation';
|
||||
$h++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user