1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-26 15:54:17 +01:00

Aggiunto script cron per import ricevute FE

This commit is contained in:
Luca 2020-10-19 17:45:21 +02:00
parent c646a8c788
commit e202dc8333

39
cron/cron_ricevute_FE.php Normal file
View File

@ -0,0 +1,39 @@
<?php
$skip_permissions = true;
include_once __DIR__.'/../core.php';
use Plugins\ReceiptFE\Interaction;
use Plugins\ReceiptFE\ReceiptHook;
use Plugins\ReceiptFE\Ricevuta;
$list = Interaction::getReceiptList();
if( count($list) == 0){
echo 'Nessuna ricevuta da importare';
} else {
echo count($list)." ricevute da importare:\n";
foreach ($list as $element) {
$name = $element['name'];
echo '[*] '.$name."...";
Interaction::getReceipt($name);
$fattura = null;
try {
$receipt = new Ricevuta($name, $content);
$receipt->save();
$fattura = $receipt->getFattura()->numero_esterno;
$receipt->delete();
Interaction::processReceipt($name);
echo "OK\n";
} catch (UnexpectedValueException $e) {
echo "ERRORE\n";
}
}
}