Ejemplo n.º 1
0
 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;
 }