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.
127 righe
5.7 KiB
127 righe
5.7 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
if (!empty($_GET) && !empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_GET["codice"]) |
|
&& $_SESSION["utente"]->permission("simog") |
|
&& tokenVerify($_GET["token"]) && $_SESSION["utente"]->unlockSupporto() |
|
&& !empty($_GET["method"])) { |
|
|
|
$anac = anac::init($_GET["codice"]); |
|
$codice_lotto = $_GET["codice_lotto"] ?? ""; |
|
$errors = []; |
|
if (!empty($anac)) { |
|
$error = false; |
|
$method = $_GET["method"]; |
|
if (empty($anac->info["id_stazione_appaltante"])) { |
|
if (empty($_GET["fromSelectCollaborazione"])) { unset($_SESSION["simog"]["collaborazione"]); } |
|
} else { |
|
if (!empty($_SESSION["simog"])) { |
|
foreach($_SESSION["simog"]["collaborazioni"] AS $collaborazione) { |
|
if (!empty($collaborazione["ufficio_id"])) { |
|
if ($collaborazione["ufficio_id"] == $anac->info["id_stazione_appaltante"]) { |
|
$_SESSION["simog"]["collaborazione"] = $collaborazione; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (empty($_SESSION["simog"]["collaborazione"])) { |
|
?> |
|
<script> |
|
modalURL = []; |
|
<? $action = base64_encode("/backend/anac/send.php?".http_build_query($_GET)); ?> |
|
showModalWithURL('/backend/anac/ws/views/login.php?action=<?= $action ?>'); |
|
</script> |
|
<? |
|
} else { |
|
$data = $anac->getRequestArray($method,$codice_lotto); |
|
if (!empty($data)) { |
|
include($beRoot."/anac/ws/simog.class.php"); |
|
$simog = new simog(); |
|
$simog->codice_simog = $anac->info["codice"]; |
|
$simog->codice_lotto = $codice_lotto; |
|
$simog->index = $_SESSION["simog"]["collaborazione"]["index"]; |
|
$simog->ticket = $_SESSION["simog"]["ticket"]; |
|
if ($data["method"] != "loaderAppalto") { |
|
$return = $simog->sendData($data["method"],$data["data"]); |
|
} else { |
|
$return = []; |
|
if (!empty($data["data"]["trasferimentoDati"]["SchedeEliminate"])) { |
|
$eliminate = $data["data"]; |
|
unset($eliminate["trasferimentoDati"]["Schede"]); |
|
$return[] = $simog->sendData($data["method"],$eliminate); |
|
unset($data["data"]["trasferimentoDati"]["SchedeEliminate"]); |
|
} |
|
$schede = $data["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"] ?? []; |
|
if (!empty($schede)) { |
|
if (count($schede) > 1) { |
|
$tipologie = $anac->listSchede($codice_lotto); |
|
$cui = $data["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"]["CUI"]; |
|
unset($data["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"]); |
|
foreach($schede AS $idScheda => $scheda) { |
|
if ($idScheda != "CUI") { |
|
$sendData = $data; |
|
$sendData["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"]["CUI"] = $cui; |
|
$sendData["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"][$idScheda] = $scheda; |
|
$multiple = []; |
|
$multiple["DatiRitardi"] = $tipologie["ritardi"]["XMLelement"]; |
|
$multiple["DatiSubappalti"] = $tipologie["subappalti"]["XMLelement"]; |
|
$multiple["DatiAvanzamenti"] = $tipologie["avanzamenti"]["XMLelement"]; |
|
$multiple["DatiSospensioni"] = $tipologie["sospensione"]["XMLelement"]; |
|
$multiple["DatiVarianti"] = $tipologie["varianti"]["XMLelement"]; |
|
if (empty($multiple[$idScheda])) { |
|
$return[] = $simog->sendData($data["method"],$sendData["data"]); |
|
} else { |
|
$all = $sendData["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"][$idScheda][$multiple[$idScheda]]; |
|
foreach($all AS $element) { |
|
$sendData["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"][$idScheda][$multiple[$idScheda]] = $element; |
|
$return[] = $simog->sendData($data["method"],$sendData["data"]); |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
unset($data["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"]["CUI"]); |
|
$return[] = $simog->sendData($data["method"],$data["data"]); |
|
} |
|
} |
|
} |
|
if (!empty($return)) { |
|
$anac->manageResponse($return,$_GET["method"],$codice_lotto); |
|
} else { |
|
$errors = array_merge($errors,$simog->errors); |
|
} |
|
} else { |
|
$errors[] = "Impossibile costruire la richiesta"; |
|
} |
|
} |
|
} |
|
if (!empty($errors)) { |
|
ob_clean(); |
|
foreach($errors as $msg) { ?> |
|
<div class="border text-center p-1 m-1"><?= __($msg) ?></div> |
|
<? } |
|
$errors = ob_get_clean(); |
|
alertManager::printAlertBox(__("Si sono verificati degli errori"),$errors); |
|
} else { |
|
?> |
|
<script> |
|
$('#modal-helper').on('hidden.bs.modal', function (e) { |
|
<? if (!empty($_GET["returnToEditGara"])) { ?> |
|
window.location.href="/backend/anac/edit.php?codice=<?= $anac->info["codice"] ?>"; |
|
<? } else if (!empty($_GET["returnToEditLotto"])) { ?> |
|
window.location.href="/backend/anac/lotti/edit.php?codice_simog=<?= $anac->info["codice"] ?>&codice_lotto=<?= $codice_lotto ?>"; |
|
<? } else { ?> |
|
window.location.reload(); |
|
<? } ?> |
|
}) |
|
</script> |
|
<? |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|