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.
156 righe
6.2 KiB
156 righe
6.2 KiB
<? |
|
if (isset($this) && is_a($this,"anac")) { |
|
$lotto = $this->getLotti($codice_lotto)[0] ?? NULL; |
|
if (!empty($lotto["codice"])) { |
|
$simogMethod = "inserisciLotto"; |
|
if (!empty($lotto["cig"])) { $simogMethod = "modificaLotto"; } |
|
if ($operation == "get") { |
|
$return = []; |
|
$return["method"] = $simogMethod; |
|
$return["data"] = []; |
|
$return["data"]["id_gara"] = $this->info["id_gara"]; |
|
$array = []; |
|
if (!empty($lotto["cig"])) { |
|
$return["data"]["cig"] = $lotto["cig"]; |
|
} |
|
|
|
$array["OGGETTO"] = $lotto["oggetto"]; |
|
$array["IMPORTO_LOTTO"] = $lotto["importo"]; |
|
$array["ID_SCELTA_CONTRAENTE"] = $lotto["id_scelta_contraente"]; |
|
if (!empty($lotto["cup"])) { |
|
$array["FLAG_CUP"] = "S"; |
|
$cup["CUP"] = $lotto["cup"]; |
|
$cup["VALIDO"] = "S"; |
|
$cup["OK_UTENTE"] = "S"; |
|
$array["CUPLOTTO"]["CODICICUP"] = $cup; |
|
} else { |
|
$array["FLAG_CUP"] = "N"; |
|
} |
|
$dati = json_decode($lotto["dati"],true); |
|
$availableDati = []; |
|
$availableDati[] = "importo_attuazione_sicurezza"; |
|
$availableDati[] = "id_aff_riservati"; |
|
$availableDati[] = "id_categoria_prevalente"; |
|
$availableDati[] = "categoria_merc"; |
|
$availableDati[] = "tipo_contratto"; |
|
$availableDati[] = "flag_escluso"; |
|
$availableDati[] = "id_esclusione"; |
|
$availableDati[] = "flag_regime"; |
|
$availableDati[] = "art_regime"; |
|
$availableDati[] = "luogo_nuts"; |
|
$availableDati[] = "flag_dl50"; |
|
$availableDati[] = "durata_affidamento"; |
|
$availableDati[] = "durata_rinnovi"; |
|
$availableDati[] = "prima_annualita"; |
|
$availableDati[] = "annuale_cui_mininf"; |
|
$availableDati[] = "id_motivo_coll_cig"; |
|
$availableDati[] = "cig_origine_rip"; |
|
$availableDati[] = "flag_pnrr_pnc"; |
|
$availableDati[] = "flag_previsione_quota"; |
|
$availableDati[] = "quota_femminile"; |
|
$availableDati[] = "quota_giovanile"; |
|
$availableDati[] = "flag_misure_premiali"; |
|
$availableDati[] = "id_motivo_deroga"; |
|
$availableDati[] = "id_misura_premiale"; |
|
// $availableDati[] = "flag_no_adesione_iniziativa"; |
|
// $availableDati[] = "flag_sa_non_classificata"; |
|
foreach($availableDati AS $key) { |
|
if ($key == "id_motivo_deroga") { |
|
$array["MotivoDeroga"] = $dati[$key] ?? ""; |
|
} else if ($key == "id_misura_premiale") { |
|
$array["MisuraPremiale"] = $dati[$key] ?? ""; |
|
} else { |
|
$array[strtoupper($key)] = $dati[$key] ?? ""; |
|
} |
|
} |
|
if (!empty($dati["cpv"])) { |
|
$cpv = cpvManager::getInfo($dati["cpv"]); |
|
if (!empty($cpv)) { |
|
$array["CPV"] = $cpv[$dati["cpv"][0]]["codice_completo"]; |
|
} |
|
} |
|
if (!empty($dati["tipo_contratto"])) { |
|
if($dati["tipo_contratto"] == "L") { |
|
$array["TipiAppaltoLav"]["ID_APPALTO"] = $dati["tipoappalto"]; |
|
} else { |
|
$array["TipiAppaltoForn"]["ID_APPALTO"] = $dati["tipoappalto"]; |
|
} |
|
} |
|
if (!empty($dati["condizioni"])) { |
|
foreach($dati["condizioni"] AS $condizione) { |
|
$array["Condizioni"][]["ID_CONDIZIONE"] = $condizione; |
|
} |
|
} |
|
if (!empty($dati["secondarie"])) { |
|
$cpv = cpvManager::getInfo($dati["secondarie"]); |
|
if (!empty($cpv)) { |
|
foreach($cpv AS $secondaria) { |
|
$array["CPVSecondaria"]["COD_CPV_SECONDARIA"][] = $secondaria["codice_completo"]; |
|
} |
|
} |
|
} |
|
foreach($array AS $key => $value) { |
|
if (empty($value) && $value !== "0") { unset($array[$key]); } |
|
} |
|
$array["IMPORTO_SA"] = 0; |
|
$array["IMPORTO_IMPRESA"] = 0; |
|
$return["data"]["@xmlns:simog"] = "xmlbeans.massload.simog.avlp.it"; |
|
$return["data"]["datiLotto"]["Lotto"] = $array; |
|
} else if ($operation == "put" && !empty($response)) { |
|
|
|
if (!empty($response->return->success)) { |
|
$this->updateSimogLog($simogMethod,1,"",$lotto["codice"]); |
|
if (!empty($response->return->cig)) { |
|
$this->updateStato("10"); |
|
$update = []; |
|
$update["codice"] = $lotto["codice"]; |
|
$update["cig"] = $lotto["cig"] = $response->return->cig->cig . $response->return->cig->cigKKK; |
|
$update["richiesto_simog"] = "S"; |
|
$update["data_invio_simog"] = date("d-m-Y H:i:s"); |
|
|
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_simog_lotti"; |
|
$salva->operazione = "UPDATE"; |
|
$salva->oggetto = $update; |
|
$salva->save(); |
|
|
|
$this->updateRelazioni($lotto["codice"]); |
|
} |
|
if (!$massive) { |
|
?> |
|
<div class="alert alert-success p-5 text-center"> |
|
<span class="fa fa-check fa-3x"></span><br> |
|
<?= __("Operazione effettuata con successo") ?><br> |
|
<span class="h3"><?= $lotto["cig"] ?></span> |
|
</div> |
|
<button type="button" class="btn btn-info btn-block mt-3" onClick="showModalWithURL('/backend/anac/lotti/ricevuta-cig.php?codice_simog=<?= $this->info["codice"] ?>&codice_lotto=<?= $lotto["codice"] ?>')"> |
|
<span class="fa fa-file"></span> <?= __("Ricevuta CIG") ?> |
|
</button> |
|
<? |
|
} else { |
|
?> |
|
<div class="alert alert-success p-3 mb-1"> |
|
<span class="fa fa-check"></span> <?= __("Operazione effettuata con successo") ?>: <strong><?= $lotto["cig"] ?></strong> |
|
</div> |
|
<? |
|
} |
|
$return = true; |
|
} else if (!empty($response->return->error)) { |
|
$errors = $response->return->error; |
|
} else { |
|
$errors = __("Errore nella risposta"); |
|
} |
|
} else { |
|
$errors = __("Operazione sconosciuta"); |
|
} |
|
} else { |
|
$errors = __("Impossibile trovare lotto"); |
|
} |
|
if (!empty($errors)) { |
|
$this->updateSimogLog($simogMethod,2,$errors,$lotto["codice"]); |
|
alertManager::printAlertBox($errors); |
|
} |
|
} |
|
?>
|