Skip to content

Commit

Permalink
Added search condition by application and some change
Browse files Browse the repository at this point in the history
  • Loading branch information
prog-it committed Nov 24, 2015
1 parent 3bcc501 commit 4cf943a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 18 deletions.
6 changes: 4 additions & 2 deletions inc/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@
$display_search['did'] = 0;
# Показ условия поиска - Исходящий канал
$display_search['dstchannel'] = 0;
# Показ условия поиска - Описание (userfield)
$display_search['userfield'] = 0;
# Показ условия поиска - Код аккаунта
$display_search['accountcode'] = 0;
# Показ условия поиска - Описание (userfield)
$display_search['userfield'] = 0;
# Показ условия поиска - Приложение
$display_search['lastapp'] = 0;

### Включение / Отключение показа некоторых колонок
## Если 1 - показать, 0 - скрыть
Expand Down
2 changes: 1 addition & 1 deletion inc/version.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

### Версия скрипта
define('VERSION', '2.2.3.1');
define('VERSION', '2.2.4');



Expand Down
10 changes: 8 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@
$disposition = (empty($_REQUEST['disposition']) || $_REQUEST['disposition'] == 'all') ? NULL : "$search_condition disposition = '$_REQUEST[disposition]'";
}

if ( isset($_REQUEST['lastapp_neg']) && $_REQUEST['lastapp_neg'] == 'true' ) {
$lastapp = (empty($_REQUEST['lastapp']) || $_REQUEST['lastapp'] == 'all') ? NULL : "$search_condition lastapp != '$_REQUEST[lastapp]'";
} else {
$lastapp = (empty($_REQUEST['lastapp']) || $_REQUEST['lastapp'] == 'all') ? NULL : "$search_condition lastapp = '$_REQUEST[lastapp]'";
}

if ( $search_condition == '' ) {
if ( isset($_REQUEST['search_mode']) && $_REQUEST['search_mode'] == 'any' ) {
$search_condition = ' OR ';
Expand All @@ -182,7 +188,7 @@
}
}

$where = "$channel $src $clid $did $dstchannel $dst $userfield $accountcode $disposition";
$where = "$channel $src $clid $did $dstchannel $dst $userfield $accountcode $disposition $lastapp";

$duration = (!isset($_REQUEST['dur_min']) || is_blank($_REQUEST['dur_max'])) ? NULL : "duration BETWEEN '$_REQUEST[dur_min]' AND '$_REQUEST[dur_max]'";

Expand Down Expand Up @@ -596,7 +602,7 @@

