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.
89 righe
3.7 KiB
89 righe
3.7 KiB
<? |
|
$return = ["esito"=>false,"codice"=>0,"errori"=>[]]; |
|
if (isset($this) && is_a($this,"anac") && isset($lotto)) { |
|
if (!empty($this->info["codice"])) { |
|
if (!empty($lotto["cpv"]) || $this->info["smart_cig"] == "S") { |
|
if ($this->info["smart_cig"] == "S" || count($lotto["cpv"]) === 1) { |
|
$cpv = $lotto["cpv"][0] ?? false; |
|
if (strlen($cpv) >= 3 || $this->info["smart_cig"] == "S" || $force) { |
|
if ($this->info["smart_cig"] == "S") { |
|
$dbLotto = $this->getLotti()[0] ?? get_campi("b_simog_lotti"); |
|
} else { |
|
if (!empty($lotto["codice"])) { $dbLotto = $this->getLotti($lotto["codice"])[0]; } |
|
} |
|
$dati = []; |
|
if (!empty($dbLotto)) { |
|
$lotto["codice"] = $dbLotto["codice"]; |
|
$dati = json_decode($dbLotto["dati"],true); |
|
} |
|
if ($saveDati) { |
|
$availableDati = []; |
|
$availableDati[] = "importo_attuazione_sicurezza"; |
|
$availableDati[] = "condizioni"; |
|
$availableDati[] = "id_aff_riservati"; |
|
$availableDati[] = "tipo_contratto"; |
|
$availableDati[] = "id_categoria_prevalente"; |
|
$availableDati[] = "categoria_merc"; |
|
$availableDati[] = "flag_escluso"; |
|
$availableDati[] = "id_esclusione"; |
|
$availableDati[] = "flag_regime"; |
|
$availableDati[] = "art_regime"; |
|
$availableDati[] = "luogo_nuts"; |
|
$availableDati[] = "flag_dl50"; |
|
$availableDati[] = "prima_annualita"; |
|
$availableDati[] = "annuale_cui_mininf"; |
|
$availableDati[] = "id_motivo_coll_cig"; |
|
$availableDati[] = "cig_origine_rip"; |
|
$availableDati[] = "tipoappalto"; |
|
$availableDati[] = "flag_no_adesione_iniziativa"; |
|
$availableDati[] = "flag_sa_non_classificata"; |
|
foreach($availableDati AS $key) { |
|
if (isset($lotto["dati"][$key])) { |
|
$dati[$key] = $lotto["dati"][$key]; |
|
} else { |
|
$upper = strtoupper($key); |
|
if (isset($lotto["dati"][$upper])) { |
|
$dati[$key] = $lotto["dati"][$upper]; |
|
} else { |
|
$dati[$key] = ""; |
|
} |
|
} |
|
} |
|
if (!empty($lotto["cpv"])) { |
|
$dati["cpv"] = $lotto["cpv"]; |
|
} |
|
if (!empty($lotto["secondarie"])) { |
|
$dati["CPVSecondaria"] = $lotto["secondarie"]; |
|
} |
|
} |
|
$lotto["dati"] = json_encode($dati); |
|
$lotto["codice_simog"] = $this->info["codice"]; |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_simog_lotti"; |
|
$salva->operazione = (empty($lotto["codice"])) ? "INSERT" : "UPDATE"; |
|
$salva->oggetto = $lotto; |
|
$codice = $salva->save(); |
|
if ($codice != false) { |
|
$return["esito"] = true; |
|
$return["codice"] = $codice; |
|
$this->updateRelazioni($codice); |
|
} else { |
|
$return["errori"][] = __("Errore nel salvataggio del lotto"); |
|
} |
|
} else { |
|
$return["errori"][] = __("E' necessario selezionare almeno una CPV prevalente di secondo livello. Es. 031"); |
|
} |
|
} else { |
|
$return["errori"][] = __("Selezionare solo una CPV prevalente"); |
|
} |
|
} else { |
|
$return["errori"][] = __("CPV Prevalente è obbligatorio"); |
|
} |
|
} else { |
|
$return["errori"][] = __("Nessuna gara selezionata"); |
|
} |
|
} |
|
|
|
?>
|