getElementsByTagName("dati-identificativi"); foreach ($nodeImpresa as $searchNode) { $this->f_sede_intercamerale = $searchNode->getAttribute('f-sede-intercamerale'); $this->c_fonte = $searchNode->getAttribute('c-fonte'); $this->fonte = $searchNode->getAttribute('fonte'); $this->tipo_soggetto = $searchNode->getAttribute('tipo-soggetto'); $this->descrizione_tipo_soggetto = $searchNode->getAttribute('descrizione-tipo-soggetto'); $this->tipo_impresa = $searchNode->getAttribute('tipo-impresa'); $this->descrizione_tipo_impresa = $searchNode->getAttribute('tipo-soggetto'); $this->dt_iscrizione_ri = $searchNode->getAttribute('dt-iscrizione-ri'); $this->dt_atto_costituzione = $searchNode->getAttribute('dt-atto-costituzione'); $this->dt_ultimo_protocollo = $searchNode->getAttribute('dt-ultimo-protocollo'); $this->dt_mod_ultimo_protocollo_evaso = $searchNode->getAttribute('dt-mod-ultimo-protocollo-evaso'); $this->dt_caricamento_prot_iscrizione = $searchNode->getAttribute('dt-caricamento-prot-iscrizione'); $this->dt_caricamento = $searchNode->getAttribute('dt-caricamento'); $this->dt_ultima_modifica = $searchNode->getAttribute('dt-ultima-modifica'); $this->denominazione = $searchNode->getAttribute('denominazione'); $this->c_fiscale = $searchNode->getAttribute('c-fiscale'); $this->partita_iva = $searchNode->getAttribute('partita-iva'); $this->id_cciaa = $searchNode->getAttribute('id-cciaa'); $this->c_cciaa_competente = $searchNode->getAttribute('c-cciaa-competente'); $this->cciaa_competente = $searchNode->getAttribute('cciaa-competente'); $this->cciaa = $searchNode->getAttribute('cciaa'); $this->n_rea = $searchNode->getAttribute('n-rea'); $nodeStatoAttivita = $searchNode->getElementsByTagName("stato-attivita"); foreach ($nodeStatoAttivita as $n) { $this->c_stato_attivita = $n->getAttribute('c'); $this->stato_attivita = $n->nodeValue; } $nodeFormGiuridica = $searchNode->getElementsByTagName("forma-giuridica"); foreach ($nodeFormGiuridica as $f) { $this->forma_giuridica = $f->nodeValue; } $nodeIndirizzo = $searchNode->getElementsByTagName("indirizzo-localizzazione"); foreach ($nodeIndirizzo as $n) { $this->c_comune = $n->getAttribute('c-comune'); $this->comune = $n->getAttribute('comune'); $this->provincia = $n->getAttribute('provincia'); $this->c_toponimo = $n->getAttribute('c-toponimo'); $this->toponimo = $n->getAttribute('toponimo'); $this->via = $n->getAttribute('via'); $this->n_civico = $n->getAttribute('n-civico'); $this->cap = $n->getAttribute('cap'); $this->indirizzo = $n->getAttribute('toponimo') . ' ' . $n->getAttribute('via') . ($n->getAttribute('n-civico') != '' ? ' n. ' . $n->getAttribute('n-civico') : '') . ($n->getAttribute('cap') != '' ? ' cap. ' . $n->getAttribute('cap') : ''); } $nodePec = $searchNode->getElementsByTagName("indirizzo-posta-certificata"); foreach ($nodePec as $pec) { $this->indirizzo_posta_certificata = $pec->nodeValue; } // se l'impresa è in stato attiva si procede al controllo sulla presenza nel ClusterDB $this->cluster_db = ($this->c_stato_attivita == STATO_ATTIVITA_IMPRESA_CUSTOM ? ClusterDb::Exists($searchNode->getAttribute('c-fiscale')) : false); //$this->cluster_db = ClusterDb::Exists($searchNode->getAttribute('c-fiscale')); } $nodeAttivita = $objDOM->getElementsByTagName("sintesi-attivita"); foreach ($nodeAttivita as $at) { $nodeClassificazioneAteco = $at->getElementsByTagName("classificazione-ateco"); foreach ($nodeClassificazioneAteco as $ateco) { $this->c_attivita = $ateco->getAttribute('c-attivita'); } } $nodeAddetti = $objDOM->getElementsByTagName("addetti-r"); foreach ($nodeAddetti as $add) { $this->dt_addetti = $add->getAttribute('dt-addetti'); $this->anno = $add->getAttribute('anno'); $this->n_dipendenti = $add->getAttribute('n-dipendenti'); $this->n_indipendenti = $add->getAttribute('n-indipendenti'); $this->n_addetti = $add->getAttribute('n-addetti'); $this->cl = $add->getAttribute('cl'); } $nodeInfoAttivita = $objDOM->getElementsByTagName("info-attivita"); foreach ($nodeInfoAttivita as $info) { $this->dt_inizio_attivita_impresa = $info->getAttribute('dt-inizio-attivita-impresa'); $nodeEsercizio = $info->getElementsByTagName("attivita-esercitata"); foreach ($nodeEsercizio as $p) { $this->attivita_esercitata = $p->nodeValue; } } $sedi_ope = array(); $nodeSediOperative = $objDOM->getElementsByTagName("localizzazioni"); if (intval($nodeSediOperative->length) > 0) { foreach ($nodeSediOperative as $searchNode) { $sedi_ope = VisuraImpresaSediOperative::List($searchNode); //$this->sedi_operative = $sedi_operative; } } // else { // if(array_key_exists($this->provincia, $PROVINCE_SICILIA) || !ATTIVA_CONTROLO_PROVINCA){ // $sede_legale = array(); // $sedeL = new VisuraImpresaSediOperative(); // $sedeL->c_comune = $this->c_comune; // $sedeL->comune = $this->comune; // $sedeL->provincia = $this->provincia; // $sedeL->c_toponimo = $this->c_toponimo; // $sedeL->toponimo = $this->toponimo; // $sedeL->via = $this->via; // $sedeL->n_civico = $this->n_civico; // $sedeL->cap = $this->cap; // $sedeL->id_sedeoperativa = $sedeL->GetIdSedeOperativa(); // $sede_legale[] = $sedeL; // $this->sedi_operative = $sede_legale; // } // } $sede_legale = array(); if (array_key_exists($this->provincia, $PROVINCE_SICILIA) || !ATTIVA_CONTROLO_PROVINCA) { $sedeL = new VisuraImpresaSediOperative(); $sedeL->c_comune = $this->c_comune; $sedeL->dt_apertura = $this->dt_inizio_attivita_impresa; $sedeL->comune = $this->comune; $sedeL->provincia = $this->provincia; $sedeL->c_toponimo = $this->c_toponimo; $sedeL->toponimo = $this->toponimo; $sedeL->via = $this->via; $sedeL->n_civico = $this->n_civico; $sedeL->cap = $this->cap; $sedeL->id_sedeoperativa = $sedeL->GetIdSedeOperativa(); $k = $this->provincia . "-SEDELEGALE"; $sede_legale[$k] = $sedeL; //$sedi_ope = $sede_legale; } $sedi_operative = array_merge_recursive($sede_legale, $sedi_ope); $this->sedi_operative = $sedi_operative; } } public static function Load($partitaIva = null) { $return = array(); if ($partitaIva == null) return $return; $options = array( 'trace' => 1, 'exceptions' => false, 'cache_wsdl' => WSDL_CACHE_NONE, 'login' => IC_WSDL_USR, 'password' => IC_WSDL_PSW ); $client = new MySoapClient(IC_WSDL_URL, $options); $request = array('richiestaVisuraImpresaCustom' => array('tipoServizioStr' => 'VISURA_REGSIC', 'codiceFiscale' => $partitaIva)); try { $client->__soapCall('visuraImpresaCustom', $request); $response = $client->__getLastResponse(); //Utils::print_array($response);exit(); //$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); $vi = new VisuraImpresa($objDOM); $return = Utils::ObjectToArray($vi); } catch (Exception $exc) { echo $exc->getTraceAsString(); } return $return; } } class VisuraImpresaSediOperative { public $progressivo = ''; public $id_sedeoperativa = ''; public $c_tipo = ''; public $tipo = ''; public $dt_apertura = ''; public $c_comune = ''; public $comune = ''; public $provincia = ''; public $c_toponimo = ''; public $toponimo = ''; public $via = ''; public $n_civico = ''; public $cap = ''; public function __construct($objDOM = null) { global $con; if ($objDOM == null) return; if (is_object($objDOM)) { } } public function List($objDOM = null) { global $PROVINCE_SICILIA; $record = array(); if (is_object($objDOM)) { $nodeSede = $objDOM->getElementsByTagName('localizzazione'); if (intval($nodeSede->length) > 0) { foreach ($nodeSede as $s) { $sede = new VisuraImpresaSediOperative(); $sede->progressivo = $s->getAttribute('progressivo'); $sede->c_tipo = $s->getAttribute('c-tipo'); $sede->tipo = $s->getAttribute('tipo'); $sede->dt_apertura = $s->getAttribute('dt-apertura'); $nodeLocalizzazione = $s->getElementsByTagName('indirizzo-localizzazione'); foreach ($nodeLocalizzazione as $d) { $sede->c_comune = $d->getAttribute('c-comune'); $sede->comune = $d->getAttribute('comune'); $sede->provincia = $d->getAttribute('provincia'); $sede->c_toponimo = $d->getAttribute('c-toponimo'); $sede->toponimo = $d->getAttribute('toponimo'); $sede->via = $d->getAttribute('via'); $sede->n_civico = $d->getAttribute('c-civico'); $sede->cap = $d->getAttribute('cap'); } $sede->id_sedeoperativa = $sede->GetIdSedeOperativa(); if (array_key_exists($sede->provincia, $PROVINCE_SICILIA) || !ATTIVA_CONTROLO_PROVINCA){ $record[$sede->id_sedeoperativa] = $sede; } } } else { } } return $record; } public function GetIdSedeOperativa() { return $this->provincia . "-" . ($this->progressivo != '' ? $this->progressivo : 'SEDELEGALE'); } } class VisuraImpresaCustom extends DataClass { const TABLE_NAME = 'VISURA_IMPRESA_CUSTOM'; const SP_ = 'SPVISURASAVE'; public $PIVA_IMPRESA = ''; public $VIMPRESA = ''; public function __construct($src = null) { global $con; if ($src == null) return; if (is_array($src)) { if (isset($src['PIVA_IMPRESA']) && $src['PIVA_IMPRESA'] != "") { $this->_loadAndFillObject($src['PIVA_IMPRESA'], self::TABLE_NAME, $src); } else { $this->_loadByRow($src, $stripSlashes); } } else { $sql = "SELECT * FROM " . self::TABLE_NAME . " WHERE PIVA_IMPRESA = :id"; $query = $con->prepare($sql); $query->bindParam(":id", $src); try { $query->execute(); $it = $query->fetchAll(PDO::FETCH_ASSOC); $it[0]['VIMPRESA'] = stream_get_contents($it[0]['VIMPRESA']); Utils::FillObjectFromRow($this, $it[0]); //Utils::print_array($it); } catch (Exception $exc) { $exc->getMessage(); } } } public function Load($piva_impresa = "") { global $con; $where = ""; if (trim($piva_impresa) == "") { return array(); } $where .= ($where == "" ? "" : " AND ") . "PIVA_IMPRESA = :piva_impresa"; $sql = "SELECT * FROM " . self::TABLE_NAME; if ($where != "") $sql .= " WHERE $where"; $query = $con->prepare($sql); $query->bindParam(":piva_impresa", trim($piva_impresa)); try { $query->execute(); $it = $query->fetchAll(PDO::FETCH_ASSOC); $it[0]['VIMPRESA'] = stream_get_contents($it[0]['VIMPRESA']); } catch (Exception $exc) { $it['esito'] = -999; $it['descrizioneErrore'] = $exc->getMessage(); } return $it; } /** * Restituisce il valore della kyave specificata nella stringa json salvato * @param type $param * @return string */ public function getJsonVerbaleDati($param = '') { if ($param == "") return ''; $arrayDati = json_decode($this->VIMPRESA); //Utils::print_array($arrayDati); return $arrayDati->{$param}; } public function Save() { global $con; $vars = get_object_vars($this); $sql = "CALL " . self::SP_ . " (?,?)"; $query = $con->prepare($sql); $query->bindParam(1, $this->PIVA_IMPRESA); $query->bindParam(2, $this->VIMPRESA, PDO::PARAM_STR, strlen($this->VIMPRESA)); try { $it = $query->execute(); } catch (Exception $exc) { $it['descrizioneErrore'] = $exc->getMessage(); } return $it; } }