コード例 #1
0
 public function getInvoice()
 {
     $this->load->model('setting/setting');
     $this->load->model('module/invoice_map');
     $id = $this->request->get['id'];
     $hash = $this->request->get['h'];
     $ifi_invoice = $this->model_setting_setting->getSetting('ifi_invoice');
     $settings_hash = $ifi_invoice[ModelModuleInvoiceMap::API_HASH];
     if (!ApiManager::getInstance()->checkIfirmaHash($hash, $settings_hash)) {
         $this->redirect($this->url->link('sale/order', 'token=' . $this->session->data['token'], 'SSL'));
     }
     $invoice = $this->model_module_invoice_map->get($id);
     header('Content-Type: application/pdf');
     header('Content-disposition: attachment; filename="' . ApiManager::getInstance()->getDocumentPdfName($invoice) . '"');
     echo ApiManager::getInstance()->getDocumentAsPdf($invoice);
 }