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.
 
 
 
 
 

117 righe
4.9 KiB

<?
$error = true;
$configPath = substr(__DIR__, 0, strpos(__DIR__, "public_html")) . "/config.php";
include_once($configPath);
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission('cpn') && tokenVerify($_GET["token"]) && !empty($_GET["codice"])) {
$cpn = attiCPN::init($_GET["codice"]);
if (!empty($cpn)) {
$error = false;
$riferimento = $_GET["codice_atto"] ?? null;
$dati = $cpn->getRequest($_GET["method"],$riferimento);
if (!empty($dati)) {
if (empty($_SESSION["cpn"]["token"])) {
?>
<script>
modalURL = [];
<? $action = base64_encode("/backend/cpn/send.php?".http_build_query($_GET)); ?>
showModalWithURL('/backend/common/cpn/views/login.php?codice_ente=<?= $cpn->info["codice_ente"] ?>&action=<?= $action ?>');
</script>
<?
} else {
$cpnWS = new cpn($cpn->info["codice_ente"],"b_cpn",$cpn->info["codice"]);
$cpnWS->debug = false;
$esito = $cpnWS->{$dati["method"]}($dati["data"]);
if (!empty($esito)) {
$stato_cpn = 50;
if (!empty($esito["validate"])) {
alertManager::printWarningBox(__("Si sono verificati degli errori di validazione"));
?>
<table class="table table-striped table-condensed table-hover">
<thead>
<tr>
<th>#</th>
<th><?= __("Riferimento") ?></th>
<th><?= __("Campo") ?></th>
<th><?= __("Errore") ?></th>
</tr>
</thead>
<tbody>
<?
$count = 0;
foreach($esito["validate"] AS $msg) {
$count++;
$label = $msg["nome"];
$infoErrore = explode(".",$msg["nome"]);
$campo = null;
$matches = [];
if (count($infoErrore) > 1) {
$campo = $infoErrore[1];
preg_match('/(.*)([A|L|F|S]{1}[0-9]*)$/',$infoErrore[0],$matches);
$label = $infoErrore[0];
}
?>
<tr>
<td><?= $count ?></td>
<td>
<?= $label ?>
</td>
<td><?= $campo ?? "" ?></td>
<td><?= $msg["messaggio"] ?></td>
</tr>
<?
}
?>
</tbody>
</table>
<?
} else {
if (!empty($esito["error"])) {
alertManager::printWarningBox($esito["error"]);
} else {
alertManager::printSuccessBox(__("Operazione eseguita con successo"));
$stato_cpn = 100;
}
if (!empty($esito["id"])) {
$cpn->addToLog("SEND",__("Invio della gara a Servizio Contratti Pubblici"));
$data_cpn = $cpn->info["data_invio_cpn"];
$id_cpn = $esito["id"];
if (empty($data_cpn)) {
$data_cpn = date("Y-m-d H:i:s");
}
$pdo->go("UPDATE b_cpn SET stato = :stato, id_cpn = :id_cpn, data_invio_cpn = :data WHERE codice = :codice",[":stato"=>$stato_cpn,":id_cpn"=>$id_cpn,":codice"=>$cpn->info["codice"],":data"=>$data_cpn]);
scriviLog("b_cpn","UPDATE",$pdo->getSQL(),$cpn->info["codice"]);
} else if (!empty($esito["idExArt29"])) {
$atto = $cpn->getAtti($_GET["codice_atto"])[0] ?? null;
if (!empty($atto)) {
$cpn->addToLog("SEND",__("Invio atto") . " - #" . $atto["codice"]);
$data_cpn = $atto["data_invio_cpn"];
$idRicevuto = $esito["idExArt29"];
if (empty($data_cpn)) {
$data_cpn = date("Y-m-d H:i:s");
}
$pdo->go("UPDATE b_cpn_atti SET stato = :stato, idRicevuto = :idRicevuto, data_invio_cpn = :data WHERE codice = :codice",[":stato"=>$stato_cpn,":idRicevuto"=>$idRicevuto,":codice"=>$atto["codice"],":data"=>$data_cpn]);
scriviLog("b_cpn_atti","UPDATE",$pdo->getSQL(),$atto["codice"]);
}
}
?>
<script>
swal({title:js_dict["success-msg"],type:"success"}).then(function(){
window.location.href="/backend/cpn/panel.php?codice=<?= $cpn->info["codice"] ?>";
});
</script>
<?
}
} else {
alertManager::printAlertBox(__("Errore generico nella trasmissione"));
}
}
} else {
alertManager::printAlertBox(__("Errore nell'elaborazione della richiesta"));
}
}
}
if ($error) {
header('HTTP/1.0 403 Forbidden');
die();
}
?>