Example #1
0
 public function testAddValidEntry()
 {
     $delivery_address_id = $this->order->getDeliveryOrderAddressId();
     $delivery_address = OrderAddressQuery::create()->findPk($delivery_address_id);
     $delivery_address->setCountryId(CountryQuery::create()->findOneByIsoalpha3("FRA")->getId());
     // France metropolitan
     $this->export->addEntry($this->instance);
 }
 public function singleExport($order_id)
 {
     if (null !== ($response = $this->checkAuth([AdminResources::MODULE, AdminResources::ORDER], ['Predict'], AccessManager::VIEW))) {
         return $response;
     }
     $export = new PredictExport();
     $export_data = "";
     $order = OrderQuery::create()->findPk($order_id);
     if ($order === null) {
         throw new \InvalidArgumentException("order_id " . $order_id . " doesn't exist");
     }
     try {
         $form = new SingleExportForm($this->getRequest());
         $vform = $this->validateForm($form, "post");
         $export->addEntry(new ExportEntry($order, $vform->get("guaranty")->getData()));
         $export_data = $export->doExport();
     } catch (\Exception $e) {
         $this->redirectToRoute('admin.order.update.view', array("errmes" => $e->getMessage()), array("_controller" => 'Thelia\\Controller\\Admin\\OrderController::viewAction', "order_id" => $order_id, "tab" => "modules"));
     }
     return $this->createResponse($export_data);
 }