Skip to content
Snippets Groups Projects
Commit 7573112f authored by Peter Rotich's avatar Peter Rotich
Browse files

Support ticket lookup using ticket # AND optional email

parent b27f3056
Branches
Tags
No related merge requests found
...@@ -1766,8 +1766,17 @@ class Ticket { ...@@ -1766,8 +1766,17 @@ class Ticket {
/*============== Static functions. Use Ticket::function(params); ==================*/ /*============== Static functions. Use Ticket::function(params); ==================*/
function getIdByExtId($extid) { function getIdByExtId($extId, $email=null) {
$sql ='SELECT ticket_id FROM '.TICKET_TABLE.' ticket WHERE ticketID='.db_input($extid);
if(!$extId || !is_numeric($extId))
return 0;
$sql ='SELECT ticket_id FROM '.TICKET_TABLE.' ticket '
.' WHERE ticketID='.db_input($extId);
if($email)
$sql.=' AND email='.db_input($email);
if(($res=db_query($sql)) && db_num_rows($res)) if(($res=db_query($sql)) && db_num_rows($res))
list($id)=db_fetch_row($res); list($id)=db_fetch_row($res);
...@@ -1780,8 +1789,8 @@ class Ticket { ...@@ -1780,8 +1789,8 @@ class Ticket {
return ($id && is_numeric($id) && ($ticket= new Ticket($id)) && $ticket->getId()==$id)?$ticket:null; return ($id && is_numeric($id) && ($ticket= new Ticket($id)) && $ticket->getId()==$id)?$ticket:null;
} }
function lookupByExtId($id) { function lookupByExtId($id, $email=null) {
return self::lookup(self:: getIdByExtId($id)); return self::lookup(self:: getIdByExtId($id, $email));
} }
function genExtRandID() { function genExtRandID() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment