Implemented custom status on search form

merge-requests/2/head
Mike Koch 10 years ago
parent 9fc62839c6
commit 5f1e2e844d

@ -95,7 +95,7 @@ foreach ($status as $k => $v)
}
}
// How many statuses are we pulling out of the database?
// How many statuses are we pulling out of the database?\
$tmp = count($status);
// Do we need to search by status?
@ -105,11 +105,16 @@ if ( $tmp < $totalStatuses )
if ($tmp == 0)
{
$status = $possible_status;
unset($status[3]);
}
$resolvedSql = "SELECT `ID` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `IsClosed` = 1";
$resolvedRS = hesk_dbQuery($resolvedSql);
while ($row = $resolvedRS->fetch_assoc())
{
unset($status[$row['ID']]);
}
}
// Add to the SQL
$sql .= " AND `status` IN ('" . implode("','", array_keys($status) ) . "') ";
// Add to the SQL
$sql .= " AND `status` IN ('" . implode("','", array_keys($status) ) . "') ";
}
// --> TICKET PRIORITY

@ -33,18 +33,16 @@
*******************************************************************************/
/* Check if this is a valid include */
if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
if ( ! isset($status) )
{
$status = array(
0 => 'NEW',
1 => 'WAITING REPLY',
2 => 'REPLIED',
#3 => 'RESOLVED (CLOSED)',
4 => 'IN PROGRESS',
5 => 'ON HOLD',
);
$status = array();
//-- We don't want to check statuses that are considered "closed"
$statusRS = hesk_dbQuery('SELECT `ID`, `ShortNameContentKey` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0');
while ($row = $statusRS->fetch_assoc())
{
$status[$row['ID']] = $row['ShortNameContentKey'];
}
}
if ( ! isset($priority) )
@ -114,14 +112,31 @@ $more2 = empty($_GET['more2']) ? 0 : 1;
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="34%"><label><input type="checkbox" name="s0" value="1" <?php if (isset($status[0])) {echo 'checked="checked"';} ?> /> <span class="open"><?php echo $hesklang['open']; ?></span></label></td>
<td width="33%"><label><input type="checkbox" name="s2" value="1" <?php if (isset($status[2])) {echo 'checked="checked"';} ?> /> <span class="replied"><?php echo $hesklang['replied']; ?></span></label></td>
<td width="33%"><label><input type="checkbox" name="s4" value="1" <?php if (isset($status[4])) {echo 'checked="checked"';} ?> /> <span class="inprogress"><?php echo $hesklang['in_progress']; ?></span></label></td>
</tr>
<tr>
<td width="34%"><label><input type="checkbox" name="s1" value="1" <?php if (isset($status[1])) {echo 'checked="checked"';} ?> /> <span class="waitingreply"><?php echo $hesklang['wait_reply']; ?></span></label></td>
<td width="33%"><label><input type="checkbox" name="s3" value="1" <?php if (isset($status[3])) {echo 'checked="checked"';} ?> /> <span class="resolved"><?php echo $hesklang['closed']; ?></span></label></td>
<td width="33%"><label><input type="checkbox" name="s5" value="1" <?php if (isset($status[5])) {echo 'checked="checked"';} ?> /> <span class="onhold"><?php echo $hesklang['on_hold']; ?></span></td>
<?php
$rowCounter = 1;
$statusRS = hesk_dbQuery('SELECT `ID`, `ShortNameContentKey`, `TextColor` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
while ($row = $statusRS->fetch_assoc())
{
if ($rowCounter > 3)
{
echo '</tr><tr>';
$rowCounter = 1;
}
echo '<td width=';
if ($rowCounter != 3)
{
echo '"33%"';
} else
{
echo '"34%"';
}
echo '<label><input type="checkbox" name="s'.$row['ID'].'" value="1"';
if (isset($status[$row['ID']])) {echo 'checked="checked"';}
echo '/> <span style="color: '.$row['TextColor'].';">'.$hesklang[$row['ShortNameContentKey']].'</span></label></td>';
$rowCounter++;
}
?>
</tr>
</table>

@ -289,8 +289,8 @@ if ($total > 0)
$tagged = '<i class="fa fa-tag"></i> ';
}
$status = hesk_dbFetchAssoc(hesk_dbQuery("SELECT `ShortNameContentKey`, `TextColor` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE ID = ".$ticket['status']));
$ticket['status']='<span style="color: '.$status['TextColor'].'">'.$hesklang[$status['ShortNameContentKey']].'</span>';
$statusName = hesk_dbFetchAssoc(hesk_dbQuery("SELECT `ShortNameContentKey`, `TextColor` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE ID = ".$ticket['status']));
$ticket['status']='<span style="color: '.$statusName['TextColor'].'">'.$hesklang[$statusName['ShortNameContentKey']].'</span>';
switch ($ticket['priority'])
{

Loading…
Cancel
Save