/** * Logs System Exceptions to DataBase * * @param object $exception * @access public * @return void */ public static function logError($exception) { try { $connection = Netsuite_Db_Db::getInstance(); $sth = $connection->prepare(Netsuite_Db_Query::getQuery('LOG_ERROR')); if (!$sth) { throw new Exception(explode(',', $sth->errorInfo())); } $sth->execute(array(':message' => $exception->getMessage(), ':file' => $exception->getFile(), ':line' => $exception->getLine(), ':trace' => $exception->getTraceAsString())); } catch (Exception $e) { var_dump($e); } }
/** * 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'); } }