2016-07-22 20:00:27 +00:00
|
|
|
<?php
|
|
|
|
|
2016-09-23 22:47:34 +00:00
|
|
|
use Vn\Web\Security;
|
2016-09-24 14:32:31 +00:00
|
|
|
use Vn\Web\Util;
|
2017-12-19 09:08:11 +00:00
|
|
|
use Vn\Lib;
|
2016-09-23 22:47:34 +00:00
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
class Invoice extends Vn\Web\RestRequest {
|
2016-09-06 14:25:02 +00:00
|
|
|
const PARAMS = ['invoice'];
|
2016-09-23 22:47:34 +00:00
|
|
|
const SECURITY = Security::INVOKER;
|
2016-07-22 20:00:27 +00:00
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
function run($db) {
|
|
|
|
$pdfPath = $db->getValueFromFile(__DIR__ .'/invoice',
|
|
|
|
['invoice' =>(int) $_GET['invoice']]);
|
2016-07-22 20:00:27 +00:00
|
|
|
|
|
|
|
if (!$pdfPath)
|
2018-05-23 10:14:20 +00:00
|
|
|
throw new Lib\UserException(s('Invoice id not found'));
|
2016-07-22 20:00:27 +00:00
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
Util::printFile($pdfPath);
|
2016-07-22 20:00:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|