CODICE_FISCALE) {
$dataNascita = new DateTime($row['DATA_NASCITA']);
$dataNascitaEng = $dataNascita->format("Y-m-d");
$row['DT_ENG'] = $dataNascitaEng;
$idUtente = $row['ID'];
$btn .= ' ';
}
$data[] = array(
"NR" => $nr,
"ID" => $row['ID'],
"NOMINATIVO" => $row['COGNOME'] . " " . $row['NOME'],
"CODICE_FISCALE" => $row['CODICE_FISCALE'],
"DATA_NASCITA" => Date::dateOracleDateNascita($row['DATA_NASCITA']),
"RESIDENZA" => $row['COMUNE_RESIDENZA'] . " (" . $row['PROV_RESIDENZA'] . "), " . $row['CAP_RESIDENZA'],
// "RAPPORTO_PARENTELA" => $RAPPORTI_PARENTELA[$row['RAPPORTO_PARENTELA']],
"DISABILE" => Utils::isDisable($row['FLAG']) == 1 ? "SI" : "NO",
"STUDENTE" => Utils::isStudente($row['FLAG']) == 1 ? "SI" : "NO",
"OP" => $btn
);
}
## Response
$response = array(
"draw" => intval($draw),
"iTotalRecords" => count($resTot),
"iTotalDisplayRecords" => count($resTot),
"aaData" => $data
);
exit(json_encode($response));
}
function addComponente() {
global $LoggedAccount, $con;
$response = Utils::initDefaultResponse(-999, '');
if (!Utils::isStatoSportelloPreparazione()) {
$response['erroreDescrizione'] = "Accesso non consentito (0)";
exit(json_encode($response));
}
$transaction = false;
$con->db_transactionStart();
if (intval($_POST['ID']) > 0) {
$dettaglio = new AccountNucleoFamiliare(intval($_POST['ID']));
if ($dettaglio->ID_ACCOUNT == $LoggedAccount->ID) {
AccountNucleoFamiliare::checkVerificaDatiPreSalvataggio();
Utils::FillObjectFromRow($dettaglio, $_POST);
} else {
$return['erroreDescrizione'] = "Salvataggio non consentito";
exit(json_encode($return));
}
} else {
AccountNucleoFamiliare::checkVerificaDatiPreSalvataggio();
$dettaglio = new AccountNucleoFamiliare($_POST);
}
$dettaglio->CONFERMATO = 1;
if ($dettaglio->STUDENTE == 1 || $dettaglio->FLAG == 1) {
$dettaglio->PRIORITY = 1;
} else {
$dettaglio->PRIORITY = 0;
}
$dettaglio->DISABILE = $dettaglio->FLAG;
$dettaglio->FLAG = Utils::EncryptString($dettaglio->CODICE_FISCALE . "-" . $dettaglio->FLAG . "-" . $dettaglio->STUDENTE);
$controlliDomanda = $dettaglio->checkDatiPreSave();
if ($controlliDomanda['checkDati']) {
$response = $dettaglio->Save();
if ($response['esito'] == 1) {
$transaction = true;
}
} else {
$response['erroreDescrizione'] = ("" . $controlliDomanda['txt_dati_mancanti'] . "");
}
if ($transaction) {
$response['esito'] = 1;
$con->db_transactionCommit();
} else {
$response['erroreDescrizione'] = ($response['erroreDescrizione'] != "" ? $response['erroreDescrizione'] : "Attenzione , riprovare o contattare il Personale Tecnico");
$con->db_transactionRollback();
}
exit(json_encode($response));
}
function deleteComponente() {
global $con, $LoggedAccount;
$response = Utils::initDefaultResponse();
if (!Utils::isStatoSportelloPreparazione()) {
$response['erroreDescrizione'] = "Accesso non consentito (0)";
exit(json_encode($response));
}
$transaction = false;
if (isset($_POST["id"]) && intval($_POST["id"]) > 0) {
$dettaglio = new AccountNucleoFamiliare(intval($_POST["id"]));
if ($LoggedAccount->ID == $dettaglio->ID_ACCOUNT && $dettaglio->RAPPORTO_PARENTELA != RAPPORTO_PARENTELA_DEFAULT) {
/*CONTROLLO SE IL CODICE FISCALE DEL MINORE HA DELLE DOMANDE CON STATO >0*/
$controlloDomandeMinore = DomandaSconti::controlloMinoreCancellabile($dettaglio->CODICE_FISCALE);
/*SE L'UTENTE HA DOMANDE CON STATO >0 NON PUò ESSERE CANCELLATO*/
if ($controlloDomandeMinore['esito'] == 1 && $controlloDomandeMinore['NUM_DOMANDE'] == 0) {
$con->db_transactionStart();
$response = $dettaglio->Delete();
if ($response['esito'] == 1) {
$transaction = true;
}
if ($transaction) {
$response['esito'] = 1;
//$response['domanda'] = $domanda->ID;
$con->db_transactionCommit();
} else {
$response['erroreDescrizione'] = ($response['erroreDescrizione'] != "" ? $response['erroreDescrizione'] : "Attenzione , riprovare o contattare il Personale Tecnico");
$con->db_transactionRollback();
}
} else {
$response['erroreDescrizione'] = "L'utente che si vuole cancellare ha già delle domande in lavorazione. Non è possibile procedere alla cancellazione.";
}
} else {
$response['erroreDescrizione'] = 'Operazione non consentita in questa fase';
}
}
exit(json_encode($response));
}