Correzione bug di gestione stampa Fattura elettronica

This commit is contained in:
Dasc3er 2021-03-04 13:57:46 +01:00
parent f5cbb4eb11
commit eda1a5216d
3 changed files with 10 additions and 17 deletions

View File

@ -171,9 +171,9 @@ if (empty($record) || !$has_access) {
</a> </a>
<div class="pull-right"> <div class="pull-right">
{( "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.'" )}
<a class="btn btn-success" id="'.(!empty($record['deleted_at']) ? 'restore' : 'save').'"> <a class="btn btn-success" id="'.(!empty($record['deleted_at']) ? 'restore' : 'save').'">
<i class="fa fa-'.(!empty($record['deleted_at']) ? 'undo' : 'check').'"></i> '.(!empty($record['deleted_at']) ? tr('Salva e Ripristina') : tr('Salva')).' <i class="fa fa-'.(!empty($record['deleted_at']) ? 'undo' : 'check').'"></i> '.(!empty($record['deleted_at']) ? tr('Salva e Ripristina') : tr('Salva')).'

View File

@ -101,6 +101,10 @@ class ButtonManager implements ManagerInterface
protected function getList($options) protected function getList($options)
{ {
if (!empty($options['id_plugin'])) {
return [];
}
if ($options['type'] == 'print') { if ($options['type'] == 'print') {
$results = \Prints::getModulePrints($options['id_module']); $results = \Prints::getModulePrints($options['id_module']);
} else { } else {

View File

@ -17,26 +17,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
use Models\Upload; use Modules\Fatture\Fattura;
use Plugins\ExportFE\FatturaElettronica;
include_once __DIR__.'/../../core.php'; include_once __DIR__.'/../../core.php';
try { $fattura = Fattura::find($id_record);
$fattura_pa = new FatturaElettronica($id_record); $file = $fattura->uploads()->where('name', 'Fattura Elettronica')->first();
} catch (UnexpectedValueException $e) {
echo '<div class="text-center">'.tr('Questo documento non è una fattura elettronica').'</div>';
return;
}
$file = Upload::where('filename', $fattura_pa->getFilename())
->where('id_record', $id_record)
->first();
$file = Models\Upload::find($file['id']);
if (empty($file)) { if (empty($file)) {
echo '<div class="text-center">'.tr('Questo documento non è una fattura elettronica').'</div>'; echo '<div class="text-center">'.tr('Questo documento non possiede una fattura elettronica associata').'</div>';
return; return;
} }