Skip to content

Commit

Permalink
Search by mailbox
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Feb 7, 2023
1 parent d6ee804 commit 2407c6d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
12 changes: 12 additions & 0 deletions classes/filter/mail_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@
)
);

$fieldsSearch['mailbox_ids'] = array (
'type' => 'text',
'trans' => 'Message status',
'required' => false,
'valid_if_filled' => false,
'filter_type' => 'filterin',
'filter_table_field' => 'mailbox_id',
'validation_definition' => new ezcInputFormDefinitionElement (
ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0), FILTER_REQUIRE_ARRAY
)
);

$fieldsSearch['conversation_id'] = array (
'type' => 'text',
'trans' => 'Sort by',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@
</div>

<div class="col-md-2">
<div class="form-group">
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Mailbox');?></label>
<?php echo erLhcoreClassRenderHelper::renderMultiDropdown( array (
'input_name' => 'mailbox_ids[]',
'optional_field' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Choose mailbox'),
'selected_id' => $input->mailbox_ids,
'css_class' => 'form-control',
'display_name' => 'mail',
'list_function_params' => ['limit' => false, 'sort' => '`mail` ASC'],
'list_function' => 'erLhcoreClassModelMailconvMailbox::getList'
)); ?>
</div>
</div>


<div class="col-md-1">
<div class="form-group">
<?php include(erLhcoreClassDesign::designtpl('elasticsearch/parts/user_title.tpl.php')); ?>
<label><?php echo $userTitle['user'];?></label>
Expand Down Expand Up @@ -113,7 +129,7 @@
</div>
</div>
</div>
<div class="col-md-2">
<div class="col-md-1">
<div class="form-group">
<label><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Subject')?></label>
<?php echo erLhcoreClassRenderHelper::renderMultiDropdown( array (
Expand Down
7 changes: 7 additions & 0 deletions modules/lhelasticsearch/listmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@
}
}

if (isset($filterParams['input']->mailbox_ids) && is_array($filterParams['input']->mailbox_ids) && !empty($filterParams['input']->mailbox_ids)) {
erLhcoreClassChat::validateFilterInString($filterParams['input']->mailbox_ids);
if (!empty($filterParams['input']->mailbox_ids)) {
$sparams['body']['query']['bool']['must'][]['terms']['mailbox_id'] = $filterParams['input']->mailbox_ids;
}
}

if ($filterParams['input_form']->hvf == 1) {
$sparams['body']['query']['bool']['must'][]['terms']['has_attachment'] = [1,2,3];
}
Expand Down
3 changes: 2 additions & 1 deletion modules/lhelasticsearch/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
'department_group_ids','group_ids','hvf','response_type','status','status_conv',
'sender_host','from_host','sender_address','is_followup','undelivered','lang_ids',
'phone','opened','search_email_in','timefromts','fuzzy','fuzzy_prefix','status_conv_id',
'status_msg_id'
'status_msg_id','mailbox_ids'
),
'multiple_arguments' => array(
'search_in',
Expand All @@ -74,6 +74,7 @@
'lang_ids',
'status_conv_id',
'status_msg_id',
'mailbox_ids'
),
'functions' => array('use')
);
Expand Down

0 comments on commit 2407c6d

Please sign in to comment.