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.
93 righe
3.2 KiB
93 righe
3.2 KiB
<? |
|
$return = ["esito"=>false,"codice"=>0,"errori"=>[]]; |
|
if (isset($this) && is_a($this,"anac") && isset($post["dati"])) { |
|
$allegati = true; |
|
$types = ["bando","disciplinare"]; |
|
|
|
foreach($types AS $type) { |
|
if (isset($post["allegato-{$type}"])) { |
|
if (count($post["allegato-{$type}"]) === 1) { |
|
$files = filesManager::listFiles($this->info["codice"],"anac-{$type}"); |
|
if (!empty($files)) { |
|
foreach($files AS $file) { |
|
filesManager::deleteFile($file["codice"],"anac-{$type}"); |
|
} |
|
} |
|
foreach($post["allegato-{$type}"] as $allegato) { |
|
$ext = explode(".",$allegato["filename"]); |
|
$ext = end($ext); |
|
if ($ext == "pdf" || $ext == "PDF") { |
|
if (filesManager::saveFile($allegato["filename"],$this->info["codice"],"anac-{$type}",$allegato["nome"] ?? "","A",$allegato["classificazione"] ?? "") === false) { |
|
$errori_upload[] = $allegato["filename"]; |
|
} |
|
} else { |
|
break; |
|
$allegati = false; |
|
} |
|
} |
|
} else { |
|
break; |
|
$allegati = false; |
|
} |
|
} |
|
} |
|
if ($allegati) { |
|
$availableDati = []; |
|
$availableDati[] = "dataPubblicazione"; |
|
$availableDati[] = "dataScadenzaPag"; |
|
$availableDati[] = "oraScadenza"; |
|
$availableDati[] = "dataScadenzaRichiestaInvito"; |
|
$availableDati[] = "dataLetteraInvito"; |
|
$availableDati[] = "DATA_ALBO"; |
|
$availableDati[] = "QUOTIDIANI_NAZ"; |
|
$availableDati[] = "QUOTIDIANI_REG"; |
|
$availableDati[] = "PERIODICI"; |
|
$availableDati[] = "LINK_SITO"; |
|
$availableDati[] = "SITO_MINISTERO_INF_TRASP"; |
|
$availableDati[] = "SITO_OSSERVATORIO_CP"; |
|
$availableDati[] = "DATA_GUCE"; |
|
$availableDati[] = "NUMERO_GUCE"; |
|
$availableDati[] = "DATA_GURI"; |
|
$availableDati[] = "NUMERO_GURI"; |
|
$availableDati[] = "DATA_BORE"; |
|
$availableDati[] = "NUMERO_BORE"; |
|
$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"]; |
|
$gara["dati"] = json_encode($dati); |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_simog"; |
|
$salva->operazione = "UPDATE"; |
|
$salva->oggetto = $gara; |
|
$codice = $salva->save(); |
|
if ($codice != false) { |
|
$error = false; |
|
$gara["codice"] = $codice; |
|
$this->info["dati"] = $gara["dati"]; |
|
$return["esito"] = true; |
|
$return["codice"] = $codice; |
|
} else { |
|
$return["errori"][] = __("Errore nel salvataggio della gara"); |
|
} |
|
} else { |
|
$return["errori"][] = __("Seleziona solo un allegato di tipo PDF per tipologia"); |
|
} |
|
} else { |
|
$return["errori"][] = __("Errore nella richiesta"); |
|
} |
|
?>
|