labtech
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_TicketSimpleSearch
Parameters
Name
Type
Mode
search
varchar(75)
IN
page
int
IN
pagesize
int
IN
userid
int
IN
Definition
BEGIN PREPARE STMT FROM "Select a.TicketID, ifnull(b.Name, 'Unassigned') as ClientName, c.TicketStatus, a.Subject, Ifnull(d.Name, 'Unassigned') as UserName, a.RequestorEmail, a.ClientID, a.Level from tickets a left join clients b on a.ClientID = b.ClientID Join ticketstatus c on a.Status = c.TicketStatusID left join users d on d.userid = a.userid Where ( a.TicketID like CONCAT('%', ?, '%') or c.TicketStatus like CONCAT('%', ?, '%') or a.Subject like CONCAT('%', ?, '%') or d.Name like CONCAT('%', ?, '%') or a.RequestorEmail like CONCAT('%', ?, '%') ) and (a.clientid=0 or a.clientid in (Select clientid From UserSec Where UserID=?)) order by a.Status ASC LIMIT ?,?;"; SET @LIMIT = (page * pagesize) - pagesize; SET @size = pagesize; SET @s = search; SET @U = userid; EXECUTE STMT USING @s,@s,@s,@s,@s,@U,@LIMIT,@size; END