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.
136 righe
5.9 KiB
136 righe
5.9 KiB
<? |
|
$configPath = substr(__DIR__, 0, strpos(__DIR__, "public_html")) . "/config.php"; |
|
include_once($configPath); |
|
$id_modulo = "cpn"; |
|
$cmd_info = gara::getInfoModulo($id_modulo); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($cmd_info["modulo_riferimento"], $_GET["codice"], $id_modulo)) { |
|
$codice_round = $_GET["codice_round"] ?? NULL; |
|
$gara = gara::init($_GET["codice"], $codice_round); |
|
if (!empty($gara)) { |
|
$record = $gara->info; |
|
$round = $gara->round; |
|
$lotti = $gara->getLotti(); |
|
$lock = $gara->checkLock($cmd_info["id"]); |
|
|
|
$titolo_modulo = __($cmd_info["titolo"]); |
|
|
|
$breadcrumb = array(); |
|
$breadcrumb["/" . $radice . "/"] = Modulo::getInfo($radice)["titolo"]; |
|
$breadcrumb["/" . $radice . "/panel.php?codice=" . $record["codice"] . "&codice_round=" . $round["codice"]] = __("Pannello"); |
|
$breadcrumb[""] = $titolo_modulo; |
|
|
|
include_once($beRoot . "/layout/top.php"); |
|
if (!empty($lotti)) { |
|
$relazioneGara = attiCPN::relazioniModulo("gare", $record["codice"]); |
|
if (!empty($relazioneGara)) { |
|
$codice_gara_cpn = $relazioneGara["gara_cpn"]; |
|
$cpn = attiCPN::init($codice_gara_cpn); |
|
} else { |
|
$relazioneGara = anac::relazioniModulo("gare", $record["codice"]); |
|
if (!empty($relazioneGara)) { |
|
$codice_gara_anac = $relazioneGara["gara_simog"]; |
|
$anac = anac::init($codice_gara_anac); |
|
} |
|
$beneficiario = Ente::getInfoFromID($record["codice_ente"])[0]; |
|
$cpn = new attiCPN(); |
|
$cpn->modulo = "gare"; |
|
$postGara = []; |
|
$postGara["oggetto"] = $record["oggetto"]; |
|
$postGara["codice_ente"] = $record["codice_ente"]; |
|
$postGara["dati"]["cf_sua"] = $_SESSION["ente"]->getInfo()["cf"]; |
|
$postGara["dati"]["denominazione_sua"] = $_SESSION["ente"]->getInfo()["denominazione"]; |
|
$postGara["dati"]["importo"] = $record["prezzoRiferimento"]; |
|
if (!empty($anac)) { |
|
$datiAnac = $anac->getDati(); |
|
$postGara["dati"]["idAnac"] = $anac->info["id_gara"]; |
|
$postGara["dati"]["cigAccQuadro"] = $datiAnac["cig_acc_quadro"] ?? ""; |
|
$postGara["dati"]["settore"] = $datiAnac["tipo_scheda"] ?? ""; |
|
} |
|
|
|
$postGara["dati"]["ufficio"] = ""; |
|
$postGara["dati"]["tipoProcedura"] = ""; |
|
$postGara["dati"]["centraleCommittenza"] = ""; |
|
$postGara["dati"]["realizzazione"] = ""; |
|
|
|
$incaricati = $gara->getManagerIncarichi()->getIncaricati(); |
|
if (!empty($incaricati)) { |
|
foreach($incaricati AS $incaricato) { |
|
if ($incaricato["ruolo"] == 14) { |
|
$postGara["dati"]["cognome"] = $incaricato["extraInfo"]["cognome"]; |
|
$postGara["dati"]["nome"] = $incaricato["extraInfo"]["nome"]; |
|
$postGara["dati"]["cfPiva"] = $incaricato["codice_fiscale"]; |
|
break; |
|
} |
|
} |
|
} |
|
$esito_gara = $cpn->saveGara($postGara,true); |
|
if (isset($esito_gara["esito"]) && $esito_gara["esito"] === true) { |
|
$codice_gara_cpn = $esito_gara["codice"]; |
|
$creazione = true; |
|
$cpn = attiCPN::init($esito_gara["codice"]); |
|
} else { |
|
$msg = ""; |
|
if (!empty($esito_gara["errori"])) { |
|
$msg = implode("<br>", $esito_gara["errori"]); |
|
} |
|
} |
|
if (!empty($cpn->info)) { |
|
foreach ($lotti as $lottoDB) { |
|
$relazioni = attiCPN::relazioniModulo("gare", $record["codice"], $lottoDB["codice"]); |
|
if (empty($relazioni)) { |
|
$lotto = []; |
|
$lotto["codice_cpn"] = $cpn->info["codice"]; |
|
$lotto["oggetto"] = $lottoDB["oggetto"]; |
|
$lotto["cig"] = $lottoDB["cig"]; |
|
$lotto["cup"] = $lottoDB["cup"]; |
|
$lotto["importo"] = $lottoDB["importoBase"]; |
|
$lotto["dati"] = []; |
|
$lotto["dati"]["cupEsente"] = (empty($lotto["cup"])) ? "1" : "2"; |
|
$lotto["dati"]["idSceltaContraente50"] = attiCPN::getSceltaContraenteFromGara($record["procedura"],$record["timestamp_creazione"]); |
|
$lotto["dati"]["criterioAggiudicazione"] = (!empty($gara->getCriteriTecnici())) ? (!empty($gara->getCriteriEconomici()) ? "3" : "5") : "4"; |
|
$lotto["dati"]["luogoNuts"] = $gara->getExtraInfo()["gara"]["nuts"] ?? ""; |
|
$lotto["cpv"] = [$lottoDB["cpv"]]; |
|
$esito_lotto = $cpn->saveLotto($lotto, true); |
|
if (isset($esito_lotto["esito"]) && $esito_lotto["esito"] === true) { |
|
$codice_gara = $esito_gara["codice"]; |
|
$relazione = $cpn->saveRelazione("gare", $record["codice"], $lottoDB["codice"], $esito_lotto["codice"]); |
|
if (empty($relazione) && !empty($creazione)) { |
|
$pdo->go("DELETE FROM b_cpn WHERE codice = :codice", [":codice" => $esito_gara["codice"]]); |
|
$errore_lotto = true; |
|
} |
|
} else { |
|
$msg = ""; |
|
$errore_lotto = true; |
|
if (!empty($esito_lotto["errori"])) { |
|
$msg = implode("<br>", $esito_lotto["errori"]); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (!empty($codice_gara_cpn) && !isset($errore_lotto)) { |
|
if ($_SESSION["utente"]->permission("cpn", $codice_gara_cpn)) { |
|
echo "<meta http-equiv=\"refresh\" content=\"0;URL=/backend/cpn/panel.php?codice={$codice_gara_cpn}\">"; |
|
die(); |
|
} else { |
|
alertManager::printSuccessBox(__("Relazione creata con successo")); |
|
} |
|
|
|
} else { |
|
if (!isset($choose)) { |
|
alertManager::printAlertBox(__("Errore nel riconoscimento della relazione"), $msg); |
|
} |
|
} |
|
} else { |
|
alertManager::printAlertBox(__("Lotti mancanti")); |
|
} |
|
include_once($beRoot . "/layout/bottom.php"); |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
}
|
|
|