From 52f90e92619826d79877003ee6e5fee3831a6b61 Mon Sep 17 00:00:00 2001 From: Quitta Date: Tue, 27 Aug 2013 22:54:45 +0200 Subject: [PATCH] ticket_info class done, however I think I better add a field to the Ticket DB, instead the way I do it now.. --- .../ryzom_ams/ams_lib/autoload/ticket.php | 6 ++-- .../ams_lib/autoload/ticket_info.php | 34 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php index 8ecd00b15..386ec5ddf 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php @@ -85,12 +85,14 @@ class Ticket{ */ public static function create_Ticket( $title, $content, $category, $author, $real_author, $for_support_group = 0) { + //create the new ticket! $ticket = new Ticket(); $values = array("Title" => $title, "Status"=> 1, "Queue"=> 0, "Ticket_Category" => $category, "Author" => $author, "Priority" => 0); $ticket->set($values); $ticket->create(); $ticket_id = $ticket->getTId(); + //write a log entry if ( $author == $real_author){ Ticket_Log::createLogEntry( $ticket_id, $author, 1); }else{ @@ -98,11 +100,11 @@ class Ticket{ } Ticket_Reply::createReply($content, $author, $ticket_id, 0, $author); - //send email that new ticket has been created + //forwards the ticket directly after creation to the supposed support group if($for_support_group){ Ticket::forwardTicket(0, $ticket_id, $for_support_group); } - + //send email that new ticket has been created Mail_Handler::send_ticketing_mail($ticket->getAuthor(), $ticket, $content, "NEW", $ticket->getForwardedGroupId()); return $ticket_id; diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php index b0be3e5ca..25f07440e 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php @@ -27,19 +27,10 @@ class Ticket_Log{ //Creates a log entry - public static function createTicketInfo($info_array) { - $dbl = new DBLayer("lib"); - $query = "INSERT INTO ticket_log (Timestamp, Query, Ticket, Author) VALUES (now(), :query, :ticket, :author )"; - $values = Array('ticket' => $ticket_id, 'author' => $author_id, 'query' => json_encode(array($action,$arg))); - $dbl->execute($query, $values); - } - - - //return constructed element based on TLogId - public static function constr_TInfoId( $id) { - $instance = new self(); - $instance->setTInfoId($id); - return $instance; + public static function create_Ticket_Info($info_array) { + $ticket_info = new self(); + $ticket_info->set($info_array); + $ticket_info->create(); } @@ -54,14 +45,12 @@ class Ticket_Log{ $this->setTicket($values['Ticket']); $this->setShardId($values['ShardId']); $this->setUser_Position($values['UserPosition']); - $this->setView_Position($values['ViewPosition']); - + $this->setView_Position($values['ViewPosition']); $this->setClient_Version($values['ClientVersion']); $this->setPatch_Version($values['PatchVersion']); $this->setServer_Tick($values['ServerTick']); $this->setConnect_State($values['ConnectState']); - $this->setLocal_Address($values['LocalAddress']); - + $this->setLocal_Address($values['LocalAddress']); $this->setMemory($values['Memory']); $this->setOS($values['OS']); $this->setProcessor($values['Processor']); @@ -80,13 +69,22 @@ class Ticket_Log{ } //Load with ticket Id - public function load_With_TId( $id) { + public function load_With_Ticket( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_info WHERE Ticket=:id", array('id' => $id)); $row = $statement->fetch(); $this->set($row); } + //create ticket info + public function create() { + $query = "INSERT INTO ticket_Info (TInfoId, Ticket, ShardId, UserPosition,ViewPosition, ClientVersion, PatchVersion,ServerTick, ConnectState, LocalAddress, Memory, OS, +Processor, CPUID, CpuMask, HT, NeL3D) VALUES (:id, :ticket, :shardid, :userposition, :viewposition, :clientversion, :patchversion, :servertick, :connectstate, :localaddress, :memory, :os, :processor, :cpuid, :cpu_mask, :ht, :nel3d )"; + $values = Array('id' => $this->getTInfoId(), 'ticket' => $this->getTicket(), 'shardid' => $this->getShardId, 'userposition' => $this->getUser_Position(), 'viewposition' => $this->getView_Position(), 'clientversion' => $this->getClient_Version(), +'patchversion' => $this->getPatch_Version(), 'servertick' => $this->getServer_Tick(), 'connectstate' => $this->getConnect_State(), 'localaddress' => $this->getLocal_Address(), 'memory' => $this->getMemory(), 'os'=> $this->getOS(), 'processor' => $this->getProcessor(), 'cpuid' => $this->getCPUId(), +'cpu_mask' => $this->getCpu_Mask(), 'ht' => $this->getHT(), 'nel3d' => $this->getNel3D()); + $dbl->execute($query, $values); + } ////////////////////////////////////////////Getters////////////////////////////////////////////////////