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.
 
 
 
 
 

85 righe
3.2 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
$error = true;
if ((isset($_SESSION["utente"]) && ($_SESSION["utente"]->hasSuperPowers() || $_SESSION["utente"]->gerarchia === 1 ||
(!empty($_SESSION["utente"]->oe) && $_POST["oe"]["codice"] == $_SESSION["utente"]->oe["codice"]))) && tokenVerify()) {
$error = false;
$oe = oeManager::getOE($_POST["oe"]["codice"]);
$codice_ente = (isset($_SESSION["ente"])) ? $_SESSION["ente"]->codice : 0;
$forms = oeManager::getStandardForms($oe["tipo"],$codice_ente);
if ($oe["tipo"] == "IMP") {
$forms[] = "soa";
$selected = [];
$soa_duplicata = false;
if (!empty($_POST["soa"])) {
foreach($_POST["soa"] AS $categoria) {
if (!isset($selected[$categoria["codice_categoria"]])) {
$selected[$categoria["codice_categoria"]] = true;
} else {
$soa_duplicata = true;
break;
}
}
}
if (!empty($_POST["fatturato"])) {
foreach($_POST["fatturato"] AS $categoria) {
if (!isset($selected[$categoria["codice_categoria"]])) {
$selected[$categoria["codice_categoria"]] = true;
} else {
$soa_duplicata = true;
break;
}
}
}
if ($soa_duplicata) {
?>
swal({title:js_dict.error,html:"<?= __("Impossibile inserire più volte la stessa categoria SOA o fatturato") ?>",type:"error"});
<?
die();
}
}
$update = oeManager::update($_POST);
if ($update === true) {
$validation = [];
if (!empty($forms)) {
foreach($forms AS $form) {
$form = FormManager::getInfoFromID($form,$codice_ente);
if (!empty($form)) {
$formManager = new FormManager;
if ($formManager->init($form["codice"],"oe",$oe["codice"]) != false) {
if (!empty($_POST["dyn-form-input"][$form["codice"]])) {
if ($formManager->saveData($_POST["dyn-form-input"][$form["codice"]])) {
$validation = array_merge($validation,$formManager->validateData());
$error = false;
}
}
}
unset($formManager);
}
}
}
if (empty($validation)) {
$completo = "S";
?>
swal({title:js_dict["success-msg"],type:"success"}).then(function() { window.location.reload() });
<?
} else {
$completo = "N";
?>
swal({title:js_dict["success-msg"],"html":"<?= __("Il tuo profilo non è completo") ?>:<br><?= implode("<br>",$validation) ?>",type:"warning"}).then(function() { window.location.reload() });
<?
}
if (!empty($_SESSION["utente"]->oe)) { $_SESSION["utente"]->oe["profilo_completo"] = $completo; }
$pdo->go("UPDATE b_operatori_economici SET profilo_completo = :completo WHERE codice = :codice",[":completo"=>$completo,":codice"=>$oe["codice"]]);
} else {
?>
swal({title:js_dict.error,html:"<?= __("Dati obbligatori") ?>:<br><?= implode("<br>",$update["msg"]) ?>",type:"error"});
<?
}
}
if ($error) {
header('HTTP/1.0 403 Forbidden');
die();
}
?>