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); $tmp = count($status);
// Do we need to search by status? // Do we need to search by status?
@ -105,11 +105,16 @@ if ( $tmp < $totalStatuses )
if ($tmp == 0) if ($tmp == 0)
{ {
$status = $possible_status; $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 // Add to the SQL
$sql .= " AND `status` IN ('" . implode("','", array_keys($status) ) . "') "; $sql .= " AND `status` IN ('" . implode("','", array_keys($status) ) . "') ";
} }
// --> TICKET PRIORITY // --> TICKET PRIORITY

@ -33,18 +33,16 @@
*******************************************************************************/ *******************************************************************************/
/* Check if this is a valid include */ /* Check if this is a valid include */
if (!defined('IN_SCRIPT')) {die('Invalid attempt');} if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
if ( ! isset($status) ) if ( ! isset($status) )
{ {
$status = array( $status = array();
0 => 'NEW', //-- We don't want to check statuses that are considered "closed"
1 => 'WAITING REPLY', $statusRS = hesk_dbQuery('SELECT `ID`, `ShortNameContentKey` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses` WHERE `IsClosed` = 0');
2 => 'REPLIED', while ($row = $statusRS->fetch_assoc())
#3 => 'RESOLVED (CLOSED)', {
4 => 'IN PROGRESS', $status[$row['ID']] = $row['ShortNameContentKey'];
5 => 'ON HOLD', }
);
} }
if ( ! isset($priority) ) if ( ! isset($priority) )
@ -114,14 +112,31 @@ $more2 = empty($_GET['more2']) ? 0 : 1;
<table border="0" cellpadding="0" cellspacing="0" width="100%"> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr> <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> <?php
<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> $rowCounter = 1;
<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> $statusRS = hesk_dbQuery('SELECT `ID`, `ShortNameContentKey`, `TextColor` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
</tr> while ($row = $statusRS->fetch_assoc())
<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> if ($rowCounter > 3)
<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> 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> </tr>
</table> </table>

@ -289,8 +289,8 @@ if ($total > 0)
$tagged = '<i class="fa fa-tag"></i> '; $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'])); $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: '.$status['TextColor'].'">'.$hesklang[$status['ShortNameContentKey']].'</span>'; $ticket['status']='<span style="color: '.$statusName['TextColor'].'">'.$hesklang[$statusName['ShortNameContentKey']].'</span>';
switch ($ticket['priority']) switch ($ticket['priority'])
{ {

Loading…
Cancel
Save