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.
323 righe
14 KiB
323 righe
14 KiB
<?php |
|
|
|
/* |
|
* To change this license header, choose License Headers in Project Properties. |
|
* To change this template file, choose Tools | Templates |
|
* and open the template in the editor. |
|
*/ |
|
|
|
/** |
|
* Description of SchedaPersona |
|
* |
|
* @author Anselmo |
|
*/ |
|
class SchedaPersona { |
|
|
|
public $cognome = ''; |
|
public $nome = ''; |
|
public $sesso = ''; |
|
public $c_fiscale = ''; |
|
public $dt = ''; //data di nascita |
|
public $comune = ''; //comune di nascita |
|
public $provincia = ''; //provincia di nascita |
|
public $comune_residenza = ''; |
|
public $provincia_residenza = ''; |
|
public $indirizzo_residenza = ''; |
|
public $cap_residenza = ''; |
|
public $n_imprese_rappresentante = ''; |
|
public $imprese_persona = array(); |
|
|
|
public function __construct($objDOM = null) { |
|
global $con; |
|
if ($objDOM == null) |
|
return; |
|
if (is_object($objDOM)) { |
|
|
|
|
|
//Utils::print_array($objDOM);exit(); |
|
|
|
$nodePersona = $objDOM->getElementsByTagName("dati-identificativi-persona"); |
|
$nodePersonaNascita = $objDOM->getElementsByTagName("estremi-nascita"); |
|
$nodePersonaResidenza = $objDOM->getElementsByTagName("indirizzo"); |
|
//Utils::print_array($objDOM); |
|
//looping if tag config have more than one |
|
foreach ($nodePersona as $searchNode) { |
|
//$denominazione = $searchNode->getAttribute('denominazione'); |
|
$this->cognome = $searchNode->getAttribute('cognome'); |
|
$this->nome = $searchNode->getAttribute('nome'); |
|
$this->sesso = $searchNode->getAttribute('sesso'); |
|
$this->c_fiscale = $searchNode->getAttribute('c-fiscale'); |
|
} |
|
|
|
foreach($nodePersonaNascita as $searchnascita){ |
|
$this->dt=$searchnascita->getAttribute('dt'); |
|
$this->comune=$searchnascita->getAttribute('comune'); |
|
$this->provincia=$searchnascita->getAttribute('provincia'); |
|
} |
|
|
|
|
|
foreach($nodePersonaResidenza as $searchresidenza){ |
|
$this->comune_residenza=$searchresidenza->getAttribute('comune'); |
|
$this->provincia_residenza=$searchresidenza->getAttribute('provincia'); |
|
$this->cap_residenza=$searchresidenza->getAttribute('cap'); |
|
$this->indirizzo_residenza=$searchresidenza->getAttribute('toponimo')." ".$searchresidenza->getAttribute('via')." ".$searchresidenza->getAttribute('n-civico'); |
|
} |
|
|
|
|
|
$nodeImprese = $objDOM->getElementsByTagName("imprese-persona"); |
|
|
|
foreach ($nodeImprese as $searchNode) { |
|
$impresa = ImpresaPersona::List($searchNode); |
|
$this->imprese_persona = $impresa; |
|
$this->n_imprese_rappresentante = count($impresa); |
|
} |
|
//echo $i; |
|
|
|
} |
|
} |
|
|
|
public static function Load ($cfSPID = ""){ |
|
global $LoggedAccount; |
|
$return = array(); |
|
$options = array( |
|
'trace'=> 1, |
|
'exceptions'=> false, |
|
'cache_wsdl'=>WSDL_CACHE_NONE, |
|
'login'=> IC_WSDL_USR, |
|
'password'=> IC_WSDL_PSW |
|
|
|
); |
|
|
|
//$LoggedAccount->CODICE_FISCALE = 'BSSRNT54P18H501Q'; |
|
|
|
$client = new MySoapClient(IC_WSDL_URL, $options); |
|
if($cfSPID!=""){ |
|
$request = array( 'RichiestaSchedaPersonaCustom' => array('tipoServizio' => 'SCHEDA_RAPPR', 'codiceFiscalePersona' => $cfSPID)); |
|
}else{ |
|
$request = array( 'RichiestaSchedaPersonaCustom' => array('tipoServizio' => 'SCHEDA_RAPPR', 'codiceFiscalePersona' => $LoggedAccount->CODICE_FISCALE)); |
|
} |
|
|
|
|
|
try { |
|
$client->__soapCall('schedaPersonaCustom', $request); |
|
$response = $client->__getLastResponse(); |
|
//$response = str_replace("",'',$response); ///My Invalid Symbol |
|
//$response = str_ireplace(array('SOAP-ENV:','SOAP:'),'',$response); |
|
//$xml = new SimpleXMLElement($response); |
|
//echo htmlentities($response);exit(); |
|
|
|
$objDOM = new DOMDocument(); |
|
$objDOM->loadXML($response); |
|
|
|
$sp = new SchedaPersona($objDOM); |
|
|
|
//$return = Utils::ObjectToArray($sp); |
|
$return = $sp; |
|
|
|
|
|
} catch (Exception $exc) { |
|
echo $exc->getTraceAsString(); |
|
} |
|
|
|
return $return; |
|
} |
|
|
|
} |
|
|
|
|
|
class ImpresaPersona{ |
|
|
|
public $chiave_impresa = 0; |
|
public $denominazione = ''; |
|
public $c_fiscale = ''; |
|
public $n_rea = ''; |
|
public $provincia = ''; |
|
public $comune = ''; |
|
public $indirizzo = ''; |
|
public $cariche = array(); |
|
public $cluster_db = false; // campo per stabilire se il codice fiscale Azienda è idoneo a presentare la domanda |
|
public $in_domanda = false; // campo per controllare se l'impresa ha presentato una domanda |
|
public $stato_domanda = 0; // campo per controllare lo stato della domanda |
|
public $id_istanza = 0; // campo per identificare l'istanza presentata |
|
public $data_completamento = null; // campo per controllare lo stato della domanda |
|
public $gruppo_elenco_jquery = null; // campo utilizzato per il raggruppamento nelle liste delle aziende JQUERY |
|
|
|
|
|
public function __construct($objDOM = null) { |
|
global $con, $LoggedAccount; |
|
if ($objDOM == null) |
|
return; |
|
if (is_object($objDOM)) { |
|
|
|
$nodeImpresa = $objDOM->getElementsByTagName('impresa-persona'); |
|
foreach ($nodeImpresa as $s) { |
|
$this->chiave_impresa = $s->getAttribute('chiave-impresa'); |
|
$datiIdentificativiImpresa = $s->getElementsByTagName('dati-identificativi-impresa'); |
|
foreach ($datiIdentificativiImpresa as $d) { |
|
$this->denominazione = $d->getAttribute('denominazione'); |
|
$this->c_fiscale = $d->getAttribute('c-fiscale'); |
|
$domanda = Domanda::verificaPresenzaDomanda($LoggedAccount->CODICE_FISCALE, $d->getAttribute('c-fiscale')); |
|
if($domanda->ID > 0 && $domanda->VERSIONE == 0){ // VECCHIA DOMANDA INSERITA |
|
$this->stato_domanda = intval($domanda->STATO); |
|
$this->in_domanda = true;// |
|
$this->id_istanza = intval($domanda->ID);// |
|
$this->cluster_db = true; |
|
$this->data_completamento = ($domanda->DATA_COMPLETAMENTO != '' ? Utils::dateOracleTimeStamp($domanda->DATA_COMPLETAMENTO) : null) ; |
|
}else if($domanda->ID >0 && $domanda->VERSIONE == 1){ // NUOVA DOMANDA INSERITA |
|
$this->stato_domanda = intval($domanda->STATO); |
|
$this->in_domanda = false;// |
|
$this->id_istanza = intval($domanda->ID);// |
|
$this->cluster_db = true; |
|
$this->data_completamento = ($domanda->DATA_COMPLETAMENTO != '' ? Utils::dateOracleTimeStamp($domanda->DATA_COMPLETAMENTO) : null) ; |
|
}else { // NESSUNA DOMANDA INSERITA E CONTROLLO NEL CLUSTER DB LA PRESENZA DELL'IMPRESA |
|
$this->stato_domanda = 0; |
|
$this->in_domanda = false;// |
|
$this->cluster_db = ClusterDb::Exists($d->getAttribute('c-fiscale')); |
|
} |
|
$this->n_rea = $d->getAttribute('n-rea'); |
|
$indirizzoLocalizzazione = $d->getElementsByTagName('indirizzo-localizzazione'); |
|
foreach($indirizzoLocalizzazione as $ind){ |
|
$this->comune = $ind->getAttribute('comune'); |
|
$this->provincia = $ind->getAttribute('provincia'); |
|
$this->indirizzo = $ind->getAttribute('toponimo').' '.$ind->getAttribute('via').($ind->getAttribute('n-civico')!='' ? ' n. '.$ind->getAttribute('n-civico') : '').($ind->getAttribute('cap')!='' ? ' '.$ind->getAttribute('cap') : ''); |
|
} |
|
} |
|
$persona = $s->getElementsByTagName('persona'); |
|
foreach ($persona as $p){ |
|
$this->cariche = new ImpresaPersonaCariche($p); |
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
} |
|
public function List($objDOM = null){ |
|
global $LoggedAccount; |
|
$record = array(); |
|
$recordAmerigo=array(); |
|
|
|
if (is_object($objDOM)) { |
|
|
|
$nodeImpresa = $objDOM->getElementsByTagName('impresa-persona'); |
|
foreach ($nodeImpresa as $s) { |
|
$adesione=0; |
|
$preparazione=0; |
|
$nocluster=0; |
|
$impresa = new ImpresaPersona(); |
|
$impresa->chiave_impresa = $s->getAttribute('chiave-impresa'); |
|
$datiIdentificativiImpresa = $s->getElementsByTagName('dati-identificativi-impresa'); |
|
foreach ($datiIdentificativiImpresa as $d) { |
|
$impresa->denominazione = $d->getAttribute('denominazione'); |
|
$impresa->c_fiscale = $d->getAttribute('c-fiscale'); |
|
$domanda = Domanda::verificaPresenzaDomanda($LoggedAccount->CODICE_FISCALE, $d->getAttribute('c-fiscale')); |
|
if($domanda->ID > 0 && $domanda->VERSIONE == 0){ // VECCHIA DOMANDA INSERITA |
|
$adesione=1; |
|
$impresa->gruppo_elenco_jquery = 'adesione'; |
|
$impresa->stato_domanda = intval($domanda->STATO); |
|
$impresa->in_domanda = true;// |
|
$impresa->id_istanza = intval($domanda->ID);// |
|
$impresa->cluster_db = true; |
|
$impresa->data_completamento = ($domanda->DATA_COMPLETAMENTO != '' ? Utils::dateOracleTimeStamp($domanda->DATA_COMPLETAMENTO) : null) ; |
|
}else if($domanda->ID >0 && $domanda->VERSIONE == 1){ // NUOVA DOMANDA INSERITA |
|
$preparazione=1; |
|
$impresa->gruppo_elenco_jquery = 'preparazione'; |
|
$impresa->stato_domanda = intval($domanda->STATO); |
|
$impresa->in_domanda = false;// |
|
$impresa->id_istanza = intval($domanda->ID);// |
|
$impresa->cluster_db = true; |
|
$impresa->data_completamento = ($domanda->DATA_COMPLETAMENTO != '' ? Utils::dateOracleTimeStamp($domanda->DATA_COMPLETAMENTO) : null) ; |
|
}else { // NESSUNA DOMANDA INSERITA E CONTROLLO NEL CLUSTER DB LA PRESENZA DELL'IMPRESA |
|
$nocluster=1; |
|
$impresa->gruppo_elenco_jquery = 'nocluster'; |
|
$impresa->stato_domanda = 0; |
|
$impresa->in_domanda = false;// |
|
$impresa->cluster_db = ClusterDb::Exists($d->getAttribute('c-fiscale')); |
|
} |
|
$impresa->n_rea = $d->getAttribute('n-rea'); |
|
$indirizzoLocalizzazione = $d->getElementsByTagName('indirizzo-localizzazione'); |
|
foreach($indirizzoLocalizzazione as $ind){ |
|
$impresa->comune = $ind->getAttribute('comune'); |
|
$impresa->provincia = $ind->getAttribute('provincia'); |
|
$impresa->indirizzo = $ind->getAttribute('toponimo').' '.$ind->getAttribute('via').($ind->getAttribute('n-civico')!='' ? ' n. '.$ind->getAttribute('n-civico') : '').($ind->getAttribute('cap')!='' ? ' '.$ind->getAttribute('cap') : ''); |
|
} |
|
} |
|
$persona = $s->getElementsByTagName('persona'); |
|
foreach ($persona as $p){ |
|
$impresa->cariche = ImpresaPersonaCariche::List($p); |
|
} |
|
$record[] = $impresa; |
|
// if($adesione==1){ |
|
// $recordAmerigo['adesione'][]=$impresa; |
|
// }else if($preparazione==1){ |
|
// $recordAmerigo['preparazione'][]=$impresa; |
|
// }else if($nocluster==1){ |
|
// $recordAmerigo['nocluster'][]=$impresa; |
|
// } |
|
} |
|
|
|
} |
|
// return $recordAmerigo; |
|
return $record; |
|
} |
|
|
|
} |
|
|
|
class ImpresaPersonaCariche{ |
|
public $p_carica = ''; |
|
public $c_carica = ''; |
|
public $dt_atto_nomina = ''; |
|
public $c_durata = ''; |
|
public $descrizione_durata = ''; |
|
|
|
public function __construct($objDOM = null) { |
|
global $con; |
|
if ($objDOM == null) |
|
return; |
|
if (is_object($objDOM)) { |
|
|
|
$nodeCariche = $objDOM->getElementsByTagName('cariche'); |
|
foreach ($nodeCariche as $c) { |
|
$carica = $c->getElementsByTagName('carica'); |
|
foreach ($carica as $d) { |
|
$this->p_carica = $d->getAttribute('p-carica'); |
|
$this->c_carica = $d->getAttribute('c-carica'); |
|
$this->dt_atto_nomina = $d->getAttribute('c-carica'); |
|
$this->c_durata = $d->getAttribute('c-durata'); |
|
$this->descrizione_durata = $d->getAttribute('descrizione-durata'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
} |
|
} |
|
|
|
public function List($objDOM = null) { |
|
$record = array(); |
|
if (is_object($objDOM)) { |
|
|
|
$nodeCariche = $objDOM->getElementsByTagName('cariche'); |
|
foreach ($nodeCariche as $c) { |
|
$car = new ImpresaPersonaCariche(); |
|
$carica = $c->getElementsByTagName('carica'); |
|
foreach ($carica as $d) { |
|
$car->p_carica = $d->getAttribute('p-carica'); |
|
$car->c_carica = $d->getAttribute('c-carica'); |
|
$car->dt_atto_nomina = $d->getAttribute('c-carica'); |
|
$car->c_durata = $d->getAttribute('c-durata'); |
|
$car->descrizione_durata = $d->getAttribute('descrizione-durata'); |
|
|
|
} |
|
|
|
} |
|
$record[] = $car; |
|
|
|
|
|
} |
|
return $record; |
|
} |
|
|
|
}
|
|
|