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.
54 righe
2.1 KiB
54 righe
2.1 KiB
<?php |
|
|
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
|
|
if (! empty($_SESSION["utente"]) && empty($_SESSION["ente"]) && $_SESSION["utente"]->permission($radice) && $_SESSION["utente"]->isSupportoOrRoot() && tokenVerify()) { |
|
|
|
$ente = $pdo->go("SELECT codice, denominazione, dominio, esportazione, password_esportazione, giorni_durata_esportazione, data_richiesta_esportazione FROM b_enti WHERE codice = :codice AND attivo = 'N'", [":codice" => $_POST["codice_ente"]])->fetch(PDO::FETCH_ASSOC); |
|
|
|
// Se l'ente non ha un dominio non può essere esportato |
|
if(empty($ente["dominio"])) { |
|
echo <<<JAVASCRIPT |
|
swal({title: "Attenzione, non è possibile creare un fascicolo di esportazione per questo ente!", type: "error"}); |
|
JAVASCRIPT; |
|
exit; |
|
} |
|
|
|
// Se è già stata richiesta un'esportazione verifico la sua validità (data_richiesta_esportazione + giorni_durata_esportazione > oggi) |
|
if(! empty($ente["data_richiesta_esportazione"]) && strtotime("+{$ente["giorni_durata_esportazione"]} days", strtotime($ente["data_richiesta_esportazione"])) > strtotime('now')) { |
|
echo <<<JAVASCRIPT |
|
swal({title: "Attenzione, esiste già un fascicolo di esportazione per questo ente!", type: "error"}); |
|
JAVASCRIPT; |
|
exit; |
|
} |
|
|
|
$salva = new Salva(); |
|
$salva->nome_tabella = "b_enti"; |
|
$salva->operazione = "UPDATE"; |
|
$salva->expect = ["codice", "esportazione", "password_esportazione", "giorni_durata_esportazione", "data_richiesta_esportazione"]; |
|
$salva->oggetto = [ |
|
"codice" => $ente["codice"], |
|
"esportazione" => "richiesta", |
|
"password_esportazione" => "", |
|
"giorni_durata_esportazione" => (int) $_POST["giorni_durata_esportazione"], |
|
"data_richiesta_esportazione" => date('d/m/Y H:i:s') |
|
]; |
|
|
|
if($salva->save()) { |
|
|
|
echo <<<JAVASCRIPT |
|
swal({title: js_dict["success-msg"], type: "success", text: "Esportazione programmata correttamente."}).then(function() { refreshModalHelper(); }); |
|
JAVASCRIPT; |
|
exit; |
|
|
|
} |
|
|
|
echo <<<JAVASCRIPT |
|
swal({title: "Attenzione, si è verificato un errore!", type: "error"}); |
|
JAVASCRIPT; |
|
exit; |
|
|
|
} |
|
|
|
?>
|