diff --git a/lhc_web/design/defaulttheme/tpl/lhfront/dashboard/panels/bodies/online_operators.tpl.php b/lhc_web/design/defaulttheme/tpl/lhfront/dashboard/panels/bodies/online_operators.tpl.php index 7d8077ec5..e458bc9d4 100644 --- a/lhc_web/design/defaulttheme/tpl/lhfront/dashboard/panels/bodies/online_operators.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhfront/dashboard/panels/bodies/online_operators.tpl.php @@ -33,7 +33,9 @@
{{operator.lastactivity_ago}}
- {{operator.active_chats}} + + {{operator.active_chats}} getTranslation('chat/syncadmininterface','a.c')?>, {{operator.max_chats && operator.max_chats > 0 ? (operator.max_chats - operator.active_chats) : ' n/a'}} getTranslation('chat/syncadmininterface','f.s')?> +
{{operator.departments_names.join(", ")}}
diff --git a/lhc_web/lib/models/lhdepartament/erlhcoreclassmodeluserdep.php b/lhc_web/lib/models/lhdepartament/erlhcoreclassmodeluserdep.php index 850932772..6af32a66f 100644 --- a/lhc_web/lib/models/lhdepartament/erlhcoreclassmodeluserdep.php +++ b/lhc_web/lib/models/lhdepartament/erlhcoreclassmodeluserdep.php @@ -31,6 +31,7 @@ public function getState() 'type' => $this->type, 'dep_group_id' => $this->dep_group_id, 'exclude_autoasign' => $this->exclude_autoasign, + 'max_chats' => $this->max_chats, ); } @@ -150,6 +151,7 @@ public static function getOnlineOperators($currentUser, $canListOnlineUsersAll = $filter['select_columns'] = ' max(`id`) as `id`, max(`ro`) as `ro`, + max(`max_chats`) as `max_chats`, max(`dep_id`) as `dep_id`, max(`hide_online_ts`) as `hide_online_ts`, max(`hide_online`) as `hide_online`, @@ -180,6 +182,7 @@ public static function getOnlineOperators($currentUser, $canListOnlineUsersAll = public $type = 0; public $dep_group_id = 0; public $exclude_autoasign = 0; + public $max_chats = 0; } ?> \ No newline at end of file diff --git a/lhc_web/modules/lhchat/syncadmininterface.php b/lhc_web/modules/lhchat/syncadmininterface.php index 590a75350..08633aee7 100644 --- a/lhc_web/modules/lhchat/syncadmininterface.php +++ b/lhc_web/modules/lhchat/syncadmininterface.php @@ -621,7 +621,7 @@ $onlineOperators = erLhcoreClassModelUserDep::getOnlineOperators($currentUser,$canListOnlineUsersAll,$filter,is_numeric($Params['user_parameters_unordered']['limito']) ? (int)$Params['user_parameters_unordered']['limito'] : 10,$onlineTimeout); - erLhcoreClassChat::prefillGetAttributes($onlineOperators,array('lastactivity_ago','offline_since','user_id','id','name_official','pending_chats','inactive_chats','active_chats','departments_names','hide_online','avatar'),array(),array('filter_function' => true, 'remove_all' => true)); + erLhcoreClassChat::prefillGetAttributes($onlineOperators,array('lastactivity_ago','max_chats','offline_since','user_id','id','name_official','pending_chats','inactive_chats','active_chats','departments_names','hide_online','avatar'),array(),array('filter_function' => true, 'remove_all' => true)); $currentOp = isset($onlineOperators[$userData->id]) ? $onlineOperators[$userData->id] : null; diff --git a/lhc_web/modules/lhrestapi/onlineusers.php b/lhc_web/modules/lhrestapi/onlineusers.php index 45c002dba..9fb52ba4b 100644 --- a/lhc_web/modules/lhrestapi/onlineusers.php +++ b/lhc_web/modules/lhrestapi/onlineusers.php @@ -26,11 +26,12 @@ $filter['sort'] = 'active_chats DESC, hide_online ASC'; $filter['group'] = 'user_id'; $filter = array_merge_recursive($filter, $params); - $filter['ignore_fields'] = array('exclude_autoasign','dep_group_id','type','ro','id','dep_id','hide_online_ts','hide_online','last_activity','lastd_activity','always_on','last_accepted','active_chats','pending_chats','inactive_chats'); + $filter['ignore_fields'] = array('exclude_autoasign','dep_group_id','type','max_chats','ro','id','dep_id','hide_online_ts','hide_online','last_activity','lastd_activity','always_on','last_accepted','active_chats','pending_chats','inactive_chats'); $filter['select_columns'] = ' max(`id`) as `id`, max(`dep_id`) as `dep_id`, max(`ro`) as `ro`, + max(`max_chats`) as `max_chats`, max(`hide_online_ts`) as `hide_online_ts`, max(`hide_online`) as `hide_online`, max(`last_activity`) as `last_activity`, diff --git a/lhc_web/pos/lhdepartament/erlhcoreclassmodeluserdep.php b/lhc_web/pos/lhdepartament/erlhcoreclassmodeluserdep.php index ab6e37110..05627c009 100644 --- a/lhc_web/pos/lhdepartament/erlhcoreclassmodeluserdep.php +++ b/lhc_web/pos/lhdepartament/erlhcoreclassmodeluserdep.php @@ -9,82 +9,13 @@ $def->idProperty->propertyName = 'id'; $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' ); -$def->properties['user_id'] = new ezcPersistentObjectProperty(); -$def->properties['user_id']->columnName = 'user_id'; -$def->properties['user_id']->propertyName = 'user_id'; -$def->properties['user_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['dep_id'] = new ezcPersistentObjectProperty(); -$def->properties['dep_id']->columnName = 'dep_id'; -$def->properties['dep_id']->propertyName = 'dep_id'; -$def->properties['dep_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -// Last activity -$def->properties['last_activity'] = new ezcPersistentObjectProperty(); -$def->properties['last_activity']->columnName = 'last_activity'; -$def->properties['last_activity']->propertyName = 'last_activity'; -$def->properties['last_activity']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -// Last dom activity -$def->properties['lastd_activity'] = new ezcPersistentObjectProperty(); -$def->properties['lastd_activity']->columnName = 'lastd_activity'; -$def->properties['lastd_activity']->propertyName = 'lastd_activity'; -$def->properties['lastd_activity']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['hide_online_ts'] = new ezcPersistentObjectProperty(); -$def->properties['hide_online_ts']->columnName = 'hide_online_ts'; -$def->properties['hide_online_ts']->propertyName = 'hide_online_ts'; -$def->properties['hide_online_ts']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['hide_online'] = new ezcPersistentObjectProperty(); -$def->properties['hide_online']->columnName = 'hide_online'; -$def->properties['hide_online']->propertyName = 'hide_online'; -$def->properties['hide_online']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['last_accepted'] = new ezcPersistentObjectProperty(); -$def->properties['last_accepted']->columnName = 'last_accepted'; -$def->properties['last_accepted']->propertyName = 'last_accepted'; -$def->properties['last_accepted']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['active_chats'] = new ezcPersistentObjectProperty(); -$def->properties['active_chats']->columnName = 'active_chats'; -$def->properties['active_chats']->propertyName = 'active_chats'; -$def->properties['active_chats']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['pending_chats'] = new ezcPersistentObjectProperty(); -$def->properties['pending_chats']->columnName = 'pending_chats'; -$def->properties['pending_chats']->propertyName = 'pending_chats'; -$def->properties['pending_chats']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['inactive_chats'] = new ezcPersistentObjectProperty(); -$def->properties['inactive_chats']->columnName = 'inactive_chats'; -$def->properties['inactive_chats']->propertyName = 'inactive_chats'; -$def->properties['inactive_chats']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['always_on'] = new ezcPersistentObjectProperty(); -$def->properties['always_on']->columnName = 'always_on'; -$def->properties['always_on']->propertyName = 'always_on'; -$def->properties['always_on']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['ro'] = new ezcPersistentObjectProperty(); -$def->properties['ro']->columnName = 'ro'; -$def->properties['ro']->propertyName = 'ro'; -$def->properties['ro']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['type'] = new ezcPersistentObjectProperty(); -$def->properties['type']->columnName = 'type'; -$def->properties['type']->propertyName = 'type'; -$def->properties['type']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['dep_group_id'] = new ezcPersistentObjectProperty(); -$def->properties['dep_group_id']->columnName = 'dep_group_id'; -$def->properties['dep_group_id']->propertyName = 'dep_group_id'; -$def->properties['dep_group_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; - -$def->properties['exclude_autoasign'] = new ezcPersistentObjectProperty(); -$def->properties['exclude_autoasign']->columnName = 'exclude_autoasign'; -$def->properties['exclude_autoasign']->propertyName = 'exclude_autoasign'; -$def->properties['exclude_autoasign']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; +foreach (['user_id','dep_id','last_activity','lastd_activity','hide_online_ts','hide_online','last_accepted', + 'active_chats','pending_chats','inactive_chats','always_on','ro','max_chats','type','dep_group_id','exclude_autoasign'] as $posAttr) { + $def->properties[$posAttr] = new ezcPersistentObjectProperty(); + $def->properties[$posAttr]->columnName = $posAttr; + $def->properties[$posAttr]->propertyName = $posAttr; + $def->properties[$posAttr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; +} return $def;