if ( isset($_REQUEST['need_chart_cc']) && $_REQUEST['need_chart_cc'] == 'true' ) {
$date_range = "( (calldate BETWEEN $startdate AND $enddate) or (calldate + interval duration second BETWEEN $startdate AND $enddate) or ( calldate + interval duration second >= $enddate AND calldate <= $startdate ) )";
$where = "$channel $dstchannel $src $clid $dst $userfield $accountcode $disposition $duration $cdr_user_name";
$where = "$channel $dstchannel $src $clid $dst $userfield $accountcode $disposition $lastapp $duration $cdr_user_name";
if ( strlen($where) > 9 ) {
$where = "WHERE $date_range AND ( $where )";
} else {
Expand Down
44 changes: 31 additions & 13 deletions templates/form.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,6 @@
</tr>
<? } ?>

<? if ($display_search['userfield'] == 1) { ?>
<tr>
<td><input <?php if (isset($_REQUEST['order']) && $_REQUEST['order'] == 'userfield') { echo 'checked="checked"'; } ?> type="radio" id="id_order_userfield" name="order" value="userfield">&nbsp;<label for="id_order_userfield">Описание</label></td>
<td><input class="margin-left0" type="text" name="userfield" id="userfield" value="<?php if (isset($_REQUEST['userfield'])) { echo htmlspecialchars($_REQUEST['userfield']); } ?>">
<input <?php if ( isset($_REQUEST['userfield_neg'] ) && $_REQUEST['userfield_neg'] == 'true' ) { echo 'checked="checked"'; } ?> type="checkbox" name="userfield_neg" value="true" id="id_userfield_neg"> <label for="id_userfield_neg">Не</label> &ensp;
<input <?php if (empty($_REQUEST['userfield_mod']) || $_REQUEST['userfield_mod'] == 'begins_with') { echo 'checked="checked"'; } ?> type="radio" name="userfield_mod" value="begins_with" id="id_userfield_mod1"> <label for="id_userfield_mod1">Начинается на</label> &ensp;
<input <?php if (isset($_REQUEST['userfield_mod']) && $_REQUEST['userfield_mod'] == 'contains') { echo 'checked="checked"'; } ?> type="radio" name="userfield_mod" value="contains" id="id_userfield_mod2"> <label for="id_userfield_mod2">Содержит</label> &ensp;
<input <?php if (isset($_REQUEST['userfield_mod']) && $_REQUEST['userfield_mod'] == 'ends_with') { echo 'checked="checked"'; } ?> type="radio" name="userfield_mod" value="ends_with" id="id_userfield_mod3"> <label for="id_userfield_mod3">Кончается на</label> &ensp;
<input <?php if (isset($_REQUEST['userfield_mod']) && $_REQUEST['userfield_mod'] == 'exact') { echo 'checked="checked"'; } ?> type="radio" name="userfield_mod" value="exact" id="id_userfield_mod4"> <label for="id_userfield_mod4">Равно</label>
</td>
</tr>
<? } ?>

<? if ($display_search['accountcode'] == 1) { ?>
<tr>
<td><input <?php if (isset($_REQUEST['order']) && $_REQUEST['order'] == 'accountcode') { echo 'checked="checked"'; } ?> type="radio" id="id_order_accountcode" name="order" value="accountcode">&nbsp;<label for="id_order_accountcode">Код аккаунта</label></td>
Expand All @@ -249,6 +236,19 @@
</tr>
<? } ?>

<? if ($display_search['userfield'] == 1) { ?>
<tr>
<td><input <?php if (isset($_REQUEST['order']) && $_REQUEST['order'] == 'userfield') { echo 'checked="checked"'; } ?> type="radio" id="id_order_userfield" name="order" value="userfield">&nbsp;<label for="id_order_userfield">Описание</label></td>
<td><input class="margin-left0" type="text" name="userfield" id="userfield" value="<?php if (isset($_REQUEST['userfield'])) { echo htmlspecialchars($_REQUEST['userfield']); } ?>">
<input <?php if ( isset($_REQUEST['userfield_neg'] ) && $_REQUEST['userfield_neg'] == 'true' ) { echo 'checked="checked"'; } ?> type="checkbox" name="userfield_neg" value="true" id="id_userfield_neg"> <label for="id_userfield_neg">Не</label> &ensp;
<input <?php if (empty($_REQUEST['userfield_mod']) || $_REQUEST['userfield_mod'] == 'begins_with') { echo 'checked="checked"'; } ?> type="radio" name="userfield_mod" value="begins_with" id="id_userfield_mod1"> <label for="id_userfield_mod1">Начинается на</label> &ensp;
<input <?php if (isset($_REQUEST['userfield_mod']) && $_REQUEST['userfield_mod'] == 'contains') { echo 'checked="checked"'; } ?> type="radio" name="userfield_mod" value="contains" id="id_userfield_mod2"> <label for="id_userfield_mod2">Содержит</label> &ensp;
<input <?php if (isset($_REQUEST['userfield_mod']) && $_REQUEST['userfield_mod'] == 'ends_with') { echo 'checked="checked"'; } ?> type="radio" name="userfield_mod" value="ends_with" id="id_userfield_mod3"> <label for="id_userfield_mod3">Кончается на</label> &ensp;
<input <?php if (isset($_REQUEST['userfield_mod']) && $_REQUEST['userfield_mod'] == 'exact') { echo 'checked="checked"'; } ?> type="radio" name="userfield_mod" value="exact" id="id_userfield_mod4"> <label for="id_userfield_mod4">Равно</label>
</td>
</tr>
<? } ?>

<tr>
<td><input <?php if (isset($_REQUEST['order']) && $_REQUEST['order'] == 'duration') { echo 'checked="checked"'; } ?> type="radio" id="id_order_duration" name="order" value="duration">&nbsp;<label for="id_order_duration">Продолжительность</label></td>
<td><label for="id_dur_min">Между</label>&nbsp;
Expand All @@ -258,6 +258,24 @@
&nbsp;<label for="id_dur_max">Секунд</label>
</td>
</tr>

<? if ($display_search['lastapp'] == 1) { ?>
<tr>
<td><input <?php if (isset($_REQUEST['order']) && $_REQUEST['order'] == 'lastapp') { echo 'checked="checked"'; } ?> type="radio" id="id_order_lastapp" name="order" value="lastapp">&nbsp;<label for="id_order_lastapp">Приложение</label></td>
<td>
<input <?php if ( isset($_REQUEST['lastapp_neg'] ) && $_REQUEST['lastapp_neg'] == 'true' ) { echo 'checked="checked"'; } ?> class="margin-left0" type="checkbox" name="lastapp_neg" id="id_lastapp_neg" value="true"> <label for="id_lastapp_neg">Не</label>&nbsp;
<select name="lastapp" id="lastapp">
<option <?php if (empty($_REQUEST['lastapp']) || $_REQUEST['lastapp'] == 'all') { echo 'selected="selected"'; } ?> value="all">Любое</option>
<option <?php if (isset($_REQUEST['lastapp']) && $_REQUEST['lastapp'] == 'Dial') { echo 'selected="selected"'; } ?> value="Dial">Набор номера</option>
<option <?php if (isset($_REQUEST['lastapp']) && $_REQUEST['lastapp'] == 'Hangup') { echo 'selected="selected"'; } ?> value="Hangup">Разъединение</option>
<option <?php if (isset($_REQUEST['lastapp']) && $_REQUEST['lastapp'] == 'Playback') { echo 'selected="selected"'; } ?> value="Playback">Воспроизведение</option>
<option <?php if (isset($_REQUEST['lastapp']) && $_REQUEST['lastapp'] == 'RetryDial') { echo 'selected="selected"'; } ?> value="RetryDial">Повторный набор</option>
<option <?php if (isset($_REQUEST['lastapp']) && $_REQUEST['lastapp'] == 'Queue') { echo 'selected="selected"'; } ?> value="Queue">Очередь</option>
</select>
</td>
</tr>
<? } ?>

<tr>
<td><input <?php if (isset($_REQUEST['order']) && $_REQUEST['order'] == 'disposition') { echo 'checked="checked"'; } ?> type="radio" id="id_order_disposition" name="order" value="disposition">&nbsp;<label for="id_order_disposition">Статус звонка</label></td>
<td>
Expand Down

0 comments on commit 4cf943a

Please sign in to comment.