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.
 
 
 
 
 

96 righe
2.5 KiB

<?
$error = true;
$configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php";
include_once($configPath);
$id_modulo = "lotti";
if (isset($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_POST["codice_gara"],$id_modulo) && !empty($_POST["codice_gara"])) {
$gara = gara::init($_POST["codice_gara"]);
if (!empty($gara) && !$gara->checkLock($id_modulo)) {
$elements = jsonToArray("elements.json");
$uploaded = massiveHelper::getDataFromUpload($elements,$_POST["filechunk"]);
$categorie = $gara->getCategorieMerceologiche();
if (!empty($uploaded)) {
$error = false;
if (!empty($uploaded["data"])) {
$lotti = $gara->getLotti();
$codici = [];
foreach($lotti AS $lotto) {
if (!empty($lotto["cig"])) {
$codici[$lotto["cig"]] = $lotto["codice"];
}
}
$import = $uploaded["data"];
$errors = [];
$i = 0;
foreach ($import AS $lotto) {
$i++;
$lotto["codice"] = $codici[$lotto["cig"]] ?? null;
$lotto["codice_gara"] = $gara->info["codice"];
$checkCategoria = false;
foreach($categorie AS $categoria) {
if (strlen($categoria) > 2) {
if ($categoria == $lotto["cpv"]) {
$checkCategoria = true;
break;
}
} else {
if (strpos($lotto["cpv"],$categoria) === 0) {
$checkCategoria = true;
break;
}
}
}
if ($checkCategoria) {
if (!$gara->saveLotto($lotto)) {
$errors[] = "Errore salvataggio lotto riga #" . $i;
}
} else {
$errors[] = "Errore CPV lotto riga #" . $i;
}
}
if (empty($errors)) {
?>
<script>
swal({title:js_dict["success-msg"],type:"success"}).then(function(){
window.location.reload();
});
</script>
<?
} else {
?>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th><?= __("errore") ?></th>
</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();
}
?>