openstamanager/plugins/fatturazione/actions.php

26 lines
662 B
PHP
Raw Normal View History

2018-07-09 12:57:55 +02:00
<?php
include_once __DIR__.'/../../core.php';
2018-09-18 15:57:55 +02:00
include_once __DIR__.'/init.php';
2018-07-09 12:57:55 +02:00
switch (filter('op')) {
case 'generate':
2018-09-18 15:57:55 +02:00
if (!empty($fattura)) {
2018-07-09 12:57:55 +02:00
$file = $fattura->save($upload_dir);
2018-07-19 17:29:21 +02:00
flash()->info(tr('Fattura elettronica generata correttamente!'));
2018-07-09 12:57:55 +02:00
2018-07-09 14:40:16 +02:00
if (!$fattura->isValid()) {
2018-07-19 17:29:21 +02:00
flash()->warning(tr('La fattura elettronica potrebbe avere delle irregolarità!'));
2018-07-09 12:57:55 +02:00
}
2018-09-18 15:57:55 +02:00
} else {
2018-07-19 17:29:21 +02:00
flash()->error(tr('Impossibile generare la fattura elettronica'));
2018-07-09 12:57:55 +02:00
}
break;
case 'download':
2018-09-18 15:57:55 +02:00
download($upload_dir.'/'.$fattura->getFilename());
2018-07-09 12:57:55 +02:00
break;
}