Skip to content

Commit

Permalink
Add support for invitation_id
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jul 26, 2018
1 parent 902e506 commit 9ad938f
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions classes/erlhcoreclassmodeleschat.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function getState()
'msg_system' => $this->msg_system,
'pnd_time' => $this->pnd_time,
'cls_time' => $this->cls_time,
'invitation_id' => $this->invitation_id,
);

erLhcoreClassChatEventDispatcher::getInstance()->dispatch('elasticsearch.getstate', array(
Expand Down Expand Up @@ -187,4 +188,5 @@ public function __get($var)
public $msg_system = null;
public $pnd_time = null;
public $cls_time = null;
public $invitation_id = null;
}
12 changes: 12 additions & 0 deletions classes/filter/chat_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@
)
);

$fieldsSearch['invitation_id'] = array (
'type' => 'text',
'trans' => 'Invitation',
'required' => false,
'valid_if_filled' => false,
'filter_type' => 'filter',
'filter_table_field' => 'invitation_id',
'validation_definition' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 1)
)
);

$fieldsSearch['department_group_id'] = array (
'type' => 'text',
'trans' => 'Department group',
Expand Down
1 change: 1 addition & 0 deletions classes/lhelasticsearchindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public static function indexChats($params)
$esChat->usaccept = $item->usaccept;
$esChat->lsync = $item->lsync;
$esChat->auto_responder_id = $item->auto_responder_id;
$esChat->invitation_id = $item->invitation_id;

// Extensions can append custom value
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('elasticsearch.indexchat', array(
Expand Down
13 changes: 13 additions & 0 deletions design/elasticsearchtheme/tpl/elasticsearch/parts/filter.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@
</div>
</div>

<div class="col-md-2">
<div class="form-group">
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Invitation');?></label>
<?php echo erLhcoreClassRenderHelper::renderCombobox( array (
'input_name' => 'invitation_id',
'optional_field' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Choose proactive invitation'),
'selected_id' => $input->invitation_id,
'css_class' => 'form-control',
'list_function' => 'erLhAbstractModelProactiveChatInvitation::getList'
)); ?>
</div>
</div>

<div class="col-md-3">
<div class="form-group">
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Department group');?></label>
Expand Down
3 changes: 3 additions & 0 deletions doc/structure_elastic.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
"chat_duration": {
"type": "integer"
},
"invitation_id": {
"type": "integer"
},
"transfer_timeout_ts": {
"type": "integer"
},
Expand Down
4 changes: 4 additions & 0 deletions modules/lhelasticsearch/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
$sparams['body']['query']['bool']['must'][]['term']['dep_id'] = (int)trim($filterParams['input_form']->department_id);
}

if (trim($filterParams['input_form']->invitation_id) != '') {
$sparams['body']['query']['bool']['must'][]['term']['invitation_id'] = (int)trim($filterParams['input_form']->invitation_id);
}

if (trim($filterParams['input_form']->department_group_id) != '') {
$db = ezcDbInstance::get();
$stmt = $db->prepare('SELECT dep_id FROM lh_departament_group_member WHERE dep_group_id = :group_id');
Expand Down
2 changes: 1 addition & 1 deletion modules/lhelasticsearch/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

$ViewList['list'] = array(
'params' => array(),
'uparams' => array('attr_int_1','attr_int_2','attr_int_3','attr_int_4','attr_int_5','attr_int_6','attr_int_7','attr_int_8','attr_int_9','search_in','sort_chat','keyword','tab','chat_id','message_text','nick','sort_msg','email','user_id','department_id','timefrom','timefrom_minutes','timefrom_hours','timeto','timeto_minutes','timeto_hours','department_group_id','group_id'),
'uparams' => array('invitation_id','attr_int_1','attr_int_2','attr_int_3','attr_int_4','attr_int_5','attr_int_6','attr_int_7','attr_int_8','attr_int_9','search_in','sort_chat','keyword','tab','chat_id','message_text','nick','sort_msg','email','user_id','department_id','timefrom','timefrom_minutes','timefrom_hours','timeto','timeto_minutes','timeto_hours','department_group_id','group_id'),
'multiple_arguments' => array('search_in'),
'functions' => array('configure')
);
Expand Down

0 comments on commit 9ad938f

Please sign in to comment.