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.
62 righe
2.3 KiB
62 righe
2.3 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
if (!empty($_SESSION["utente"]) |
|
&& !empty($_POST["modulo"]) |
|
&& !empty($_POST["codice_elemento"]) |
|
&& tokenVerify()) { |
|
$manager = new richiesteOE($_POST["modulo"],$_POST["codice_elemento"],$_POST["sub"]); |
|
if ($manager->checkAdminPermission("SAVE")) { |
|
$error = false; |
|
$esito = $manager->saveRichiesta($_POST); |
|
if (!empty($esito)) { |
|
$error = false; |
|
if (empty($esito["error"])) { |
|
$type= "success"; |
|
$title = __("Operazione eseguita con successo"); |
|
$msg = ""; |
|
if (!empty($esito["mancanti"])) { |
|
$type= "warning"; |
|
$title = __("Operazione eseguita con errori"); |
|
$msg = __("Richieste non salvate") . ": <ul><li>" . implode("</li><li>",$esito["mancanti"]) . "</li></ul>"; |
|
$type= "warning"; |
|
} |
|
if (!empty($esito["note"])) { |
|
$type= "warning"; |
|
$title = __("Operazione eseguita con errori"); |
|
$msg .= "<br><br>{$esito["note"]}"; |
|
} |
|
?> |
|
swal({title:"<?= $title ?>",html:"<?= str_replace('"',"'",$msg) ?>",type:"<?= $type ?>"}).then(function(){ |
|
if (typeof tableRichieste !== "undefined") { |
|
tableRichieste.draw(); |
|
} |
|
<?php |
|
switch($esito["callback"] ?? "") { |
|
case "refresh": |
|
echo "refreshModalHelper();"; |
|
break; |
|
case "reset": |
|
echo "modalURL = [];"; |
|
echo "showModalWithURL('/backend/common/richiesteOE/edit.php?modulo={$manager->modulo}&codice_elemento={$manager->elemento}&sub={$manager->sub}&codice={$esito["codice"]}');"; |
|
break; |
|
default: |
|
echo "window.location.reload();"; |
|
} |
|
?> |
|
}); |
|
<?php |
|
} else { |
|
?> |
|
swal({title:"<?= $esito["descrizione"] ?? __("Errore generico") ?> - <?= $esito["codice"] ?? 999 ?> ",type:"error"}).then(function(){ window.location.reload(); }); |
|
<?php |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|