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.
108 righe
4.2 KiB
108 righe
4.2 KiB
<? |
|
$return = ["esito"=>false,"codice"=>0,"errori"=>[]]; |
|
if (isset($this) && is_a($this,"anac") && isset($post)) { |
|
if (!empty($post["dati"]["categorie_merc"]) || !empty($post["dati"]["CATEGORIE_MERC"])) { |
|
$entiAbilitati = $_SESSION["utente"]->getEntiBeneficiari(false); |
|
$checkEnte = false; |
|
foreach($entiAbilitati AS $ente) { |
|
if ($post["codice_ente"] == $ente["codice"]) { |
|
$checkEnte = true; |
|
break; |
|
} |
|
} |
|
if ($checkEnte) { |
|
if ($post["smart_cig"] == "S" && isset($post["lotto"]) || $post["smart_cig"] == "N") { |
|
$availableDati = ["cf_sua","denominazione_sua"]; |
|
if ($post["smart_cig"] == "S") { |
|
$availableDati[] = "categorie_merc"; |
|
$availableDati[] = "codiceProceduraSceltaContraente"; |
|
$availableDati[] = "codiceClassificazioneGara"; |
|
$availableDati[] = "codiceFattispecieContrattuale"; |
|
$availableDati[] = "cigAccordoQuadro"; |
|
$availableDati[] = "motivo_rich_cig_catmerc"; |
|
} else { |
|
$availableDati[] = "categorie_merc"; |
|
$availableDati[] = "importo"; |
|
$availableDati[] = "tipo_scheda"; |
|
$availableDati[] = "modo_indizione"; |
|
$availableDati[] = "allegato_ix"; |
|
$availableDati[] = "modo_realizzazione"; |
|
$availableDati[] = "motivo_rich_cig"; |
|
$availableDati[] = "cig_acc_quadro"; |
|
$availableDati[] = "durata_accquadro_convenzione_gara"; |
|
$availableDati[] = "escluso_avcpass"; |
|
$availableDati[] = "urgenza_dl133"; |
|
$availableDati[] = "estrema_urgenza"; |
|
$availableDati[] = "numero_lotti"; |
|
$availableDati[] = "strumento_svolgimento"; |
|
$availableDati[] = "id_f_delegate"; |
|
$availableDati[] = "cf_amm_agente_gara"; |
|
} |
|
|
|
$dati = []; |
|
if (!empty($this->info)) { $dati = json_decode($this->info["dati"],true); } |
|
foreach($availableDati AS $key) { |
|
if (isset($post["dati"][$key])) { |
|
$dati[$key] = $post["dati"][$key]; |
|
} else { |
|
$upper = strtoupper($key); |
|
if (isset($post["dati"][$upper])) { |
|
$dati[$key] = $post["dati"][$upper]; |
|
} else { |
|
$dati[$key] = ""; |
|
} |
|
} |
|
} |
|
$gara = []; |
|
$gara["codice"] = $post["codice"] ?? 0; |
|
$gara["codice_gestore"] = $_SESSION["ente"]->codice; |
|
$gara["codice_ente"] = $post["codice_ente"]; |
|
$gara["oggetto"] = $post["oggetto"]; |
|
$gara["smart_cig"] = $post["smart_cig"]; |
|
$gara["anno_riferimento"] = $post["anno_riferimento"]; |
|
$gara["dati"] = json_encode($dati); |
|
if ($gara["smart_cig"] == "S") { |
|
$lotto = $post["lotto"]; |
|
$dati["importo"] = $lotto["importo"]; |
|
$lotto["oggetto"] = $gara["oggetto"]; |
|
$lotto["cup"] = $post["cup"]; |
|
$lotto["id_scelta_contraente"] = $dati["codiceProceduraSceltaContraente"]; |
|
} |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_simog"; |
|
$salva->operazione = (empty($gara["codice"])) ? "INSERT" : "UPDATE"; |
|
$salva->oggetto = $gara; |
|
$codice = $salva->save(); |
|
if ($codice != false) { |
|
$error = false; |
|
$gara["codice"] = $codice; |
|
$this->info = $gara; |
|
if ($gara["smart_cig"] == "S") { |
|
$check = $this->saveLotto($lotto); |
|
if ($check["esito"]) { |
|
$return["esito"] = true; |
|
$return["codice"] = $codice; |
|
} else { |
|
$return["errori"] = $check["errori"]; |
|
} |
|
} else { |
|
$return["esito"] = true; |
|
$return["codice"] = $codice; |
|
} |
|
} else { |
|
$return["errori"][] = __("Errore nel salvataggio della gara"); |
|
} |
|
} else { |
|
$return["errori"][] = __("Errore nella richiesta"); |
|
} |
|
} else { |
|
$return["errori"][] = __("Ente non abilitato"); |
|
} |
|
} else { |
|
$return["errori"][] = __("Categorie Merceologiche è obbligatorio"); |
|
} |
|
} |
|
|
|
?>
|