Skip to content

Commit

Permalink
4.31v
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Feb 29, 2024
1 parent 903ff23 commit 984363c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 7 deletions.
8 changes: 8 additions & 0 deletions lhc_web/doc/CHANGELOG.txt
@@ -1,3 +1,11 @@
4.31v

1. Optimisation online visitors widget.
2. Svelte fixes for Nan being presented in departments load widget.
3. Various small fixes.

execute doc/update_db/update_302.sql for update

4.30v

Brand new mail module and svelte based dashboard.
Expand Down
5 changes: 4 additions & 1 deletion lhc_web/doc/update_db/structure.json
Expand Up @@ -11379,7 +11379,10 @@
"old" : ["active_url"]
},
"lh_userdep" : {
"new" : {"user_id_type" : "ALTER TABLE `lh_userdep` ADD INDEX `user_id_type` (`user_id`, `type`);"},
"new" : {
"user_id_type" : "ALTER TABLE `lh_userdep` ADD INDEX `user_id_type` (`user_id`, `type`);",
"online_op_widget" : "ALTER TABLE `lh_userdep` ADD INDEX `online_op_widget` (`last_activity`,`user_id`,`dep_id`,`always_on`);"
},
"old" : ["user_id"]
},
"lh_chat_online_user_footprint" : {
Expand Down
1 change: 1 addition & 0 deletions lhc_web/doc/update_db/update_302.sql
@@ -0,0 +1 @@
ALTER TABLE `lh_userdep` ADD INDEX `online_op_widget` (`last_activity`,`user_id`,`dep_id`,`always_on`);
4 changes: 2 additions & 2 deletions lhc_web/lib/core/lhcore/lhupdate.php
Expand Up @@ -2,8 +2,8 @@

class erLhcoreClassUpdate
{
const DB_VERSION = 301;
const LHC_RELEASE = 430;
const DB_VERSION = 302;
const LHC_RELEASE = 431;

public static function doTablesUpdate($definition){
$updateInformation = self::getTablesStatus($definition);
Expand Down
Expand Up @@ -128,7 +128,7 @@ public function __get($var)
}
}

public static function getOnlineOperators($currentUser, $canListOnlineUsersAll = false, $params = array(), $limit = 10, $onlineTimeout = 120)
public static function getOnlineOperators($currentUser, $canListOnlineUsersAll = false, $params = array(), $limit = 10, $onlineTimeout = 120, $paramsExecution = array())
{
$userData = $currentUser->getUserData(true);
$filter = array();
Expand All @@ -148,7 +148,11 @@ public static function getOnlineOperators($currentUser, $canListOnlineUsersAll =
$filter['customfilter'][] = '(dep_id IN (' . implode(',', $userDepartaments) . ') OR user_id = ' . $currentUser->getUserID() . ')';
};

$filter['customfilter'][] = '(last_activity > ' . (int)(time() - $onlineTimeout) . ' OR always_on = 1)';
if (isset($paramsExecution['dashboard']) && $paramsExecution['dashboard'] === true){
$filter['customfilter'][] = '(last_activity > ' . (int)(time() - $onlineTimeout) . ')';
} else {
$filter['customfilter'][] = '(last_activity > ' . (int)(time() - $onlineTimeout) . ' OR always_on = 1)';
}

$filter['limit'] = $limit;

Expand Down
2 changes: 1 addition & 1 deletion lhc_web/modules/lhchat/syncadmininterface.php
Expand Up @@ -725,7 +725,7 @@
}
}

$onlineOperators = erLhcoreClassModelUserDep::getOnlineOperators($currentUser,$canListOnlineUsersAll,$filter,is_numeric($Params['user_parameters_unordered']['limito']) ? (int)$Params['user_parameters_unordered']['limito'] : 10,$onlineTimeout);
$onlineOperators = erLhcoreClassModelUserDep::getOnlineOperators($currentUser,$canListOnlineUsersAll,$filter,is_numeric($Params['user_parameters_unordered']['limito']) ? (int)$Params['user_parameters_unordered']['limito'] : 10,$onlineTimeout, ['dashboard' => true]);

erLhcoreClassChat::prefillGetAttributes($onlineOperators,array('lastactivity_ago','max_chats','offline_since','ro','dep_id','user_id','id','name_official','pending_chats','inactive_chats','active_chats','departments_names','hide_online','avatar'),array(),array('filter_function' => true, 'remove_all' => true));

Expand Down
3 changes: 2 additions & 1 deletion lhc_web/modules/lhinstall/install.php
Expand Up @@ -2090,7 +2090,8 @@
PRIMARY KEY (`id`),
KEY `last_activity_hide_online_dep_id` (`last_activity`,`hide_online`,`dep_id`),
KEY `dep_id` (`dep_id`),
KEY `user_id_type` (`user_id`,`type`)
KEY `user_id_type` (`user_id`,`type`),
KEY `online_op_widget` (`last_activity`,`user_id`,`dep_id`,`always_on`)
) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci");

// Insert record to departament instantly
Expand Down

0 comments on commit 984363c

Please sign in to comment.