gestione gare pubbliche
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.
 
 
 
 
 

139 righe
4.1 KiB

<?
$_ENV["__SKIP_PURIFY"] = true;
$_cdir = __DIR__;
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once $configPath;
include_once __DIR__ . "/class/TedEsender.class.php";
$settings = file_get_contents("{$_cdir}/config/settings.json");
$settings = json_decode($settings, TRUE);
function onSaveError($message) {
?>
Swal({
text: "<?= __guue($message) ?>",
type: "error",
showCancelButton: false,
confirmButtonColor: '#d33',
confirmButtonText: js_dict.conferma,
closeOnConfirm: true
}).then(() => {
window.location.reload();
});
<?
}
if (! empty($_POST) && ! empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice) && tokenVerify() && $_SESSION["utente"]->unlockSupporto()) {
if (! empty(eFormsManager::get($_POST["guue"] ?? null, "TED_ESENDERS.FORM_SECTION.F03_2014.NUMBER_OF_AWARD_CONTRACT")) && eFormsManager::get($_POST["guue"] ?? null, "TED_ESENDERS.FORM_SECTION.F03_2014.NUMBER_OF_AWARD_CONTRACT") > 10000) {
onSaveError("Il numero di aggiudicazioni inserite è superiore al massimo consentito");
return;
}
// Buffered output when responding with JSON to prevent notices from interfering
if(!empty($_POST["action"]) && $_POST["action"] == "autosave") {
ob_start();
}
$ted = new TedEsender($_POST["form"], (int) $_POST["codice"], $settings, "{$_cdir}/config/xml");
$ted->setMode("save");
$ted->debug = DEVELOP_ENV;
if (!empty($ted->info["modulo"]) && !empty($ted->info["codice_elemento"])) {
if (!$_SESSION["utente"]->permission($ted->info["modulo"],$ted->info["codice_elemento"])) {
header('HTTP/1.0 403 Forbidden');
die();
}
}
// Assegnamo un titolo provvisorio per evitare errori di autosalvataggio
if(empty($_POST["titolo"])) {
$_POST["titolo"] = uniqid(__guue("Pubblicazione"));
}
if (($ted->info["stato"] ?? "") === "TRASMESSO" || ($ted->info["stato"] ?? "") === "PUBBLICATO") {
onSaveError("Questo form non può essere modificato");
return;
}
$result = $ted->save($_POST);
if($result["concurrence_lock"] ?? false) {
$message = "Questo form sta venendo modificato da un altro utente. Il blocco scade tra {$result['concurrence_lock']['delta']} secondi.";
if(($_POST["action"] ?? "") === "autosave") {
header('Content-Type: application/json');
die(json_encode(["errors" => $message]));
} else {
onSaveError($message);
}
return;
}
if(! empty($result["codice"])) {
$query = [];
$query["codice"] = $result["codice"];
$query["form"] = $result["form"];
switch($_POST["action"]) {
case 'autosave':
header('Content-Type: application/json');
if($result["first_save"] ?? false) {
$query["section"] = $_GET["section"];
$query["subsection_index"] = $_GET["subsection_index"];
$query = http_build_query($query);
$url = "/backend/guue/edit.php?{$query}";
die(json_encode(["redirect" => $url]));
}
$current_section = $_POST["current_section"];
$sections_index = array_flip(array_column($ted->sections, "name"));
$section_index = $sections_index[$current_section];
$current_subsection_index = $_POST["current_subsection_index"];
$section = $ted->sections[$section_index];
$formStructure = $ted->createFormStructure($section, $current_subsection_index, false);
// Fetch errors
$errors = ob_get_clean();
if(!empty($errors) /*&& $ted->advanced_debug*/) {
$formStructure["errors"] = $errors;
}
die(json_encode($formStructure));
break;
case 'save-and-remain':
if(!($result["first_save"] ?? false)) {
die("window.location.reload()");
}
break;
case 'verify':
if($ted->completed()) {
$ted->noticeValidation();
}
die("window.location.reload()");
break;
default:
$query["section"] = $_POST["next_section"];
$query["subsection_index"] = $_POST["next_subsection_index"];
break;
}
$query = http_build_query($query);
$url = "/backend/guue/edit.php?{$query}";
die("window.location.href=\"{$url}\"");
exit;
}
}
header('HTTP/1.0 403 Forbidden');
die();
?>