<?php require_once "../../../Web/PHP/Models/General.php"; require "../Views/Admin.php"; require_once "../../../Web/PHP/Models/PDO.php"; require_once "../../../Web/PHP/Models/DB.php"; require_once "../Models/LB_DB.php"; require_once '../../../Web/PHP/Models/General.php'; $Inputs = filter_input_array(INPUT_GET); $Query = "UPDATE `lbxxdb50`.`mgmt__ticket` SET bIs_Accepted = 0 WHERE Id = " . $Inputs['Ticket__Id'] . ";"; $MySQL = ccPDO::___GET("lbxxdb50", false, $Inputs['DB_Host']); $bSuccess = ccDB::RUN__Query__INSERT(array($Query), $MySQL); if ($bSuccess === true) { $File__Names = ccLB_Proc::crGET___Ticket__Pictures($Inputs); if ($Inputs['DB_Host'] === "localhost") { $bSuccess = ccLB_Proc__Ticket::MOVE__Files($File__Names, "WIP", "Deleted"); } else { $bSuccess = ccLB_Proc__Ticket::MOVE__Files__FTP($File__Names, "WIP", "Deleted"); } } echo json_encode(array($bSuccess));
public static function CREATE_NEW__Ticket($Inputs) { $Queries = array(); $Queries['Ticket'] = ccTicket::GET__Query__Finalize($Inputs); if (array_key_exists('Ticket_Discount', $Inputs) === true) { $Queries['Ticket_Discount'] = ccLB_Proc::GET__Query__Finalize($Inputs, "Ticket_Discount"); } if (array_key_exists('Ticket_Loyalty', $Inputs) === true) { $Queries['Ticket_Loyalty'] = ccLB_Proc::GET__Query__Finalize($Inputs, "Ticket_Loyalty"); } $Queries['Ticket_Product'] = ccLB_Proc::GET__Query__Finalize($Inputs, "Ticket_Product"); if (array_key_exists('Ticket_Product_Discount', $Inputs) === true) { $Queries['Ticket_Product_Discount'] = ccLB_Proc::GET__Query__Finalize($Inputs, "Ticket_Product_Discount"); } $Queries['Ticket_Info'] = ccTicket_Info::GET__Query__Finalize($Inputs); global $PDO; $Query = null; try { $PDO->setAttribute(PDO::ATTR_AUTOCOMMIT, 0); $PDO->beginTransaction(); foreach ($Queries as $Query) { $PDO->exec($Query); } $File__Names = array($Inputs['Ticket_Info']['File_Pic']); // ccTicket_Info::MOVE__Ticket_Files($Inputs['Ticket_Info'][File_Name], "WIP", "Ready"); if ($Inputs['DB_Host'] === "localhost") { $bSuccess = ccLB_Proc__Ticket::MOVE__Files($File__Names, "WIP", "Ready"); } else { $bSuccess = ccLB_Proc__Ticket::MOVE__Files__FTP($File__Names, "WIP", "Ready"); } if ($bSuccess === false) { $PDO->rollBack(); throw new Exception(); } // $bSuccess = ccDB::RUN__Query__INSERT($Queries, $PDO); $PDO->commit(); } catch (Exception $e) { $PDO->rollBack(); echo "ERROR: An error occured while executing, please review.\r\n"; echo $Query . "\r\n"; ccGeneral::EXCEPTION___Process($e, debug_backtrace()); } return $bSuccess; }