$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"])) {
?>
} 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"));
?>
| # |
= __("Riferimento") ?> |
= __("Campo") ?> |
= __("Errore") ?> |
$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]) . "
{$cui}";
}
} else {
$label = $infoErrore[0];
}
}
?>
| = $count ?> |
= $label ?>
|
= $campo ?? "" ?> |
= $msg["messaggio"] ?> |
}
?>
} 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();
}
?>