protected function load_data() { $this->rs_parkauto = array(); if (!$this->nid) { return; } $result = array(); $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'parkauto')->propertyCondition('status', 1)->propertyCondition('nid', $this->nid)->addMetaData('account', user_load(1)); $qryres = $query->execute(); if (isset($qryres['node'])) { $items_nids = array_keys($qryres['node']); $items = entity_load('node', $items_nids); foreach ($items as $nodo => $elem) { $result['nid'] = $nodo; $result['rc_sito_parking'] = $elem->field_p_sito_parking[LANGUAGE_NONE][0]['nid']; $result['rc_p_online'] = $elem->field_p_online[LANGUAGE_NONE][0]['value']; $result['rc_uid_registrazione'] = $elem->field_p_uid_registrazione[LANGUAGE_NONE][0]['uid']; $result['rc_uid_walkin'] = $elem->field_p_uid_walkin[LANGUAGE_NONE][0]['uid']; $result['rc_uid_walkout'] = $elem->field_p_uid_walkout[LANGUAGE_NONE][0]['uid']; $result['rc_uid_walkout_closed'] = $elem->field_p_uid_walkout_closed[LANGUAGE_NONE][0]['uid']; $result['rc_dtreg_dttm_registrazione'] = DrupalDateTimeToDateTime($elem->field_p_dtreg_registrazione[LANGUAGE_NONE][0]['value']); $result['rc_dtreg_stddt_registrazione'] = DrupalDateTimeToDateTime($elem->field_p_dtreg_registrazione[LANGUAGE_NONE][0]['value']); $result['rc_dtreg_dttm_walkin'] = DrupalDateTimeToDateTime($elem->field_p_dtreg_walkin[LANGUAGE_NONE][0]['value']); $result['rc_dtreg_stddt_walkin'] = DrupalDateTimeToDateTime($elem->field_p_dtreg_walkin[LANGUAGE_NONE][0]['value']); $result['rc_dtreg_dttm_walkout'] = DrupalDateTimeToDateTime($elem->field_p_dtreg_walkout[LANGUAGE_NONE][0]['value']); $result['rc_dtreg_stddt_walkout'] = DrupalDateTimeToDateTime($elem->field_p_dtreg_walkout[LANGUAGE_NONE][0]['value']); $result['rc_dtreg_dttm_walkout_closed'] = DrupalDateTimeToDateTime($elem->field_p_dtreg_walkout_closed[LANGUAGE_NONE][0]['value']); $result['rc_dtreg_stddt_walkout_closed'] = DrupalDateTimeToDateTime($elem->field_p_dtreg_walkout_closed[LANGUAGE_NONE][0]['value']); $result['rc_stato_parking'] = $elem->field_p_stato_parking[LANGUAGE_NONE][0]['value']; $result['rc_rif_barcode'] = $elem->field_p_rif_barcode[LANGUAGE_NONE][0]['value']; $result['rc_dt_checkin_checkout_in'] = DrupalDateToDate($elem->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['value']); $result['rc_tm_checkin_checkout_in'] = DrupalTimeToTime($elem->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['value'], "H:i"); $result['rc_dt_checkin_checkout_out'] = DrupalDateToDate($elem->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['value2']); $result['rc_tm_checkin_checkout_out'] = DrupalTimeToTime($elem->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['value2'], "H:i"); $rs_data = ListinoBase::get_data_from_nid($elem->field_p_tipo_parcheggio[LANGUAGE_NONE][0]['nid']); $result['rc_tipo_parcheggio'] = $rs_data['field_p_tipo_parcheggio']; $result['rc_azienda'] = $elem->field_p_azienda[LANGUAGE_NONE][0]['value']; $result['rc_azienda_indirizzo'] = $elem->field_p_azienda_indirizzo[LANGUAGE_NONE][0]['value']; $result['rc_azienda_city'] = $elem->field_p_azienda_city[LANGUAGE_NONE][0]['value']; $result['rc_azienda_piva'] = $elem->field_p_azienda_piva[LANGUAGE_NONE][0]['value']; $result['rc_nome_cliente'] = $elem->field_p_nome_cliente[LANGUAGE_NONE][0]['value']; $result['rc_cognome_cliente'] = $elem->field_p_cognome_cliente[LANGUAGE_NONE][0]['value']; $result['rc_ritira_auto'] = $elem->field_p_ritira_auto[LANGUAGE_NONE][0]['value']; $result['rc_email_cliente'] = $elem->field_p_email_cliente[LANGUAGE_NONE][0]['value']; $result['rc_nr_telefono_cliente'] = $elem->field_p_nr_telefono_cliente[LANGUAGE_NONE][0]['value']; $result['rc_targa_auto_cliente'] = $elem->field_p_targa_auto_cliente[LANGUAGE_NONE][0]['value']; $result['rc_modello_auto_cliente'] = $elem->field_p_modello_auto_cliente[LANGUAGE_NONE][0]['value']; $result['rc_marca_auto_cliente'] = $elem->field_p_marca_auto_cliente[LANGUAGE_NONE][0]['value']; $result['rc_nr_passeggeri_cliente'] = $elem->field_p_nr_passeggeri_cliente[LANGUAGE_NONE][0]['value']; $result['rc_tipo_cliente'] = $elem->field_p_tipo_cliente[LANGUAGE_NONE][0]['nid']; $result['rc_tp_veicolo_cliente'] = $elem->field_p_tp_veicolo_cliente[LANGUAGE_NONE][0]['nid']; $result['rc_tp_gestione_chiavi'] = $elem->field_p_tp_gestione_chiavi[LANGUAGE_NONE][0]['value']; $result['rc_note_interne'] = $elem->field_p_note_interne[LANGUAGE_NONE][0]['value']; $result['rc_note_prenotazione'] = $elem->field_p_note_prenotazione[LANGUAGE_NONE][0]['value']; $result['rc_zona_parcheggio_auto'] = $elem->field_p_zona_parcheggio_auto[LANGUAGE_NONE][0]['value']; $result['rc_cd_volo_cliente'] = $elem->field_p_cd_volo_cliente[LANGUAGE_NONE][0]['value']; $result['rc_nr_terminal_cliente'] = $elem->field_p_nr_terminal_cliente[LANGUAGE_NONE][0]['value']; $result['rc_provenienza_cliente'] = $elem->field_p_provenienza_cliente[LANGUAGE_NONE][0]['value']; $pagamentoCliente = new PagamentoCliente(); $pagamentoCliente->load_data(array('nid_parkauto' => $result['nid'])); $result['pag_cliente'] = $pagamentoCliente->get_lista(); $result['rc_dt_walkin'] = DrupalDateToDate($elem->field_p_dt_walkin[LANGUAGE_NONE][0]['value']); $result['rc_tm_walkin'] = DrupalTimeToTime($elem->field_p_dt_walkin[LANGUAGE_NONE][0]['value'], "H:i"); $result['rc_dt_walkout_prevista'] = DrupalDateToDate($elem->field_p_dt_walkout_prevista[LANGUAGE_NONE][0]['value']); $result['rc_tm_walkout_prevista'] = DrupalTimeToTime($elem->field_p_dt_walkout_prevista[LANGUAGE_NONE][0]['value'], "H:i"); $result['rc_dt_walkout'] = DrupalDateToDate($elem->field_p_dt_walkout[LANGUAGE_NONE][0]['value']); $result['rc_tm_walkout'] = DrupalTimeToTime($elem->field_p_dt_walkout[LANGUAGE_NONE][0]['value'], "H:i"); $result['rc_valore_sct_mag'] = $elem->field_p_valore_sct_mag[LANGUAGE_NONE][0]['value']; $result['rc_tipo_sct_mag'] = $elem->field_p_tipo_sct_mag[LANGUAGE_NONE][0]['value']; $result['rc_tp_sct_mag_v_p'] = $elem->field_p_tp_sct_mag_v_p[LANGUAGE_NONE][0]['value']; $result['rc_motivazione_sct_mag'] = $elem->field_p_motivazione_sct_mag[LANGUAGE_NONE][0]['value']; $result['rc_tp_doc_fiscale'] = $elem->field_p_tp_doc_fiscale[LANGUAGE_NONE][0]['value']; $result['rc_dt_walkout'] = DrupalDateToDate($elem->field_p_dt_walkout[LANGUAGE_NONE][0]['value']); $result['rc_tm_walkout'] = DrupalTimeToTime($elem->field_p_dt_walkout[LANGUAGE_NONE][0]['value'], "H:i"); $result['rc_imp_totale_pagato'] = $elem->field_p_imp_totale_pagato[LANGUAGE_NONE][0]['value']; $result['rc_imp_totale_dovuto'] = $elem->field_p_imp_totale_dovuto[LANGUAGE_NONE][0]['value']; $result['rc_totale_nr_giorni'] = $elem->field_p_totale_nr_giorni[LANGUAGE_NONE][0]['value']; $result['rc_imp_totale_residuo'] = $elem->field_p_imp_totale_residuo[LANGUAGE_NONE][0]['value']; // $result['rc_dt_rif_checkin_checkout_in'] = DrupalDateToDate($elem->field_p_dt_rif_checkin_checkout[LANGUAGE_NONE][0]['value']); $result['rc_tm_rif_checkin_checkout_in'] = DrupalTimeToTime($elem->field_p_dt_rif_checkin_checkout[LANGUAGE_NONE][0]['value'], "H:i"); $result['rc_dt_rif_checkin_checkout_out'] = DrupalDateToDate($elem->field_p_dt_rif_checkin_checkout[LANGUAGE_NONE][0]['value2']); $result['rc_tm_rif_checkin_checkout_out'] = DrupalTimeToTime($elem->field_p_dt_rif_checkin_checkout[LANGUAGE_NONE][0]['value2'], "H:i"); $result['rc_is_ricevuta_stampata'] = $elem->field_p_is_ricevuta_stampata[LANGUAGE_NONE][0]['value']; } } $this->rs_parkauto = $result; }
private function set_CT_data($node) { $node->field_p_sito_parking[LANGUAGE_NONE][0]['nid'] = $this->rs_parkauto['rc_sito_parking']; $node->field_p_stato_parking[LANGUAGE_NONE][0]['value'] = strtolower($this->stato_attuale); if ($this->rs_parkauto['action-target'] == 'st_ricevuta') { $this->rs_parkauto['rc_is_ricevuta_stampata'] = '1'; } $node->field_p_is_ricevuta_stampata[LANGUAGE_NONE][0]['value'] = !$this->rs_parkauto['rc_is_ricevuta_stampata'] ? '0' : $this->rs_parkauto['rc_is_ricevuta_stampata']; $node->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['value'] = DateTimeToDrupalDateTime($this->rs_parkauto['rc_dt_checkin_checkout_in'], $this->rs_parkauto['rc_tm_checkin_checkout_in']); $node->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['value2'] = DateTimeToDrupalDateTime($this->rs_parkauto['rc_dt_checkin_checkout_out'], $this->rs_parkauto['rc_tm_checkin_checkout_out']); $node->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['timezone'] = 'Europe/Rome'; $node->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['timezone_db'] = 'UTC'; $node->field_p_dt_checkin_checkout[LANGUAGE_NONE][0]['date_type'] = 'date'; $node->field_p_tipo_parcheggio[LANGUAGE_NONE][0]['nid'] = ListinoBase::get_nid_from_data($this->rs_parkauto['rc_tipo_parcheggio']); /** */ $this->set_lista_reg_utenti($node); $node->field_p_uid_registrazione[LANGUAGE_NONE][0]['uid'] = $this->rs_parkauto['rc_uid_' . STATO_REGISTRAZIONE]; $node->field_p_dtreg_registrazione[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_dtreg_dttm_' . STATO_REGISTRAZIONE]; $node->field_p_dtreg_registrazione[LANGUAGE_NONE][0]['timezone'] = 'Europe/Rome'; $node->field_p_dtreg_registrazione[LANGUAGE_NONE][0]['timezone_db'] = 'UTC'; $node->field_p_dtreg_registrazione[LANGUAGE_NONE][0]['date_type'] = 'date'; if ($this->stato_attuale == STATO_WALKIN || $this->stato_attuale == STATO_WALKOUT || $this->stato_attuale == STATO_WALKOUT_CLOSED) { $node->field_p_uid_walkin[LANGUAGE_NONE][0]['uid'] = $this->rs_parkauto['rc_uid_' . STATO_WALKIN]; $node->field_p_dtreg_walkin[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_dtreg_dttm_' . STATO_WALKIN]; $node->field_p_dtreg_walkin[LANGUAGE_NONE][0]['timezone'] = 'Europe/Rome'; $node->field_p_dtreg_walkin[LANGUAGE_NONE][0]['timezone_db'] = 'UTC'; $node->field_p_dtreg_walkin[LANGUAGE_NONE][0]['date_type'] = 'date'; } if ($this->stato_attuale == STATO_WALKOUT || $this->stato_attuale == STATO_WALKOUT_CLOSED) { $node->field_uid_walkout[LANGUAGE_NONE][0]['uid'] = $this->rs_parkauto['rc_uid_' . STATO_WALKOUT]; $node->field_p_dtreg_walkout[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_dtreg_dttm_' . STATO_WALKOUT]; $node->field_p_dtreg_walkout[LANGUAGE_NONE][0]['timezone'] = 'Europe/Rome'; $node->field_p_dtreg_walkout[LANGUAGE_NONE][0]['timezone_db'] = 'UTC'; $node->field_p_dtreg_walkout[LANGUAGE_NONE][0]['date_type'] = 'date'; } if ($this->stato_attuale == STATO_WALKOUT_CLOSED) { $node->field_p_uid_walkout_closed[LANGUAGE_NONE][0]['uid'] = $this->rs_parkauto['rc_uid_' . STATO_WALKOUT_CLOSED]; $node->field_p_dtreg_walkout_closed[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_dtreg_dttm_' . STATO_WALKOUT_CLOSED]; $node->field_p_dtreg_walkout_closed[LANGUAGE_NONE][0]['timezone'] = 'Europe/Rome'; $node->field_p_dtreg_walkout_closed[LANGUAGE_NONE][0]['timezone_db'] = 'UTC'; $node->field_p_dtreg_walkout_closed[LANGUAGE_NONE][0]['date_type'] = 'date'; } /**/ $node->field_p_nome_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_nome_cliente']; $node->field_p_cognome_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_cognome_cliente']; $node->field_p_ritira_auto[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_ritira_auto']; $node->field_p_email_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_email_cliente']; $node->field_p_nr_telefono_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_nr_telefono_cliente']; $node->field_p_targa_auto_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_targa_auto_cliente']; $node->field_p_modello_auto_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_modello_auto_cliente']; $node->field_p_marca_auto_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_marca_auto_cliente']; $node->field_p_nr_passeggeri_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_nr_passeggeri_cliente']; $node->field_p_cd_volo_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_cd_volo_cliente']; $node->field_p_nr_terminal_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_nr_terminal_cliente']; $node->field_p_provenienza_cliente[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_provenienza_cliente']; $node->field_p_tipo_cliente[LANGUAGE_NONE][0]['nid'] = $this->rs_parkauto['rc_tipo_cliente']; $node->field_p_tp_gestione_chiavi[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_tp_gestione_chiavi']; $node->field_p_tp_veicolo_cliente[LANGUAGE_NONE][0]['nid'] = $this->rs_parkauto['rc_tp_veicolo_cliente']; $node->field_p_note_interne[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_note_interne']; $node->field_p_note_prenotazione[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_note_prenotazione']; $node->field_p_zona_parcheggio_auto[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_zona_parcheggio_auto']; if ($this->rs_parkauto['rc_dt_walkin']) { $node->field_p_dt_walkin[LANGUAGE_NONE][0]['value'] = DateTimeToDrupalDateTime($this->rs_parkauto['rc_dt_walkin'], $this->rs_parkauto['rc_tm_walkin']); $node->field_p_dt_walkin[LANGUAGE_NONE][0]['timezone'] = 'Europe/Rome'; $node->field_p_dt_walkin[LANGUAGE_NONE][0]['timezone_db'] = 'UTC'; $node->field_p_dt_walkin[LANGUAGE_NONE][0]['date_type'] = 'date'; } if ($this->rs_parkauto['rc_dt_walkout_prevista']) { $node->field_p_dt_walkout_prevista[LANGUAGE_NONE][0]['value'] = DateTimeToDrupalDateTime($this->rs_parkauto['rc_dt_walkout_prevista'], $this->rs_parkauto['rc_tm_walkout_prevista']); $node->field_p_dt_walkout_prevista[LANGUAGE_NONE][0]['timezone'] = 'Europe/Rome'; $node->field_p_dt_walkout_prevista[LANGUAGE_NONE][0]['timezone_db'] = 'UTC'; $node->field_p_dt_walkout_prevista[LANGUAGE_NONE][0]['date_type'] = 'date'; } if ($this->rs_parkauto['rc_dt_walkout']) { $node->field_p_dt_walkout[LANGUAGE_NONE][0]['value'] = DateTimeToDrupalDateTime($this->rs_parkauto['rc_dt_walkout'], $this->rs_parkauto['rc_tm_walkout']); $node->field_p_dt_walkout[LANGUAGE_NONE][0]['timezone'] = 'Europe/Rome'; $node->field_p_dt_walkout[LANGUAGE_NONE][0]['timezone_db'] = 'UTC'; $node->field_p_dt_walkout[LANGUAGE_NONE][0]['date_type'] = 'date'; } $node->field_p_valore_sct_mag[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_valore_sct_mag']; $node->field_p_tipo_sct_mag[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_tipo_sct_mag']; $node->field_p_tp_sct_mag_v_p[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_tp_sct_mag_v_p']; $node->field_p_motivazione_sct_mag[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_motivazione_sct_mag']; $this->set_date_rif_checkin_checkout($node); $this->calcola_costi_parcheggio(); $this->rs_parkauto['rc_imp_in_pagamento_2'] = $this->rs_parkauto['rc_imp_in_pagamento']; $node->field_p_imp_totale_dovuto[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_imp_totale_dovuto']; $node->sell_price = $this->rs_parkauto['rc_imp_totale_dovuto']; $node->field_p_totale_nr_giorni[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_totale_nr_giorni']; $node->field_p_imp_totale_pagato[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_imp_totale_pagato']; $this->rs_parkauto['rc_imp_totale_residuo'] = $this->rs_parkauto['rc_imp_totale_dovuto'] - $this->rs_parkauto['rc_imp_totale_pagato']; $node->field_p_imp_totale_residuo[LANGUAGE_NONE][0]['value'] = $this->rs_parkauto['rc_imp_totale_residuo']; $this->ar_pagamenti_effettuati = array(); if ($this->rs_parkauto['rc_imp_in_pagamento_2']) { $this->ar_pagamenti_effettuati = array('nid_parkauto' => $this->nid, 'tp_pag' => $this->rs_parkauto['rc_tppag_in_pagamento'], 'imp_pag' => $this->rs_parkauto['rc_imp_in_pagamento'], 'uid' => $this->user->uid); } $this->rs_parkauto['rc_imp_in_pagamento'] = 0; $this->rs_parkauto['rc_imp_in_pagamento_2'] = 0; $this->rs_parkauto['rc_tppag_in_pagamento'] = ''; $this->rs_parkauto['rc_imp_totale_resto'] = 0; return $node; }