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.
103 righe
2.5 KiB
103 righe
2.5 KiB
<? |
|
|
|
ob_start(); |
|
|
|
$configPath = substr(__DIR__, 0, strpos(__DIR__, "/public_html")) . "/config.php"; |
|
include_once $configPath; |
|
|
|
function onSaveError($message) |
|
{ |
|
?> |
|
Swal({ |
|
text: "<?= __($message) ?>", |
|
type: "error", |
|
showCancelButton: false, |
|
confirmButtonColor: '#d33', |
|
confirmButtonText: js_dict.conferma, |
|
closeOnConfirm: true |
|
}).then(() => { |
|
window.location.reload(); |
|
}); |
|
<? |
|
} |
|
|
|
$postData = $_POST; |
|
|
|
if (valid_json(file_get_contents("php://input"), $jsonPOST, true)) { |
|
$postData = $jsonPOST; |
|
} |
|
|
|
if (!empty($postData) && !empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice, $postData["codice"]) && tokenVerify($postData["token"])) { |
|
|
|
$npa = NuovaPiattaformaAppalti::init( |
|
null, |
|
!empty($postData["codice"]) ? $postData["codice"] : null, $postData["id_scheda"], |
|
!empty($postData["modulo_riferimento"]) ? $postData["modulo_riferimento"] : null, |
|
!empty($postData["id_riferimento"]) ? $postData["id_riferimento"] : null |
|
); |
|
|
|
if (!empty($npa)) { |
|
if (!$npa->verifyUtente()) { |
|
die_forbidden(); |
|
} |
|
// Checking if the card belongs to a Lot |
|
if ($npa->metadataSchede[$npa->scheda["id_scheda"]]["lotto"] && !empty($postData["codice_lotto"])) { |
|
|
|
$npa->setLotto($postData["codice_lotto"]); |
|
} |
|
|
|
if (empty($npa->scheda) || !$npa->checkLock()) { |
|
$result = $npa->save($postData); |
|
|
|
// Catturiamo eventuali notice da PHP |
|
$notices = ob_get_clean(); |
|
if (!empty($notices)) { |
|
?> |
|
swal({ |
|
title: js_dict.attenzione , |
|
html: `<?= htmlspecialchars($notices) ?>`, |
|
type: "error" |
|
}).then(function(){ |
|
window.location.reload(); |
|
}); |
|
<?php |
|
exit; |
|
} |
|
if (!empty($result["codice"])) { |
|
|
|
$query = []; |
|
$query["codice"] = $npa->scheda["codice"]; |
|
$query["scheda"] = $npa->scheda["id_scheda"]; |
|
$query["modulo_riferimento"] = $npa->fascicolo["modulo_riferimento"]; |
|
$query["id_riferimento"] = $npa->fascicolo["id_riferimento"]; |
|
if (!empty($npa->lot["codice_lotto_npa"])) { |
|
$query["codice_lotto"] = $npa->lot["codice_lotto_npa"]; |
|
} |
|
if (!empty($npa->scheda["round_riferimento"])) { |
|
$query["round_riferimento"] = $npa->scheda["round_riferimento"]; |
|
} |
|
|
|
$query = http_build_query($query); |
|
$url = "/backend/npa/edit.php?{$query}"; |
|
die("window.location.href=\"{$url}\""); |
|
exit; |
|
} |
|
|
|
?> |
|
swal({ |
|
title: js_dict.attenzione, |
|
html: `Impossibile salvare, riprova tra poco`, |
|
type: "error" |
|
}).then(function(){ |
|
window.location.reload(); |
|
}); |
|
<?php |
|
exit; |
|
} |
|
} |
|
} |
|
|
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
|
|
?>
|