Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
41 righe
1.3 KiB
41 righe
1.3 KiB
<?php |
|
|
|
$configPath = substr(__DIR__, 0, strpos(__DIR__, "/public_html")) . "/config.php"; |
|
include_once($configPath); |
|
|
|
if(! empty($_POST["codice"]) && $_SESSION["utente"]->permission("fvoe")) { |
|
|
|
$fvoe = FVOE::init($_POST["codice"], FVOEInizializationType::CODICE_FVOE); |
|
if(! empty($fvoe->info["codice"]) && $fvoe->info["stato"] >= 20 && $fvoe->isAccessible()) { |
|
|
|
$tipologia_documenti = array_column($fvoe->tipologia_documenti, null, 'codice'); |
|
if(! empty($tipologia_documenti[$_POST['tipologia']])) { |
|
|
|
$document = $fvoe->fetchDocumentsByType($_POST['tipologia']); |
|
if($document->count() < 1 || strtotime($document->latest()->data_fine_validita) < strtotime("+ 1 month")) { |
|
|
|
$doc = FVOEDocument::init($_POST['tipologia'], $fvoe->info["codice"]); |
|
$result = $doc->request(($_POST["npa"] ?? null), $message); |
|
if($result) { |
|
echo <<<JAVASCRIPT |
|
swal({title: js_dict["success-msg"], type: "success"}).then(function(status) { |
|
window.location.reload(); |
|
}); |
|
JAVASCRIPT; |
|
} else { |
|
echo <<<JAVASCRIPT |
|
swal({title: js_dict["error-msg"], type: "error", html: '{$message}'}).then(function(status) {}); |
|
JAVASCRIPT; |
|
} |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
HTTPStatus(403); |