mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Clean cache. Must use conf->cache
This commit is contained in:
parent
c9f9d549e6
commit
4ee2bf5428
|
|
@ -1000,8 +1000,8 @@ class FormTicket
|
|||
print '<option value="">'.((is_numeric($empty) || $empty == 'ifone') ? ' ' : $empty).'</option>';
|
||||
}
|
||||
|
||||
if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) {
|
||||
foreach ($ticketstat->cache_category_tickets as $id => $arraycategories) {
|
||||
if (is_array($conf->cache['category_tickets']) && count($conf->cache['category_tickets'])) {
|
||||
foreach ($conf->cache['category_tickets'] as $id => $arraycategories) {
|
||||
// Exclude some record
|
||||
if ($publicgroups) {
|
||||
if (empty($arraycategories['public'])) {
|
||||
|
|
@ -1044,7 +1044,7 @@ class FormTicket
|
|||
print ' selected="selected"';
|
||||
} elseif ($arraycategories['use_default'] == "1" && empty($selected) && (!$empty || $empty == 'ifone')) {
|
||||
print ' selected="selected"';
|
||||
} elseif (count($ticketstat->cache_category_tickets) == 1 && (!$empty || $empty == 'ifone')) { // If only 1 choice, we autoselect it
|
||||
} elseif (count($conf->cache['category_tickets']) == 1 && (!$empty || $empty == 'ifone')) { // If only 1 choice, we autoselect it
|
||||
print ' selected="selected"';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -554,7 +554,6 @@ class Tickets extends DolibarrApi
|
|||
"cache_msgs_ticket",
|
||||
"cache_logs_ticket",
|
||||
"cache_types_tickets",
|
||||
"cache_category_tickets",
|
||||
"regeximgext",
|
||||
"labelStatus",
|
||||
"labelStatusShort",
|
||||
|
|
|
|||
|
|
@ -216,11 +216,6 @@ class Ticket extends CommonObject
|
|||
*/
|
||||
public $cache_types_tickets;
|
||||
|
||||
/**
|
||||
* @var array<int,array{code:string,use_default:int,pos:int,public:int,active:int,force_severity:int,fk_parent:int,label:string}> Cache of Ticket categories
|
||||
*/
|
||||
public $cache_category_tickets;
|
||||
|
||||
/**
|
||||
* @var array<int,array{private:0|1|'0'|'1',fk_user_author:int,fk_contact_author?:int,message:string}> cache msgs ticket
|
||||
*/
|
||||
|
|
@ -1384,9 +1379,9 @@ class Ticket extends CommonObject
|
|||
*/
|
||||
public function loadCacheCategoriesTickets($publicgroup = -1)
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
if ($publicgroup == -1 && !empty($this->cache_category_tickets) && count($this->cache_category_tickets)) {
|
||||
if ($publicgroup == -1 && !empty($conf->cache['category_tickets']) && count($conf->cache['category_tickets'])) {
|
||||
// Cache already loaded
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1408,18 +1403,18 @@ class Ticket extends CommonObject
|
|||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->cache_category_tickets[$obj->rowid]['code'] = $obj->code;
|
||||
$this->cache_category_tickets[$obj->rowid]['use_default'] = $obj->use_default;
|
||||
$this->cache_category_tickets[$obj->rowid]['pos'] = $obj->pos;
|
||||
$this->cache_category_tickets[$obj->rowid]['public'] = $obj->public;
|
||||
$this->cache_category_tickets[$obj->rowid]['active'] = $obj->active;
|
||||
$this->cache_category_tickets[$obj->rowid]['force_severity'] = $obj->force_severity;
|
||||
$this->cache_category_tickets[$obj->rowid]['fk_parent'] = $obj->fk_parent;
|
||||
$conf->cache['category_tickets'][$obj->rowid]['code'] = $obj->code;
|
||||
$conf->cache['category_tickets'][$obj->rowid]['use_default'] = $obj->use_default;
|
||||
$conf->cache['category_tickets'][$obj->rowid]['pos'] = $obj->pos;
|
||||
$conf->cache['category_tickets'][$obj->rowid]['public'] = $obj->public;
|
||||
$conf->cache['category_tickets'][$obj->rowid]['active'] = $obj->active;
|
||||
$conf->cache['category_tickets'][$obj->rowid]['force_severity'] = $obj->force_severity;
|
||||
$conf->cache['category_tickets'][$obj->rowid]['fk_parent'] = $obj->fk_parent;
|
||||
|
||||
// If translation exists, we use it to store already translated string.
|
||||
// Warning: You should not use this and recompute the translated string into caller code to get the value into expected language
|
||||
$label = ($langs->trans("TicketCategoryShort".$obj->code) != "TicketCategoryShort".$obj->code ? $langs->trans("TicketCategoryShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
|
||||
$this->cache_category_tickets[$obj->rowid]['label'] = $label;
|
||||
$conf->cache['category_tickets'][$obj->rowid]['label'] = $label;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user