$domanda->ID_ACCOUNT, ); $resTot = AccountNucleoFamiliare::load(-1); //$resConfermati = AccountNucleoFamiliare::load(0); $resConfermati = 0; $nr = 0; foreach ($resTot as $row) { $nr++; $btn = ''; if(intval($row['CONFERMATO'])==0){ $resConfermati++; } if ($domanda->STATO == STATO_DOMANDA_IN_PREPARAZIONE && Utils::isStatoSportelloPreparazione() && $row['CODICE_FISCALE'] != $LoggedAccount->CODICE_FISCALE) { $dataNascita = new DateTime($row['DATA_NASCITA']); $dataNascitaEng = $dataNascita->format("Y-m-d"); $row['DT_ENG'] = $dataNascitaEng; $btn .= '  '; } // $btn = '';//da rimuovere se voglio generare i bottoni lato server $data[] = array( "NR" => $nr, "ID" => $row['ID'], "COGNOME" => $row['COGNOME'], "NOME" => $row['NOME'], "CODICE_FISCALE" => $row['CODICE_FISCALE'], "DATA_NASCITA" => Date::dateOracleDate($row['DATA_NASCITA']), "COMUNE_NASCITA" => $row['COMUNE_NASCITA'], "RAPPORTO_PARENTELA" => $RAPPORTI_PARENTELA[$row['RAPPORTO_PARENTELA']], "OP" => $btn ); } ## Response $response = array( "draw" => intval($draw), "iTotalRecords" => count($resTot), "iTotalDisplayRecords" => count($resTot), "countConfermati" => ($resConfermati >= 1 ? 1 : $resConfermati), "aaData" => $data ); exit(json_encode($response)); } function confirmNucleo() { global $LoggedAccount, $con; if (!Utils::isStatoSportelloPreparazione()) { $return['erroreDescrizione'] = "Accesso non consentito (0)"; exit(json_encode($return)); } $return = Utils::initDefaultResponse(); $transaction = false; $con->db_transactionStart(); $return = AccountNucleoFamiliare::setConfermatoForAccount(); if ($return['esito'] == 1) { $transaction = true; } if ($transaction) { $return['esito'] = 1; $con->db_transactionCommit(); } else { $return['erroreDescrizione'] = ($return['erroreDescrizione'] != "" ? $return['erroreDescrizione'] : "Attenzione , riprovare o contattare il Personale Tecnico"); $con->db_transactionRollback(); } exit(json_encode($return)); } 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; $controlliDomanda = $dettaglio->checkDatiPreSave(); if ($controlliDomanda['checkDati']) { $confermoTutti = AccountNucleoFamiliare::setConfermatoForAccount(); if ($confermoTutti['esito'] == 1) { $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"])) { $dettaglio = new AccountNucleoFamiliare($_POST["id"]); $domanda = Domanda::loadDomandaFromAccount(); if ($domanda->ID > 0) { if ($domanda->STATO < STATO_DOMANDA_PRESENTATA) { $controlloDomanda = true; } } else { $controlloDomanda = true; } if ($controlloDomanda && $LoggedAccount->ID == $dettaglio->ID_ACCOUNT && $dettaglio->RAPPORTO_PARENTELA != RAPPORTO_PARENTELA_DEFAULT) { $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'] = 'Operazione non consentita in questa fase'; } } exit(json_encode($response)); }