private function importPARTEI($data) { $Organisation = OrganisationRecord::finder()->findorg_fk_internal("HTC" . trim($data[0])); if (count($Organisation) != 1) { $Organisation = new OrganisationRecord(); } $Organisation->org_fk_internal = trim("HTC" . trim($data[0])); $Organisation->parent_idtm_organisation = OrganisationRecord::finder()->findByorg_fk_internal('08500')->idtm_organisation; $Organisation->idta_organisation_type = 8; $Organisation->idtm_ressource = 1; $Organisation->org_anrede = utf8_encode($data[3]); $Organisation->org_briefanrede = utf8_encode(""); $Organisation->org_name = utf8_encode($data[1]); $Organisation->org_vorname = utf8_encode($data[2]); $Organisation->org_name1 = utf8_encode(""); $Organisation->org_matchkey = utf8_encode($data[1] . " " . $data[2]); $Organisation->org_uid = ""; $Organisation->org_aktiv = $data[19] == "ja" ? 1 : 0; $Organisation->save(); //Bankkonto laden $Bankkonto = BankkontoRecord::finder()->findByidtm_organisation($Organisation->idtm_organisation); if (count($Bankkonto) != 1) { $Bankkonto = new BankkontoRecord(); } $Bankkonto->idtm_organisation = $Organisation->idtm_organisation; //$Bankkonto->bak_kontowortlaut = utf8_encode($data["38"]); $Bankkonto->bak_geldinstitut = utf8_encode(""); $Bankkonto->bak_blz = ""; $Bankkonto->bak_konto = ""; $Bankkonto->bak_bic = ""; $Bankkonto->bak_iban = ""; $Bankkonto->save(); //Kommunikation 1 Telefon $Kommunikation = KommunikationRecord::finder()->find("kom_type = 1 AND kom_ismain = 1 AND idtm_organisation = ?", $Organisation->idtm_organisation); if (count($Kommunikation) != 1) { $Kommunikation = new KommunikationRecord(); } $Kommunikation->kom_type = 1; $Kommunikation->kom_information = $data[9]; $Kommunikation->kom_ismain = 1; $Kommunikation->idtm_organisation = $Organisation->idtm_organisation; $Kommunikation->save(); //Kommunikation 1 Fax2 $Kommunikation = KommunikationRecord::finder()->find("kom_type = 2 AND kom_ismain = 1 AND idtm_organisation = ?", $Organisation->idtm_organisation); if (count($Kommunikation) != 1) { $Kommunikation = new KommunikationRecord(); } $Kommunikation->kom_type = 2; $Kommunikation->kom_information = $data[10]; $Kommunikation->kom_ismain = 1; $Kommunikation->idtm_organisation = $Organisation->idtm_organisation; $Kommunikation->save(); //Kommunikation 1 Mail $Kommunikation = KommunikationRecord::finder()->find("kom_type = 3 AND kom_ismain = 1 AND idtm_organisation = ?", $Organisation->idtm_organisation); if (count($Kommunikation) != 1) { $Kommunikation = new KommunikationRecord(); } $Kommunikation->kom_type = 3; $Kommunikation->kom_information = $data[11]; $Kommunikation->kom_ismain = 1; $Kommunikation->idtm_organisation = $Organisation->idtm_organisation; $Kommunikation->save(); //adresse 1 $sql = "SELECT ta_adresse.* FROM ta_adresse INNER JOIN tm_organisation_has_ta_adresse ON ta_adresse.idta_adresse = tm_organisation_has_ta_adresse.idta_adresse WHERE tm_organisation_has_ta_adresse.idtm_organisation = " . $Organisation->idtm_organisation . " AND ta_adresse.adresse_ismain = 1"; $Adresse = AdresseRecord::finder()->findBySQL($sql); if (count($Adresse) != 1) { $Adresse = new AdresseRecord(); } $Adresse->adresse_street = utf8_encode($data[6]); $Adresse->adresse_zip = $data[7]; $Adresse->adresse_town = $data[8]; $Adresse->adresse_ismain = 1; $Adresse->idtm_country = 1; $Adresse->save(); $OrganisationAdresse = OrganisationAdresseRecord::finder()->find('idtm_organisation = ? AND idta_adresse = ?', $Organisation->idtm_organisation, $Adresse->idta_adresse); if (count($OrganisationAdresse) != 1) { $OrganisationAdresse = new OrganisationAdresseRecord(); } $OrganisationAdresse->idta_adresse = $Adresse->idta_adresse; $OrganisationAdresse->idtm_organisation = $Organisation->idtm_organisation; $OrganisationAdresse->save(); unset($Organisation, $Bankkonto, $Kommunikation, $Adresse, $OrganisationAdresse, $sql); }
public function saveBankkonto($idtm_organisation) { $Bankkonto = BankkontoRecord::finder()->findByidtm_organisation($idtm_organisation); if (count($Bankkonto) != 1) { $Bankkonto = new BankkontoRecord(); } $Bankkonto->idtm_organisation = $idtm_organisation; $Bankkonto->bak_kontowortlaut = $this->RCedbak_kontowortlaut->Text; $Bankkonto->bak_geldinstitut = $this->RCedbak_geldinstitut->Text; $Bankkonto->bak_blz = $this->RCedbak_blz->Text; $Bankkonto->bak_konto = $this->RCedbak_konto->Text; $Bankkonto->bak_bic = $this->RCedbak_bic->Text; $Bankkonto->bak_iban = $this->RCedbak_iban->Text; $Bankkonto->save(); }
private function importOBJ($data) { $Organisation = OrganisationRecord::finder()->findByorg_fk_internal(trim($data[6])); if (count($Organisation) != 1) { $Organisation = new OrganisationRecord(); } $Organisation->org_fk_internal = trim($data["6"]); $Organisation->parent_idtm_organisation = OrganisationRecord::finder()->findByorg_fk_internal('Objekt')->idtm_organisation; $Organisation->idtm_ressource = 1; $Organisation->idta_organisation_type = 7; $Organisation->org_name = utf8_encode($data["7"]); $Organisation->org_matchkey = $data["4"]; $Organisation->org_uid = $data["18"]; $Organisation->org_finanzamt = $data["19"]; $Organisation->org_referat = $data["20"]; $Organisation->org_gemeinde = $data["23"]; $Organisation->org_katastragemeinde = $data["24"]; $Organisation->org_grundstuecksnummer = $data["25"]; $Organisation->org_einlagezahl = $data["26"]; $Organisation->org_baujahr = $data["27"]; $Organisation->org_wohnungen = $data["28"]; $Organisation->org_aktiv = 1; $Organisation->save(); $Bankkonto = BankkontoRecord::finder()->findByidtm_organisation($Organisation->idtm_organisation); if (count($Bankkonto) != 1) { $Bankkonto = new BankkontoRecord(); } $Bankkonto->idtm_organisation = $Organisation->idtm_organisation; $Bankkonto->bak_kontowortlaut = $data["10"]; $Bankkonto->bak_geldinstitut = $data["11"]; $Bankkonto->bak_blz = $data["12"]; $Bankkonto->bak_konto = $data["13"]; $Bankkonto->bak_bic = $data["14"]; $Bankkonto->bak_iban = $data["15"]; $Bankkonto->save(); $sql = "SELECT ta_adresse.* FROM ta_adresse INNER JOIN tm_organisation_has_ta_adresse ON ta_adresse.idta_adresse = tm_organisation_has_ta_adresse.idta_adresse WHERE tm_organisation_has_ta_adresse.idtm_organisation = " . $Organisation->idtm_organisation . " AND ta_adresse.adresse_ismain = 1"; $Adresse = AdresseRecord::finder()->findBySQL($sql); if (count($Adresse) != 1) { $Adresse = new AdresseRecord(); } $Adresse->adresse_street = utf8_encode($data["8"]); $Adresse->adresse_town = $data["9"]; $Adresse->adresse_ismain = 1; $Adresse->idtm_country = 1; $Adresse->save(); $OrganisationAdresse = OrganisationAdresseRecord::finder()->find('idtm_organisation = ? AND idta_adresse = ?', $Organisation->idtm_organisation, $Adresse->idta_adresse); if (count($OrganisationAdresse) != 1) { $OrganisationAdresse = new OrganisationAdresseRecord(); } $OrganisationAdresse->idta_adresse = $Adresse->idta_adresse; $OrganisationAdresse->idtm_organisation = $Organisation->idtm_organisation; $OrganisationAdresse->save(); unset($Organisation, $Bankkonto, $Adresse, $OrganisationAdresse, $sql); }