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.
158 righe
6.6 KiB
158 righe
6.6 KiB
<?php |
|
|
|
$mode = $_REQUEST['action']; |
|
switch ($mode) { |
|
case "listNucleo": |
|
listNucleo(); |
|
break; |
|
case "addComponente": |
|
addComponente(); |
|
break; |
|
case "deleteComponente": |
|
deleteComponente(); |
|
break; //fine caso deleteComponente |
|
} |
|
|
|
function listNucleo() { |
|
global $LoggedAccount, $RAPPORTI_PARENTELA, $TIPOLOGIA_ESERCIZIO; |
|
if (!Utils::isStatoSportelloPreparazione()) { |
|
$response['erroreDescrizione'] = "Accesso non consentito (0)"; |
|
exit(json_encode($response)); |
|
} |
|
$draw = $_POST['draw']; |
|
$row = $_POST['start']; |
|
$rowperpage = $_POST['length']; // Rows display per page |
|
$columnIndex = $_POST['order'][0]['column']; // Column index |
|
$columnName = $_POST['columns'][$columnIndex]['data']; // Column name |
|
$columnSortOrder = $_POST['order'][0]['dir']; // asc or desc |
|
$searchValue = $_POST['search']['value']; // Search value |
|
$data = array(); |
|
$searchArray = array(); |
|
$searchQuery = ""; |
|
$resTot = AccountNucleoFamiliare::load(); |
|
$nr = 0; |
|
foreach ($resTot as $row) { |
|
$nr++; |
|
$btn = ''; |
|
if (Utils::isStatoSportelloPreparazione() && $row['CODICE_FISCALE'] != $LoggedAccount->CODICE_FISCALE) { |
|
$dataNascita = new DateTime($row['DATA_NASCITA']); |
|
$dataNascitaEng = $dataNascita->format("Y-m-d"); |
|
$row['DT_ENG'] = $dataNascitaEng; |
|
$idUtente = $row['ID']; |
|
$btn .= '<button class="btn btn-sm btn-warning" onclick="editComponente(\'' . $idUtente . '\');" alt="Aggiorna Utente" title="Aggiorna Utente"><i class="fas fa-edit"></i> Modifica</button> <button class="btn btn-sm btn-danger" onclick="deleteComponente(\'' . $row['ID'] . '\');" alt="Elimina Utente" title="Elimina"><i class="fas fa-trash"></i> Elimina</button>'; |
|
} |
|
$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'] = ("<b>" . $controlliDomanda['txt_dati_mancanti'] . "</b>"); |
|
} |
|
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)); |
|
}
|
|
|