コード例 #1
0
 public function run()
 {
     spl_autoload_register(function ($sClass) {
         $sClass = str_replace("_", "/", $sClass);
         include $sClass . '.php';
     });
     try {
         $this->worker->addData(array('queue_id' => $this->_queueId));
         switch (true) {
             case isset($this->_order['refund']):
                 $this->_createRefund();
                 break;
             default:
                 $customer = $this->_createCustomer();
                 if ($customer !== false) {
                     $this->_createSalesOrder($customer);
                 }
                 break;
         }
     } catch (Exception $e) {
         Netsuite_Db_Model::logError($e->getMessage());
         $results['system']['error'] = $e->getMessage();
         $this->worker->addData($results);
     }
     $this->_logResults();
 }
コード例 #2
0
function processOrders($bResetOrders = false)
{
    try {
        $processOrder = new Thread_Server();
        switch (true) {
            case $processOrder->hasOrders() === true:
                Netsuite_Db_Model::setPoolQueueLog(sizeof($processOrder->orders));
                $processOrder->poolOrders();
                processOrders(true);
                break;
            case $bResetOrders === true:
                //sleep(5);
                //Netsuite_Db_Model::resetStalledOrders();
                //processOrders( false );
                break;
        }
    } catch (Exception $e) {
        Netsuite_Db_Model::logError($e);
    }
}
コード例 #3
0
 /**
  * Set Current Batches Orders to a Status of Working
  *
  * @param array $aOrders - Array of Batched Orders
  * @access public
  * @return int|null $_dbResults
  * @throws Exception
  */
 public function setOrderWorking($aOrders)
 {
     try {
         $sth = $this->prepare(Netsuite_Db_Query::getQuery('SET_ACTIVA_ORDER_WORKING', null, count($aOrders)));
         if (!$sth) {
             throw new Exception(explode(',', $sth->errorInfo()));
         }
         $aBindArgs = array();
         array_walk($aOrders, function ($aOrder, $iKey) use(&$aBindArgs) {
             $aBindArgs[':arg' . $iKey] = (int) preg_replace("/[^0-9]/", "", $aOrder['order_activa_id']);
         });
         $sth->execute($aBindArgs);
         return true;
     } catch (Exception $e) {
         Netsuite_Db_Model::logError($e);
         throw new Exception('Could NOT Set Orders to Working Status in the Activa DB');
     }
 }
コード例 #4
0
 /**
  * Returns Orders From the Queue
  *
  *
  *
  */
 public function getProcessLogView()
 {
     try {
         $sth = $this->prepare(Panel_Query::getQuery('GET_PROCESS_LOG_VIEW'));
         $sth->bindValue(':limit', (int) PANEL_MAX_RESULTS, PDO::PARAM_INT);
         if (!$sth) {
             throw new Exception(explode(',', $sth->errorInfo()));
         }
         $sth->execute();
         $this->_dbResults = $sth->fetchAll(PDO::FETCH_ASSOC);
         return $this->_dbResults;
     } catch (Exception $e) {
         Netsuite_Db_Model::logError($e);
         throw new Exception('Could NOT Get Orders From the Queue DB for the Control Panel');
     }
 }