added option for assigned and unassigned ie "both"

--HG--
branch : rc-botanic-webdev
This commit is contained in:
Botanic 2013-10-23 23:58:34 -07:00
parent d1913cbfc5
commit 81d1cf93fb
2 changed files with 32 additions and 16 deletions

View file

@ -84,14 +84,18 @@ class Ticket_Queue{
if($who == "user"){ if($who == "user"){
$selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User"; $selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User";
if ($how == "assigned"){ if ($how == "both"){
$assign = "";
}else if ($how == "assigned"){
$assign = "tu.TUserId = :id" ; $assign = "tu.TUserId = :id" ;
}else if ($how == "not_assigned"){ }else if ($how == "not_assigned"){
$assign = "(tu.TUserId != :id OR a.Ticket IS NULL)"; $assign = "(tu.TUserId != :id OR a.Ticket IS NULL)";
} }
}else if ($who == "support_group"){ }else if ($who == "support_group"){
$selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User LEFT JOIN `forwarded` f ON t.TId = f.Ticket"; $selectfrom = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User LEFT JOIN `forwarded` f ON t.TId = f.Ticket";
if ($how == "assigned"){ if ($how == "both"){
$assign = "";
}else if ($how == "assigned"){
$assign = "f.Group = :id"; $assign = "f.Group = :id";
}else if ($how == "not_assigned"){ }else if ($how == "not_assigned"){
$assign = "(f.Group != :id OR f.Ticket IS NULL)" ; $assign = "(f.Group != :id OR f.Ticket IS NULL)" ;
@ -101,23 +105,34 @@ class Ticket_Queue{
if ($what == "waiting_for_support"){ if ($what == "waiting_for_support"){
$status = "t.Status = 1"; $status = "t.Status = 1";
}else if ($what == "waiting_for_user"){ }else if ($what == "waiting_for_users"){
$status = "t.Status = 0"; $status = "t.Status = 0";
}else if ($what == "closed"){ }else if ($what == "closed"){
$status = "t.Status = 3"; $status = "t.Status = 3";
} }
$query = $selectfrom ." WHERE " . $assign; if ($assign == "") {
if(isset($status)){ $query = $selectfrom;
$query = $query . " AND " . $status; if(isset($status)){
$query = $query . " WHERE " . $status;
}
} else {
$query = $selectfrom ." WHERE " . $assign;
if(isset($status)){
$query = $query . " AND " . $status;
}
} }
if($who == "user"){ if($who == "user"){
$params = array('id' => $userid); $params = array('id' => $userid);
}else if ($who == "support_group"){ }else if ($who == "support_group"){
$params = array('id' => $groupid); $params = array('id' => $groupid);
} }
$this->query = $query; $this->query = $query;
$this->params = $params; $this->params = $params;
//print_r($this);
} }

View file

@ -16,29 +16,30 @@
<form id="create_queue" class="form-vertical" method="post" action="index.php?page=show_queue&get=create" style="margin:0px 0px 0px;"> <form id="create_queue" class="form-vertical" method="post" action="index.php?page=show_queue&get=create" style="margin:0px 0px 0px;">
Show Show
<select style="width: 136px;" name="what"> <select style="width: 136px;" name="what">
<option value="all" {if isset($prev_created_what) eq "all"}selected="selected"{/if}>all</option> <option value="all" {if isset($prev_created_what) AND $prev_created_what eq "all"}selected="selected"{/if}>all</option>
<option value="waiting_for_support" {if isset($prev_created_what) eq "waiting_for_support"}selected="selected"{/if}>waiting for support</option> <option value="waiting_for_support" {if isset($prev_created_what) AND $prev_created_what eq "waiting_for_support"}selected="selected"{/if}>waiting for support</option>
<option value="waiting_for_users" {if isset($prev_created_what) eq "waiting_for_users"}selected="selected"{/if}>waiting for user</option> <option value="waiting_for_users" {if isset($prev_created_what) AND $prev_created_what eq "waiting_for_users"}selected="selected"{/if}>waiting for user</option>
<option value="closed" {if isset($prev_created_what) eq "closed"}selected="selected"{/if}>closed</option> <option value="closed" {if isset($prev_created_what) AND $prev_created_what eq "closed"}selected="selected"{/if}>closed</option>
</select> </select>
tickets tickets
<select style="width: 110px;" name="how"> <select style="width: 110px;" name="how">
<option value="assigned" {if isset($prev_created_how) eq "assigned"}selected="selected"{/if}>assigned</option> <option value="assigned" {if isset($prev_created_how) AND $prev_created_how eq "assigned"}selected="selected"{/if}>assigned</option>
<option value="not_assigned" {if isset($prev_created_how) eq "not_assigned"}selected="selected"{/if}>not assigned</option> <option value="not_assigned" {if isset($prev_created_how) AND $prev_created_how eq "not_assigned"}selected="selected"{/if}>not assigned</option>
<option value="both" {if isset($prev_created_how) AND $prev_created_how eq "both"}selected="selected"{/if}>both</option>
</select> </select>
to to
<select style="width: 140px;" name="who" onchange="aimedforwhochanged(this.value);"> <select style="width: 140px;" name="who" onchange="aimedforwhochanged(this.value);">
<option value="user" {if isset($prev_created_who) eq "user"}selected="selected"{/if}>user</option> <option value="user" {if isset($prev_created_who) AND $prev_created_who eq "user"}selected="selected"{/if}>user</option>
<option value="support_group" {if isset($prev_created_who) eq "support_group"}selected="selected"{/if}>support group</option> <option value="support_group" {if isset($prev_created_who) AND $prev_created_who eq "support_group"}selected="selected"{/if}>support group</option>
</select> </select>
<span id="userList" {if isset($prev_created_who) eq "user"}style="display:inline;"{else if isset($prev_created_who) eq "support_group"}style="display:none;"{else}style="display:inline;"{/if}> <span id="userList" {if isset($prev_created_who) AND $prev_created_who eq "user"}style="display:inline;"{else if isset($prev_created_who) AND $prev_created_who eq "support_group"}style="display:none;"{else}style="display:inline;"{/if}>
<select style="width: 140px;" name="userid"> <select style="width: 140px;" name="userid">
{foreach from=$teamlist item=member} {foreach from=$teamlist item=member}
<option value="{$member.tUserId}" {if isset($prev_created_userid)} {if $prev_created_userid eq $member.tUserId}selected="selected"{/if}{else if $user_id eq $member.tUserId}selected="selected"{/if}>{$member.name}</option> <option value="{$member.tUserId}" {if isset($prev_created_userid)} {if $prev_created_userid eq $member.tUserId}selected="selected"{/if}{else if $user_id eq $member.tUserId}selected="selected"{/if}>{$member.name}</option>
{/foreach} {/foreach}
</select> </select>
</span> </span>
<span id="supportGroupList" {if isset($prev_created_who) eq "user"}style="display:none;"{else if isset($prev_created_who) eq "support_group"}style="display:inline;"{else}style="display:none;"{/if}> <span id="supportGroupList" {if isset($prev_created_who) AND $prev_created_who eq "user"}style="display:none;"{else if isset($prev_created_who) AND $prev_created_who eq "support_group"}style="display:inline;"{else}style="display:none;"{/if}>
<select style="width: 140px;" name="groupid"> <select style="width: 140px;" name="groupid">
{foreach from=$grouplist item=group} {foreach from=$grouplist item=group}
<option value="{$group.sGroupId}" {if $prev_created_groupid eq $group.sGroupId}selected="selected"{/if}>{$group.name}</option> <option value="{$group.sGroupId}" {if $prev_created_groupid eq $group.sGroupId}selected="selected"{/if}>{$group.name}</option>