From eda1a5216d92a780126d57a7c086a1dafbd46fc4 Mon Sep 17 00:00:00 2001 From: Dasc3er Date: Thu, 4 Mar 2021 13:57:46 +0100 Subject: [PATCH] Correzione bug di gestione stampa Fattura elettronica --- editor.php | 4 ++-- src/HTMLBuilder/Manager/ButtonManager.php | 4 ++++ templates/fatture_elettroniche/body.php | 19 ++++--------------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/editor.php b/editor.php index 5bade559b..6c1b8b85d 100755 --- a/editor.php +++ b/editor.php @@ -171,9 +171,9 @@ if (empty($record) || !$has_access) {
- {( "name": "button", "type": "print", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'" )} + {( "name": "button", "type": "print", "id_module": "'.$id_module.'", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'" )} - {( "name": "button", "type": "email", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'" )} + {( "name": "button", "type": "email", "id_module": "'.$id_module.'", "id_plugin": "'.$id_plugin.'", "id_record": "'.$id_record.'" )} '.(!empty($record['deleted_at']) ? tr('Salva e Ripristina') : tr('Salva')).' diff --git a/src/HTMLBuilder/Manager/ButtonManager.php b/src/HTMLBuilder/Manager/ButtonManager.php index 643bd2780..14751347e 100755 --- a/src/HTMLBuilder/Manager/ButtonManager.php +++ b/src/HTMLBuilder/Manager/ButtonManager.php @@ -101,6 +101,10 @@ class ButtonManager implements ManagerInterface protected function getList($options) { + if (!empty($options['id_plugin'])) { + return []; + } + if ($options['type'] == 'print') { $results = \Prints::getModulePrints($options['id_module']); } else { diff --git a/templates/fatture_elettroniche/body.php b/templates/fatture_elettroniche/body.php index 12e6238e6..886ea13f9 100644 --- a/templates/fatture_elettroniche/body.php +++ b/templates/fatture_elettroniche/body.php @@ -17,26 +17,15 @@ * along with this program. If not, see . */ -use Models\Upload; -use Plugins\ExportFE\FatturaElettronica; +use Modules\Fatture\Fattura; include_once __DIR__.'/../../core.php'; -try { - $fattura_pa = new FatturaElettronica($id_record); -} catch (UnexpectedValueException $e) { - echo '
'.tr('Questo documento non è una fattura elettronica').'
'; - - return; -} -$file = Upload::where('filename', $fattura_pa->getFilename()) - ->where('id_record', $id_record) - ->first(); - -$file = Models\Upload::find($file['id']); +$fattura = Fattura::find($id_record); +$file = $fattura->uploads()->where('name', 'Fattura Elettronica')->first(); if (empty($file)) { - echo '
'.tr('Questo documento non è una fattura elettronica').'
'; + echo '
'.tr('Questo documento non possiede una fattura elettronica associata').'
'; return; }