mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-01-29 15:09:26 +01:00
Correzione API per anteprima stampa
This commit is contained in:
parent
5c2c206152
commit
fc7edeacb1
@ -28,17 +28,26 @@ class Stampa extends Resource implements RetrieveInterface
|
||||
{
|
||||
public function retrieve($request)
|
||||
{
|
||||
$content = '';
|
||||
|
||||
$print = PrintTemplate::where('name', $request['name'])->first();
|
||||
if (!empty($print)) {
|
||||
$directory = base_dir().'/files/api';
|
||||
$data = Prints::render($print->id, $request['id_record'], $directory);
|
||||
|
||||
download($data['path']);
|
||||
$string = strpos($request['resource'], 'binary') !== false;
|
||||
$data = Prints::render($print->id, $request['id_record'], $directory, $string);
|
||||
|
||||
if (!$string) {
|
||||
download($data['path']);
|
||||
} else {
|
||||
$content = $data['pdf'];
|
||||
}
|
||||
delete($data['path']);
|
||||
}
|
||||
|
||||
return [
|
||||
'custom' => '',
|
||||
'content' => base64_encode($content),
|
||||
'filename' => $data['name'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -232,3 +232,7 @@ UPDATE `zz_modules` SET `options` = 'SELECT |select| FROM `mg_articoli` LEFT JOI
|
||||
|
||||
-- Aggiunte note prima nota
|
||||
ALTER TABLE `co_movimenti` ADD `note` TEXT NOT NULL AFTER `descrizione`;
|
||||
|
||||
-- Aggiunta risorse API dedicate alle Stampe in binary formato
|
||||
INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `enabled`) VALUES
|
||||
(NULL, 'v1', 'retrieve', 'stampa-binary', 'API\\Common\\Stampa', '1');
|
||||
|
Loading…
x
Reference in New Issue
Block a user