本文整理汇总了PHP中Thelia\Model\OrderQuery::create方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderQuery::create方法的具体用法?PHP OrderQuery::create怎么用?PHP OrderQuery::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thelia\Model\OrderQuery
的用法示例。
在下文中一共展示了OrderQuery::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseResults
public function parseResults(LoopResult $loopResult)
{
$this->container->get('thelia.condition.factory');
if (null !== ($order = OrderQuery::create()->findPk($this->getOrder()))) {
$oneDayInSeconds = 86400;
/** @var \Thelia\Model\OrderCoupon $orderCoupon */
foreach ($loopResult->getResultDataCollection() as $orderCoupon) {
$loopResultRow = new LoopResultRow($orderCoupon);
$now = time();
$datediff = $orderCoupon->getExpirationDate()->getTimestamp() - $now;
$daysLeftBeforeExpiration = floor($datediff / $oneDayInSeconds);
$freeShippingForCountriesIds = [];
/** @var OrderCouponCountry $couponCountry */
foreach ($orderCoupon->getFreeShippingForCountries() as $couponCountry) {
$freeShippingForCountriesIds[] = $couponCountry->getCountryId();
}
$freeShippingForModulesIds = [];
/** @var OrderCouponModule $couponModule */
foreach ($orderCoupon->getFreeShippingForModules() as $couponModule) {
$freeShippingForModulesIds[] = $couponModule->getModuleId();
}
$loopResultRow->set("ID", $orderCoupon->getId())->set("CODE", $orderCoupon->getCode())->set("DISCOUNT_AMOUNT", $orderCoupon->getAmount())->set("TITLE", $orderCoupon->getTitle())->set("SHORT_DESCRIPTION", $orderCoupon->getShortDescription())->set("DESCRIPTION", $orderCoupon->getDescription())->set("EXPIRATION_DATE", $orderCoupon->getExpirationDate($order->getLangId()))->set("IS_CUMULATIVE", $orderCoupon->getIsCumulative())->set("IS_REMOVING_POSTAGE", $orderCoupon->getIsRemovingPostage())->set("IS_AVAILABLE_ON_SPECIAL_OFFERS", $orderCoupon->getIsAvailableOnSpecialOffers())->set("DAY_LEFT_BEFORE_EXPIRATION", $daysLeftBeforeExpiration)->set("FREE_SHIPPING_FOR_COUNTRIES_LIST", implode(',', $freeShippingForCountriesIds))->set("FREE_SHIPPING_FOR_MODULES_LIST", implode(',', $freeShippingForModulesIds))->set("PER_CUSTOMER_USAGE_COUNT", $orderCoupon->getPerCustomerUsageCount())->set("IS_USAGE_CANCELED", $orderCoupon->getUsageCanceled());
$this->addOutputFields($loopResultRow, $orderCoupon);
$loopResult->addRow($loopResultRow);
}
}
return $loopResult;
}
示例2: current
public function current()
{
do {
$order = parent::current();
$getNext = false;
if ($this->rangeDate !== null && ($order[OrderTableMap::CREATED_AT] < $this->rangeDate['start'] || $order[OrderTableMap::CREATED_AT] > $this->rangeDate['end'])) {
$this->next();
$getNext = true;
}
} while ($getNext && $this->valid());
$locale = $this->language->getLocale();
$query = OrderQuery::create()->useCurrencyQuery()->addAsColumn('currency_CODE', CurrencyTableMap::CODE)->endUse()->useCustomerQuery()->addAsColumn('customer_REF', CustomerTableMap::REF)->endUse()->useOrderProductQuery()->useOrderProductTaxQuery(null, Criteria::LEFT_JOIN)->addAsColumn('product_TAX', 'IF(' . OrderProductTableMap::WAS_IN_PROMO . ',' . 'SUM(' . OrderProductTaxTableMap::PROMO_AMOUNT . '),' . 'SUM(' . OrderProductTaxTableMap::AMOUNT . ')' . ')')->addAsColumn('tax_TITLE', OrderProductTableMap::TAX_RULE_TITLE)->endUse()->addAsColumn('product_TITLE', OrderProductTableMap::TITLE)->addAsColumn('product_PRICE', 'IF(' . OrderProductTableMap::WAS_IN_PROMO . ',' . OrderProductTableMap::PROMO_PRICE . ',' . OrderProductTableMap::PRICE . ')')->addAsColumn('product_QUANTITY', OrderProductTableMap::QUANTITY)->addAsColumn('product_WAS_IN_PROMO', OrderProductTableMap::WAS_IN_PROMO)->groupById()->endUse()->orderById()->groupById()->useOrderCouponQuery(null, Criteria::LEFT_JOIN)->addAsColumn('coupon_COUPONS', 'GROUP_CONCAT(' . OrderCouponTableMap::TITLE . ')')->groupBy(OrderCouponTableMap::ORDER_ID)->endUse()->useModuleRelatedByPaymentModuleIdQuery('payment_module')->addAsColumn('payment_module_TITLE', '`payment_module`.CODE')->endUse()->useModuleRelatedByDeliveryModuleIdQuery('delivery_module')->addAsColumn('delivery_module_TITLE', '`delivery_module`.CODE')->endUse()->useOrderAddressRelatedByDeliveryOrderAddressIdQuery('delivery_address_join')->useCustomerTitleQuery('delivery_address_customer_title_join')->useCustomerTitleI18nQuery('delivery_address_customer_title_i18n_join')->addAsColumn('delivery_address_TITLE', '`delivery_address_customer_title_i18n_join`.SHORT')->endUse()->endUse()->useCountryQuery('delivery_address_country_join')->useCountryI18nQuery('delivery_address_country_i18n_join')->addAsColumn('delivery_address_country_TITLE', '`delivery_address_country_i18n_join`.TITLE')->endUse()->addAsColumn('delivery_address_COMPANY', '`delivery_address_join`.COMPANY')->addAsColumn('delivery_address_FIRSTNAME', '`delivery_address_join`.FIRSTNAME')->addAsColumn('delivery_address_LASTNAME', '`delivery_address_join`.LASTNAME')->addAsColumn('delivery_address_ADDRESS1', '`delivery_address_join`.ADDRESS1')->addAsColumn('delivery_address_ADDRESS2', '`delivery_address_join`.ADDRESS2')->addAsColumn('delivery_address_ADDRESS3', '`delivery_address_join`.ADDRESS3')->addAsColumn('delivery_address_ZIPCODE', '`delivery_address_join`.ZIPCODE')->addAsColumn('delivery_address_CITY', '`delivery_address_join`.CITY')->addAsColumn('delivery_address_PHONE', '`delivery_address_join`.PHONE')->endUse()->endUse()->useOrderAddressRelatedByInvoiceOrderAddressIdQuery('invoice_address_join')->useCustomerTitleQuery('invoice_address_customer_title_join')->useCustomerTitleI18nQuery('invoice_address_customer_title_i18n_join')->addAsColumn('invoice_address_TITLE', '`invoice_address_customer_title_i18n_join`.SHORT')->endUse()->endUse()->useCountryQuery('invoice_address_country_join')->useCountryI18nQuery('invoice_address_country_i18n_join')->addAsColumn('invoice_address_country_TITLE', '`invoice_address_country_i18n_join`.TITLE')->endUse()->endUse()->addAsColumn('invoice_address_COMPANY', '`invoice_address_join`.COMPANY')->addAsColumn('invoice_address_FIRSTNAME', '`invoice_address_join`.FIRSTNAME')->addAsColumn('invoice_address_LASTNAME', '`invoice_address_join`.LASTNAME')->addAsColumn('invoice_address_ADDRESS1', '`invoice_address_join`.ADDRESS1')->addAsColumn('invoice_address_ADDRESS2', '`invoice_address_join`.ADDRESS2')->addAsColumn('invoice_address_ADDRESS3', '`invoice_address_join`.ADDRESS3')->addAsColumn('invoice_address_ZIPCODE', '`invoice_address_join`.ZIPCODE')->addAsColumn('invoice_address_CITY', '`invoice_address_join`.CITY')->addAsColumn('invoice_address_PHONE', '`invoice_address_join`.PHONE')->endUse()->useOrderStatusQuery()->useOrderStatusI18nQuery()->addAsColumn('order_status_TITLE', OrderStatusI18nTableMap::TITLE)->endUse()->endUse()->select([OrderTableMap::REF, 'customer_REF', 'product_TITLE', 'product_PRICE', 'product_TAX', 'tax_TITLE', 'product_QUANTITY', 'product_WAS_IN_PROMO', OrderTableMap::DISCOUNT, 'coupon_COUPONS', OrderTableMap::POSTAGE, 'payment_module_TITLE', OrderTableMap::INVOICE_REF, OrderTableMap::DELIVERY_REF, 'delivery_module_TITLE', 'delivery_address_TITLE', 'delivery_address_COMPANY', 'delivery_address_FIRSTNAME', 'delivery_address_LASTNAME', 'delivery_address_ADDRESS1', 'delivery_address_ADDRESS2', 'delivery_address_ADDRESS3', 'delivery_address_ZIPCODE', 'delivery_address_CITY', 'delivery_address_country_TITLE', 'delivery_address_PHONE', 'invoice_address_TITLE', 'invoice_address_COMPANY', 'invoice_address_FIRSTNAME', 'invoice_address_LASTNAME', 'invoice_address_ADDRESS1', 'invoice_address_ADDRESS2', 'invoice_address_ADDRESS3', 'invoice_address_ZIPCODE', 'invoice_address_CITY', 'invoice_address_country_TITLE', 'invoice_address_PHONE', 'order_status_TITLE', 'currency_CODE', OrderTableMap::CREATED_AT])->orderByCreatedAt(Criteria::DESC);
I18n::addI18nCondition($query, CustomerTitleI18nTableMap::TABLE_NAME, '`delivery_address_customer_title_join`.ID', CustomerTitleI18nTableMap::ID, '`delivery_address_customer_title_i18n_join`.LOCALE', $locale);
I18n::addI18nCondition($query, CustomerTitleI18nTableMap::TABLE_NAME, '`invoice_address_customer_title_join`.ID', CustomerTitleI18nTableMap::ID, '`invoice_address_customer_title_i18n_join`.LOCALE', $locale);
I18n::addI18nCondition($query, CountryI18nTableMap::TABLE_NAME, '`delivery_address_country_join`.ID', CountryI18nTableMap::ID, '`delivery_address_country_i18n_join`.LOCALE', $locale);
I18n::addI18nCondition($query, CountryI18nTableMap::TABLE_NAME, '`invoice_address_country_join`.ID', CountryI18nTableMap::ID, '`invoice_address_country_i18n_join`.LOCALE', $locale);
I18n::addI18nCondition($query, OrderStatusI18nTableMap::TABLE_NAME, OrderStatusI18nTableMap::ID, OrderStatusTableMap::ID, OrderStatusI18nTableMap::LOCALE, $locale);
$data = $query->filterById($order[OrderTableMap::ID])->findOne();
$order = (new Order())->setId($order[OrderTableMap::ID]);
$order->setNew(false);
$tax = 0;
$data['order_TOTAL_TTC'] = $order->getTotalAmount($tax, false, false);
$data['order_TOTAL_WITH_DISCOUNT'] = $order->getTotalAmount($tax, false, true);
$data['order_TOTAL_WITH_DISCOUNT_AND_POSTAGE'] = $order->getTotalAmount($tax, true, true);
return $data;
}
示例3: buildArray
public function buildArray()
{
$order = OrderQuery::create()->findOneByRef($this->getRef());
if (null !== $order && $order->getDeliveryModuleId() === DpdClassic::getModuleId()) {
return [$order->getRef() => $order->getDeliveryRef()];
}
return [];
}
示例4: buildForm
protected function buildForm()
{
$entries = OrderQuery::create()->filterByDeliveryModuleId(DpdClassic::getModuleId())->find();
$this->formBuilder->add('new_status_id', 'choice', array('label' => Translator::getInstance()->trans('Change order status to', [], DpdClassic::DOMAIN_NAME), 'choices' => array("nochange" => Translator::getInstance()->trans("Do not change", [], DpdClassic::DOMAIN_NAME), "processing" => Translator::getInstance()->trans("Set orders status as processing", [], DpdClassic::DOMAIN_NAME), "sent" => Translator::getInstance()->trans("Set orders status as sent", [], DpdClassic::DOMAIN_NAME)), 'required' => true, 'expanded' => true, 'multiple' => false, 'data' => 'nochange'));
foreach ($entries as $order) {
$orderRef = str_replace(".", "-", $order->getRef());
$this->formBuilder->add($orderRef, 'checkbox', array('label' => $orderRef, 'label_attr' => array('for' => $orderRef)))->add($orderRef . "-assur", 'checkbox')->add($orderRef . "-pkgNumber", 'number')->add($orderRef . "-pkgWeight", 'number');
}
}
示例5: buildForm
protected function buildForm()
{
$status = OrderStatusQuery::create()->filterByCode(array(OrderStatus::CODE_PAID, OrderStatus::CODE_PROCESSING, OrderStatus::CODE_SENT), Criteria::IN)->find()->toArray("code");
$query = OrderQuery::create()->filterByDeliveryModuleId(FreeShipping::getModuleId())->filterByStatusId(array($status['paid']['Id'], $status['processing']['Id']), Criteria::IN)->find();
$this->formBuilder->add('new_status_id', 'choice', array('label' => Translator::getInstance()->trans('server'), 'choices' => array("nochange" => Translator::getInstance()->trans("Do not change"), "processing" => Translator::getInstance()->trans("Set orders status as processing"), "sent" => Translator::getInstance()->trans("Set orders status as sent")), 'required' => 'true', 'expanded' => true, 'multiple' => false, 'data' => 'nochange'));
/** @var \Thelia\Model\Order $order */
foreach ($query as $order) {
$this->formBuilder->add("order_" . $order->getId(), "checkbox", array('label' => $order->getRef(), 'label_attr' => array('for' => 'export_' . $order->getId())));
}
}
示例6: buildArray
public function buildArray()
{
$path = ExportExaprint::getJSONpath();
if (is_readable($path) && ($order = OrderQuery::create()->findOneByRef($this->getRef())) !== null && $order->getDeliveryModuleId() === DpdPickup::getModuleId()) {
$json = json_decode(file_get_contents($path), true);
return array($this->getRef() => $json['expcode']);
} else {
return array();
}
}
示例7: preImport
public function preImport()
{
// Delete table before proceeding
OrderQuery::create()->deleteAll();
// Delete custom order status
OrderStatusQuery::create()->filterById(5, Criteria::GREATER_THAN)->delete();
// Create T1 <-> T2 IDs correspondance tables
$this->order_corresp->reset();
$this->importCustomOrderStatus();
}
示例8: receiveResponse
/**
* @throws \Exception
*/
public function receiveResponse()
{
$request = $this->getRequest();
$order_id = $request->get('reference');
if (is_numeric($order_id)) {
$order_id = (int) $order_id;
}
/*
* Configure log output
*/
$log = Tlog::getInstance();
$log->setDestinations("\\Thelia\\Log\\Destination\\TlogDestinationFile");
$log->setConfig("\\Thelia\\Log\\Destination\\TlogDestinationFile", 0, THELIA_ROOT . "log" . DS . "log-cmcic.txt");
$log->info("accessed");
$order = OrderQuery::create()->findPk($order_id);
/*
* Retrieve HMac for CGI2
*/
$config = Config::read(CmCIC::JSON_CONFIG_PATH);
$hashable = sprintf(CmCIC::CMCIC_CGI2_FIELDS, $config['CMCIC_TPE'], $request->get('date'), $request->get('montant'), $request->get('reference'), $request->get('texte-libre'), $config['CMCIC_VERSION'], $request->get('code-retour'), $request->get('cvx'), $request->get('vld'), $request->get('brand'), $request->get('status3ds'), $request->get('numauto'), $request->get('motifrefus'), $request->get('originecb'), $request->get('bincb'), $request->get('hpancb'), $request->get('ipclient'), $request->get('originetr'), $request->get('veres'), $request->get('pares'));
$mac = CmCIC::computeHmac($hashable, CmCIC::getUsableKey($config["CMCIC_KEY"]));
$response = CmCIC::CMCIC_CGI2_MACNOTOK . $hashable;
if ($mac === strtolower($request->get('MAC'))) {
$code = $request->get("code-retour");
$msg = null;
$status = OrderStatusQuery::create()->findOneByCode(OrderStatus::CODE_PAID);
$event = new OrderEvent($order);
$event->setStatus($status->getId());
switch ($code) {
case "payetest":
$msg = "The test payment of the order " . $order->getRef() . " has been successfully released. ";
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
break;
case "paiement":
$msg = "The payment of the order " . $order->getRef() . " has been successfully released. ";
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
break;
case "Annulation":
$msg = "Error during the paiement: " . $this->getRequest()->get("motifrefus");
break;
default:
$log->error("Error while receiving response from CMCIC: code-retour not valid");
throw new \Exception(Translator::getInstance()->trans("An error occured, no valid code-retour"));
}
if (!empty($msg)) {
$log->info($msg);
}
$response = CmCIC::CMCIC_CGI2_MACOK;
}
/*
* Get log back to previous state
*/
$log->setDestinations("\\Thelia\\Log\\Destination\\TlogDestinationRotatingFile");
return Response::create(sprintf(CmCIC::CMCIC_CGI2_RECEIPT, $response), 200, array("Content-type" => "text/plain", "Pragma" => "nocache"));
}
示例9: onInvoiceAfterDeliveryModule
public function onInvoiceAfterDeliveryModule(HookRenderEvent $event)
{
// No So Colissimo information if the delivery module is not SoColissimo
if (SoColissimo::getModuleId() == $event->getArgument('module_id')) {
return;
}
$order = OrderQuery::create()->findOneById($event->getArgument('order'));
if (!is_null($order)) {
$event->add($this->render('delivery_mode_infos.html', ['delivery_address_id' => $order->getDeliveryOrderAddressId()]));
}
}
示例10: preImport
public function preImport()
{
// Empty address, customer and customer title table
OrderQuery::create()->deleteAll();
AddressQuery::create()->deleteAll();
OrderAddressQuery::create()->deleteAll();
CustomerQuery::create()->deleteAll();
// Also empty url rewriting table
$con = Propel::getConnection(RewritingUrlTableMap::DATABASE_NAME);
$con->exec('SET FOREIGN_KEY_CHECKS=0');
RewritingUrlQuery::create()->deleteAll();
$con->exec('SET FOREIGN_KEY_CHECKS=1');
$this->cust_corresp->reset();
if ($this->thelia_version > 150) {
$this->importCustomerTitle();
}
}
示例11: orderNumberPackage
public function orderNumberPackage($params, $template = null)
{
$numberOfPackage = 1;
$maxWeightPackage = TNTFrance::getConfigValue(TNTFranceConfigValue::MAX_WEIGHT_PACKAGE, 25);
if (null != ($orderId = $this->getParam($params, "order_id", null))) {
if (null != ($order = OrderQuery::create()->findPk($orderId))) {
$orderTotalWeight = 0;
foreach ($order->getOrderProducts() as $orderProduct) {
//Be sure that this orderProduct has no package already
if (null == ($tntResponse = TntOrderParcelResponseQuery::create()->findOneByOrderProductId($orderProduct->getId()))) {
$orderTotalWeight += $orderProduct->getQuantity() * $orderProduct->getWeight();
}
}
$numberOfPackage = ceil($orderTotalWeight / $maxWeightPackage);
}
}
return $numberOfPackage;
}
示例12: importDeliveryRef
/**
* Update order's delivery ref
*
* @param string $deliveryRef
* @param string $orderRef
* @param int $i
*/
public function importDeliveryRef($deliveryRef, $orderRef, &$i)
{
// Check if the order exists
if (null !== ($order = OrderQuery::create()->findOneByRef($orderRef))) {
$event = new OrderEvent($order);
// Check if delivery refs are different
if ($order->getDeliveryRef() != $deliveryRef) {
$event->setDeliveryRef($deliveryRef);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_DELIVERY_REF, $event);
$sentStatusId = OrderStatusQuery::create()->filterByCode('sent')->select('ID')->findOne();
// Set 'sent' order status if not already sent
if ($sentStatusId != null && $order->getStatusId() != $sentStatusId) {
$event->setStatus($sentStatusId);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
}
$i++;
}
}
}
示例13: importDeliveryRef
/**
* Update order's delivery ref
*
* @param string $deliveryRef
* @param string $orderRef
* @param int $i
*/
public function importDeliveryRef($deliveryRef, $orderRef, &$i)
{
// Get order
$order = OrderQuery::create()->findOneByRef($orderRef);
// Check if the order exists
if ($order !== null) {
$event = new OrderEvent($order);
// Check if delivery refs are different
if ($order->getDeliveryRef() != $deliveryRef) {
$event->setDeliveryRef($deliveryRef);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_DELIVERY_REF, $event);
// Set 'sent' order status if not already sent
if ($order->getStatusId() != DpdPickup::STATUS_SENT) {
$event->setStatus(DpdPickup::STATUS_SENT);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
}
$i++;
}
}
}
示例14: processAtosRequest
public function processAtosRequest()
{
$this->getLog()->addInfo($this->getTranslator()->trans("Atos-SIPS platform request received.", [], Atos::MODULE_DOMAIN));
$binResponse = Atos::getBinDirectory() . 'response';
if (!empty($_POST['DATA'])) {
$data = escapeshellcmd($_POST['DATA']);
$pathfile = Atos::getPathfilePath();
$resultRaw = exec(sprintf("%s message=%s pathfile=%s", $binResponse, $data, $pathfile));
if (!empty($resultRaw)) {
$result = explode('!', $resultRaw);
$result = $this->parseResult($result);
$this->getLog()->addInfo($this->getTranslator()->trans('Response parameters : %resp', ['%resp' => print_r($result, true)], Atos::MODULE_DOMAIN));
if ($result['code'] == '' && $result['error'] == '') {
$this->getLog()->addError($this->getTranslator()->trans('Response request not found in %response', ['%response' => $binResponse], Atos::MODULE_DOMAIN));
} elseif (intval($result['code']) != 0) {
$this->getLog()->addError($this->getTranslator()->trans('Error %code while processing response, with message %message', ['%code' => intval($result['code']), '%message' => $result['error']], Atos::MODULE_DOMAIN));
} elseif ($result['response_code'] == '00') {
$atos = new Atos();
$order = OrderQuery::create()->filterByTransactionRef($result['transaction_id'])->filterByPaymentModuleId($atos->getModuleModel()->getId())->findOne();
if ($order) {
$this->confirmPayment($order->getId());
$this->getLog()->addInfo($this->getTranslator()->trans("Order ID %id is confirmed.", ['%id' => $order->getId()], Atos::MODULE_DOMAIN));
} else {
$this->getLog()->addError($this->getTranslator()->trans('Cannot find an order for transaction ID "%trans"', ['%trans' => $result['transaction_id']], Atos::MODULE_DOMAIN));
}
} else {
$this->getLog()->addError($this->getTranslator()->trans('Cannot validate order. Response code is %resp', ['%resp' => $result['response_code']], Atos::MODULE_DOMAIN));
}
} else {
$this->getLog()->addError($this->getTranslator()->trans('Got empty response from executable %binary, check path and permissions', ['%binary' => $binResponse], Atos::MODULE_DOMAIN));
}
} else {
$this->getLog()->addError($this->getTranslator()->trans('Request does not contains any data', [], Atos::MODULE_DOMAIN));
}
$this->getLog()->info($this->getTranslator()->trans("Atos platform request processing terminated.", [], Atos::MODULE_DOMAIN));
return Response::create();
}
示例15: generateOrderPdf
/**
* @param int $order_id
* @param string $fileName
* @param bool $checkOrderStatus
* @param bool $checkAdminUser
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function generateOrderPdf($order_id, $fileName, $checkOrderStatus = true, $checkAdminUser = true, $browser = false)
{
$order = OrderQuery::create()->findPk($order_id);
// check if the order has the paid status
if ($checkAdminUser && !$this->getSecurityContext()->hasAdminUser()) {
if ($checkOrderStatus && !$order->isPaid(false)) {
throw new NotFoundHttpException();
}
}
$html = $this->renderRaw($fileName, array('order_id' => $order_id), $this->getTemplateHelper()->getActivePdfTemplate());
try {
$pdfEvent = new PdfEvent($html);
$this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent);
if ($pdfEvent->hasPdf()) {
return $this->pdfResponse($pdfEvent->getPdf(), $order->getRef(), 200, $browser);
}
} catch (\Exception $e) {
Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d with message "%s"', $order_id, $e->getMessage()));
}
throw new TheliaProcessException($this->getTranslator()->trans("We're sorry, this PDF invoice is not available at the moment."));
}