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.5 KiB
108 righe
4.5 KiB
<? |
|
$error = true; |
|
$configPath = substr(__DIR__, 0, strpos(__DIR__, "public_html")) . "/config.php"; |
|
include_once($configPath); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission('progetti') && $_SESSION["utente"]->permission('cpn') && tokenVerify($_GET["token"]) && !empty($_GET["codice"])) { |
|
$programma = Programma::init($_GET["codice"]); |
|
if (!empty($programma)) { |
|
$error = false; |
|
$dati = $programma->getRequestCPN(); |
|
if (!empty($dati)) { |
|
if (empty($_SESSION["cpn"]["token"])) { |
|
?> |
|
<script> |
|
modalURL = []; |
|
<? $action = base64_encode("/backend/progetti/programmazione/cpn/send.php?".http_build_query($_GET)); ?> |
|
showModalWithURL('/backend/common/cpn/views/login.php?codice_ente=<?= $programma->info["codice_ente"] ?>&action=<?= $action ?>'); |
|
</script> |
|
<? |
|
} else { |
|
$cpn = new cpn($programma->info["codice_ente"],"b_programmi_art21",$programma->info["codice"]); |
|
$cpn->debug = false; |
|
$esito = $cpn->inviaProgramma($programma->info["tipologia"],($_GET["modalita"]==="2")?2:1,$dati); |
|
if (!empty($esito)) { |
|
$stato_cpn = 50; |
|
$id_cpn = $programma->info["invio_cpn"]; |
|
if (!empty($esito["validate"])) { |
|
$stato = |
|
$getPjt = $pdo->prepare("SELECT codice FROM b_progetti WHERE cui = :cui"); |
|
alertManager::printWarningBox(__("Si sono verificati degli errori di validazione")); |
|
?> |
|
<table class="table table-striped table-condensed table-hover"> |
|
<thead> |
|
<tr> |
|
<th>#</th> |
|
<th><?= __("Riferimento") ?></th> |
|
<th><?= __("Campo") ?></th> |
|
<th><?= __("Errore") ?></th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<? |
|
$count = 0; |
|
foreach($esito["validate"] AS $msg) { |
|
$count++; |
|
$label = $msg["nome"]; |
|
$infoErrore = explode(".",$msg["nome"]); |
|
$campo = null; |
|
$matches = []; |
|
if (count($infoErrore) > 1) { |
|
$campo = $infoErrore[1]; |
|
preg_match('/(.*)([A|L|F|S]{1}[0-9]*)$/',$infoErrore[0],$matches); |
|
if (!empty($matches[2])) { |
|
$cui = $matches[2]; |
|
$getPjt->bindValue(":cui",$cui); |
|
$getPjt->execute(); |
|
if ($getPjt->rowCount() === 1) { |
|
$pgt = $getPjt->fetch(PDO::FETCH_ASSOC); |
|
$label = ucfirst($matches[1]) . "<br><a target=\"_blank\" href=\"/backend/progetti/panel.php?codice={$pgt["codice"]}\">{$cui}</a>"; |
|
} |
|
} else { |
|
$label = $infoErrore[0]; |
|
} |
|
} |
|
?> |
|
<tr> |
|
<td><?= $count ?></td> |
|
<td> |
|
<?= $label ?> |
|
</td> |
|
<td><?= $campo ?? "" ?></td> |
|
<td><?= $msg["messaggio"] ?></td> |
|
</tr> |
|
<? |
|
} |
|
?> |
|
</tbody> |
|
</table> |
|
<? |
|
} else { |
|
if (!empty($esito["error"])) { |
|
alertManager::printWarningBox($esito["error"]); |
|
} else { |
|
alertManager::printSuccessBox(__("Operazione eseguita con successo")); |
|
if (($_GET["modalita"]==="2")) { |
|
$stato_cpn = 100; |
|
} |
|
} |
|
if (!empty($esito["id"])) { |
|
$id_cpn = $esito["id"]; |
|
} |
|
} |
|
$pdo->go("UPDATE b_programmi_art21 SET stato_cpn = :stato, invio_cpn = :id_cpn WHERE codice = :codice",[":stato"=>$stato_cpn,":id_cpn"=>$id_cpn,":codice"=>$programma->info["codice"]]); |
|
scriviLog("b_programmi_art21","UPDATE",$pdo->getSQL(),$programma->info["codice"]); |
|
$programma->updateStato(); |
|
} else { |
|
alertManager::printAlertBox(__("Errore generico nella trasmissione")); |
|
} |
|
} |
|
} else { |
|
alertManager::printAlertBox(__("Errore nell'elaborazione della richiesta")); |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|