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.
 
 
 
 
 

114 righe
4.2 KiB

<?
$error = true;
$configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php";
include_once($configPath);
$id_modulo = "provvisoria";
if (isset($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_POST["codice_gara"],$id_modulo) && tokenVerify()) {
$gara = gara::init($_POST["codice_gara"],$_POST["codice_round"]);
if (!empty($gara) && $gara->setLotto($_POST["codice_lotto"])) {
if (!$gara->checkLock($id_modulo)) {
if (!empty($gara->lotto)) {
$elements = jsonToArray("elements.json");
$uploaded = massiveHelper::getDataFromUpload($elements,$_POST["filechunk"]);
if (!empty($uploaded)) {
$error = false;
if (!empty($uploaded["data"])) {
$partecipanti = $uploaded["data"];
$cf = [];
$raggruppamenti = [];
$errors = [];
$maxTecnico = 0;
$maxEconomico = 0;
$criteri = $gara->getMacroCriteri();
foreach($criteri AS $criterio) {
if ($criterio["economico"] == "S") {
$maxEconomico += $criterio["peso"];
} else {
$maxTecnico += $criterio["peso"];
}
}
foreach ($partecipanti AS $partecipante) {
if (!empty($gara->getPartecipante($partecipante["codice"]))) {
if ($partecipante["escluso"] == "S" && empty($partecipante["motivazione"])) {
$errors[] = $partecipante["codice_fiscale"] . " " . $partecipante["ragione_sociale"] . " - " . __("Escluso senza motivazione");
}
if ($partecipante["anomalia"] == "S" && empty($partecipante["motivazione_anomalia"])) {
$errors[] = $partecipante["codice_fiscale"] . " " . $partecipante["ragione_sociale"] . " - " . __("Anomalia senza motivazione");
}
if (isset($partecipante["totaleTecnico"]) && $partecipante["totaleTecnico"] > $maxTecnico) {
$errors[] = $partecipante["codice_fiscale"] . " " . $partecipante["ragione_sociale"] . " - " . __("Punteggio tecnico errato");
}
if (isset($partecipante["totaleEconomico"]) && $partecipante["totaleEconomico"] > $maxEconomico) {
$errors[] = $partecipante["codice_fiscale"] . " " . $partecipante["ragione_sociale"] . " - " . __("Punteggio economico errato");
}
} else {
$errors[] = $partecipante["codice_fiscale"] . " " . $partecipante["ragione_sociale"] . " - " . __("Non presente nel lotto");
}
}
if (empty($errors)) {
$salva = new salva();
$salva->debug = false;
$salva->nome_tabella = "r_partecipanti_gare";
$salva->operazione = "UPDATE";
foreach($partecipanti AS $partecipante) {
if ($partecipante["anomalia"] == "S") {
$partecipante["anomalia"] = "S";
$partecipante["a_facoltativa"] = "S";
}
unset($partecipante["codice_fiscale"]);
unset($partecipante["ragione_sociale"]);
$partecipante["totale"] = ($partecipante["totaleTecnico"] ?? 0) + ($partecipante["totaleEconomico"] ?? 0);
$salva->oggetto = $partecipante;
$salva->save();
}
$gara->updatePartecipantiANAC();
$gara->addToLog("UPDATE",__("Lotto") . " {$gara->lotto["numero"]} :" . __("Caricamento massivo punteggi"));
?>
<script>
swal({title:js_dict["success-msg"],type:"success"}).then(function(){
window.location.reload();
});
</script>
<?
} else {
alertManager::printAlertBox(__("impossibile continuare"));
?>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td><?= __("errore") ?></td>
</tr>
</thead>
<tbody>
<?
foreach($errors AS $errore) {
?>
<tr>
<td><strong><?= $errore ?></strong></td>
</tr>
<?
}
?>
</tbody>
</table>
</div>
<?
}
} else {
alertManager::printAlertBox(__("impossibile continuare"));
if (!empty($uploaded["errors"])) {
massiveHelper::printErrors($uploaded["errors"]);
}
}
}
}
}
}
}
if ($error) {
header('HTTP/1.0 403 Forbidden');
die();
}
?>