public function RCSavedButtonClicked($sender, $param) { $tempus = 'RCed' . $this->RCprimarykey; if ($this->RCedorganisation_edit_status->Text == '1') { $RCEditRecord = OrganisationRecord::finder()->findByPK($this->{$tempus}->Text); } else { $RCEditRecord = new OrganisationRecord(); } //HIDDEN foreach ($this->RChiddenfields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $RCEditRecord->{$recordfield} = $this->{$edrecordfield}->Value; } //DATUM foreach ($this->RCdatfields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $RCEditRecord->{$recordfield} = date('Y-m-d', $this->{$edrecordfield}->TimeStamp); } //BOOL foreach ($this->RCboolfields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $RCEditRecord->{$recordfield} = $this->{$edrecordfield}->Checked ? 1 : 0; } foreach ($this->RCtimefields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $RCEditRecord->{$recordfield} = $this->{$edrecordfield}->Text; } foreach ($this->RCfields as $recordfield) { $edrecordfield = 'RCed' . $recordfield; $RCEditRecord->{$recordfield} = $this->{$edrecordfield}->Text; } $RCEditRecord->save(); $this->saveBankkonto($RCEditRecord->idtm_organisation); $this->saveObjekt($RCEditRecord->idtm_organisation); if ($this->RCedorganisation_edit_status->Text == '0') { $org_name = $RCEditRecord->org_name; $this->getPage()->getClientScript()->registerEndScript('X', "tree.insertNewChild(tree.getSelectedItemId()||0,{$RCEditRecord->idtm_organisation},'{$org_name}')"); } $this->view_Organisation($RCEditRecord->idtm_organisation); // if($RCEditRecord->parent_idtm_organisation!=1){ // $this->bindListChildOrgListe(); // } //$this->bindListOrgListe(); }
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 static function initOrganisationStruktur() { $OrganisationType = OrganisationTypeRecord::finder()->findAll(); if (count($OrganisationType) >= 1) { foreach ($OrganisationType as $OrgType) { $Organisation = OrganisationRecord::finder()->findByorg_fk_internal($OrgType->org_type_name); if (count($Organisation) != 1) { $Organisation = new OrganisationRecord(); } $Organisation->idta_organisation_type = 1; $Organisation->idta_organisation_art = 1; $Organisation->idtm_ressource = 1; $Organisation->org_name = $OrgType->org_type_name; $Organisation->org_fk_internal = $OrgType->org_type_name; $Organisation->parent_idtm_organisation = 1; $Organisation->save(); /*foreach(range('A','Z') as $i){ $OrgChild = OrganisationRecord::finder()->findByorg_fk_internal($OrgType->org_type_name.$i); if(count($OrgChild)!=1){ $OrgChild = new OrganisationRecord(); } $OrgChild->idta_organisation_type = 1; $OrgChild->idta_organisation_art = 1; $OrgChild->idtm_ressource = 1; $OrgChild->org_name = $i; $OrgChild->org_fk_internal = $OrgType->org_type_name.$i; $OrgChild->parent_idtm_organisation = $Organisation->idtm_organisation; $OrgChild->save(); }*/ unset($Organisation); } } }
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); }