Clean code

This commit is contained in:
Laurent Destailleur 2023-03-06 18:03:30 +01:00
parent 969a953daa
commit 9e18a8b783
4 changed files with 8 additions and 8 deletions

View File

@ -235,7 +235,7 @@ if ($object->id > 0) {
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_myobject_'.$object->id;
$cachekey = 'count_events_propal_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnPropal").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
@ -247,7 +247,7 @@ if ($object->id > 0) {
$filters['search_rowid'] = $search_rowid;
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : '');
}
}

View File

@ -57,7 +57,7 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l
/**
* Save data into a memory area shared by all users, all sessions on server
* Save data into a memory area shared by all users, all sessions on server. Note: MAIN_CACHE_COUNT must be set.
*
* @param string $memoryid Memory id of shared area
* @param mixed $data Data to save. It must not be a null value.

View File

@ -112,14 +112,15 @@ function propal_prepare_head($object)
$nbEvent = 0;
// Enable caching of thirdparty count actioncomm
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_thirdparty_'.$object->id;
$cachekey = 'count_events_propal_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbEvent = $dataretrieved;
} else {
/*$sql = "SELECT COUNT(id) as nb";
$sql = "SELECT COUNT(id) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
$sql .= " WHERE fk_soc = ".((int) $object->id);
$sql .= " WHERE fk_element = ".((int) $object->id);
$sql .= " AND elementtype = 'propal'";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
@ -128,7 +129,6 @@ function propal_prepare_head($object)
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
}
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
*/
}
$head[$h][1] .= '/';

View File

@ -319,7 +319,7 @@ if ($object->id > 0) {
$filters['search_rowid'] = $search_rowid;
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : '');
}
}