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.
126 righe
4.8 KiB
126 righe
4.8 KiB
<? |
|
if (isset($this) && is_a($this,"anac")) { |
|
$lotto = $this->getLotti($codice_lotto)[0] ?? NULL; |
|
if (!empty($lotto["codice"]) && !empty($lotto["cig"])) { |
|
$lotto["dati"] = json_decode(($lotto["dati"]),true); |
|
$datiSimog = $this->getDati(); |
|
$simogMethod = "loaderAppalto"; |
|
if ($operation == "get") { |
|
$schede = []; |
|
$appaltoType = anac::getAppaloType($lotto); |
|
if (!empty($appaltoType)) { |
|
$delete = null; |
|
$tmp = $this->getSchede($lotto["codice"]); |
|
if (!empty($tmp)) { |
|
foreach($tmp AS $scheda) { |
|
if ($scheda["stato"] === "97") { |
|
$delete = $scheda; |
|
break; |
|
} |
|
} |
|
} |
|
if (!empty($delete)) { |
|
|
|
$return = []; |
|
$return["method"] = $simogMethod; |
|
$return["data"] = []; |
|
|
|
$data["InfoTrasferimento"] = ["DATA_CREAZIONE_FLUSSO"=>date("Y-m-d H:i:s"),"NUM_SCHEDE"=>1]; |
|
$tipologia = $this->listSchede($lotto["codice"])[$delete["tipologia"]]; |
|
$cui = $this->getLastCUI($lotto["codice"],true); |
|
$array = []; |
|
$array["SCHEDA"] = strtoupper($tipologia["delete"]); |
|
if ($array["SCHEDA"] == "#APPALTOTYPE#") { |
|
$array["SCHEDA"] = strtoupper($appaltoType); |
|
} |
|
$array["CIG"] = $lotto["cig"]; |
|
$array["CUI"] = $cui; |
|
$array["ID_SCHEDA_SIMOG"] = $delete["response_id"]; |
|
$data["SchedeEliminate"] = [$array]; |
|
$data = convertDate_DbDateSimog($data); |
|
$return["data"] = ["trasferimentoDati" => $data]; |
|
} else { |
|
$errors = __("Nessuna scheda da eliminare"); |
|
} |
|
} else { |
|
$errors = __("Impossibile riconoscere il tipo di appalto"); |
|
} |
|
} else if ($operation == "put" && !empty($response)) { |
|
$errori = 0; |
|
$warning = 0; |
|
$success = 0; |
|
$anomalie = []; |
|
$updateInfo = []; |
|
$updateScheda = $this->db->prepare("UPDATE b_simog_schede SET stato = :stato WHERE response_id = :response_id AND codice NOT IN (SELECT codice_padre FROM b_simog_schede)"); |
|
foreach($response AS $resp) { |
|
if (!empty($resp->return->feedBack)) { |
|
$feedback = $resp->return->feedBack; |
|
if (!empty($feedback->AnomalieSchede)) { |
|
if (!is_array($feedback->AnomalieSchede)) { $feedback->AnomalieSchede = [$feedback->AnomalieSchede]; } |
|
$idSchedeFeedback = []; |
|
$anomalieFeedback = []; |
|
$anomalie = []; |
|
foreach($feedback->AnomalieSchede AS $anomalieSchede) { |
|
if (!empty($anomalieSchede->IdScheda)) { |
|
if (!is_array($anomalieSchede->IdScheda)) { |
|
$idSchedeFeedback = [$anomalieSchede->IdScheda]; |
|
} else { |
|
$idSchedeFeedback = $anomalieSchede->IdScheda; |
|
} |
|
} |
|
if (!empty($anomalieSchede->Anomalia)) { |
|
if (!is_array($anomalieSchede->Anomalia)) { |
|
$anomalieFeedback = [$anomalieSchede->Anomalia]; |
|
} else { |
|
$anomalieFeedback = $anomalieSchede->Anomalia; |
|
} |
|
} |
|
if (!empty($anomalieFeedback)) { |
|
foreach($anomalieFeedback as $anomalia) { |
|
$anomalie[] = $anomalia; |
|
} |
|
} |
|
} |
|
foreach($idSchedeFeedback as $idScheda) { |
|
if (!empty($idScheda->ID_SCHEDA_SIMOG)) { |
|
if (!isset($updateInfo[$idScheda->ID_SCHEDA_SIMOG])) { $updateInfo[$idScheda->ID_SCHEDA_SIMOG] = 98; } |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (!empty($updateInfo)) { |
|
foreach($updateInfo AS $idSIMOG => $otherInfo) { |
|
$updateScheda->bindValue(":stato",$otherInfo); |
|
$updateScheda->bindValue(":response_id",$idSIMOG); |
|
$updateScheda->execute(); |
|
} |
|
$return = true; |
|
} |
|
if (!empty($anomalie)) { ?> |
|
<table class="table table-striped"> |
|
<? foreach($anomalie AS $anomalia) { ?> |
|
<tr> |
|
<td><?= $anomalia->SCHEDA ?></td> |
|
<td><?= $anomalia->DESCRIZIONE ?></td> |
|
</tr> |
|
<? } ?> |
|
</table> |
|
<? |
|
} 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); |
|
} |
|
} |
|
?>
|