public function insertButtonClicked($sender, $param) { $adresseRecord = new AdresseRecord(); $adresseRecord->adresse_street = $this->Street->Text; $adresseRecord->adresse_town = $this->Town->Text; $adresseRecord->adresse_zip = $this->Zip->Text; //lets add the coordinates $myGTranslator = new GoogleAdressTranslator(); $mapparams = $myGTranslator->getLatAndLong(implode(",", array($this->Street->Text, $this->Town->Text))); $myLatandLong = explode(",", $mapparams); //here we check, if the coordinates have been found if ($myLatandLong[1] != 0) { $adresseRecord->adresse_lat = $myLatandLong[1]; $adresseRecord->adresse_long = $myLatandLong[0]; } else { $adresseRecord->adresse_lat = "48.189950"; $adresseRecord->adresse_long = "16.377319"; } $adresseRecord->idtm_country = $this->Country->Text; $adresseRecord->save(); //einbinden der zusaetzlichen infos $parteiadresseRecord = new ParteiAdresseRecord(); $parteiadresseRecord->idta_partei = $this->idta_partei->Data; $parteiadresseRecord->idta_adresse = $adresseRecord->idta_adresse; $parteiadresseRecord->save(); $this->Response->redirect($this->getRequest()->constructUrl('page', "logik.partei")); }
/** * Creates a new user account if all inputs are valid. * This method responds to the OnClick event of the "create" button. * @param mixed event sender * @param mixed event parameter */ public function createButtonClicked($sender, $param) { if ($this->IsValid) { // populates a UserRecord object with user inputs $userRecord = new UserRecord(); $userRecord->user_username = $this->Username->Text; $userRecord->user_password = $this->Password->Text; $userRecord->user_mail = $this->Email->Text; $userRecord->idtm_user_role = (int) $this->Role->SelectedValue; $userRecord->user_vorname = $this->FirstName->Text; $userRecord->user_name = $this->LastName->Text; // saves to the database via Active Record mechanism $userRecord->save(); $parteiRecord = new ParteiRecord(); $parteiRecord->idtm_user = $userRecord->idtm_user; $parteiRecord->partei_name = $this->FirstName->Text . " " . $this->LastName->Text; //save the partei $parteiRecord->save(); $adressRecord = new AdresseRecord(); $adressRecord->adresse_street = $this->adresse_street->Text; $adressRecord->adresse_zip = $this->adresse_zip->Text; $adressRecord->adresse_town = $this->adresse_town->Text; $adressRecord->idtm_country = 1; //lets add the coordinates $myGTranslator = new GoogleAdressTranslator(); $mapparams = $myGTranslator->getLatAndLong(implode(",", array($this->adresse_street->Text, $this->adresse_town->Text))); $myLatandLong = explode(",", $mapparams); //here we check, if the coordinates have been found if ($myLatandLong[1] != 0) { $adressRecord->adresse_lat = $myLatandLong[1]; $adressRecord->adresse_long = $myLatandLong[0]; } else { $adressRecord->adresse_lat = "48.189950"; $adressRecord->adresse_long = "16.377319"; } $adressRecord->save(); $parteiadresseRecord = new ParteiAdresseRecord(); $parteiadresseRecord->idta_partei = $parteiRecord->idta_partei; $parteiadresseRecord->idta_adresse = $adressRecord->idta_adresse; //save adress to partei $parteiadresseRecord->save(); // redirects the browser to the homepage $this->Response->redirect($this->Service->DefaultPageUrl); } }
public function addAdresse($sender, $param) { if ($this->RCedorganisation_edit_status->Text == '0') { $this->RCSavedButtonClicked($sender, $param); } $Adresse = new AdresseRecord(); $Adresse->adresse_ismain = $this->RCedadresse_ismain->Checked ? 1 : 0; $Adresse->adresse_street = $this->RCedadresse_street->Text; $Adresse->adresse_town = $this->RCedadresse_town->Text; $Adresse->adresse_zip = $this->RCedadresse_zip->Text; //lets add the coordinates $myGTranslator = new GoogleAdressTranslator(); $mapparams = $myGTranslator->getLatAndLong(implode(",", array($this->RCedadresse_street->Text, $this->RCedadresse_town->Text))); $myLatandLong = explode(",", $mapparams); //here we check, if the coordinates have been found if ($myLatandLong[1] != 0) { $Adresse->adresse_lat = $myLatandLong[1]; $Adresse->adresse_long = $myLatandLong[0]; } else { $Adresse->adresse_lat = 0.0; $Adresse->adresse_long = 0.0; } $Adresse->idtm_country = 1; $Adresse->save(); $OrganisationAdresse = new OrganisationAdresseRecord(); $OrganisationAdresse->idta_adresse = $Adresse->idta_adresse; $OrganisationAdresse->idtm_organisation = $this->RCedidtm_organisation->Text; $OrganisationAdresse->save(); $this->bindListAdress(); }
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); }
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); }