1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-28 00:30:45 +01:00
openstamanager/cron/cron_ricevute_FE.php

39 lines
909 B
PHP

<?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";
}
}
}