* Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at > * Rudolf Hangl < rudolf.hangl@technikum-wien.at > * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > */ require_once('../../config/vilesci.config.inc.php'); require_once('../../include/functions.inc.php'); require_once('../../include/firma.class.php'); require_once('../../include/funktion.class.php'); require_once('../../include/standort.class.php'); require_once('../../include/adresse.class.php'); require_once('../../include/kontakt.class.php'); require_once('../../include/person.class.php'); require_once('../../include/organisationseinheit.class.php'); require_once('../../include/nation.class.php'); require_once('../../include/benutzerberechtigung.class.php'); if (!$db = new basis_db()) die('Es konnte keine Verbindung zum Server aufgebaut werden.'); // ******* INIT ******** $user = get_uid(); //Zugriffsrechte pruefen $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); if(!$rechte->isBerechtigt('basis/firma:begrenzt')) die('Sie haben keine Berechtigung für diese Seite'); // Parameter einlesen $errorstr=''; $tabselect = (isset($_GET['tabselect'])?$_GET['tabselect']:0); $firma_id = (isset($_REQUEST['firma_id'])?$_REQUEST['firma_id']:''); $standort_id = (isset($_REQUEST['standort_id'])?$_REQUEST['standort_id']:''); $adresse_id = (isset($_REQUEST['adresse_id'])?$_REQUEST['adresse_id']:''); $kontakt_id = (isset($_REQUEST['kontakt_id'])?$_REQUEST['kontakt_id']:''); $oe_kurzbz= (isset($_REQUEST['oe_kurzbz'])?$_REQUEST['oe_kurzbz']:''); $oe_parent_kurzbz= (isset($_REQUEST['oe_parent_kurzbz'])?$_REQUEST['oe_parent_kurzbz']:''); $work = (isset($_REQUEST['work'])?$_REQUEST['work']:(isset($_REQUEST['save'])?$_REQUEST['save']:null)); $showmenue = (isset($_REQUEST['showmenue'])?$_REQUEST['showmenue']:false); $personfunktionstandort_id = (isset($_REQUEST['personfunktionstandort_id'])?$_REQUEST['personfunktionstandort_id']:''); $firma_organisationseinheit_id = (isset($_REQUEST['firma_organisationseinheit_id'])?$_REQUEST['firma_organisationseinheit_id']:''); if(isset($_REQUEST['nation']) && $_REQUEST['nation']=='A' && isset($_REQUEST['gemeinde_combo']) && isset($_REQUEST['ort_combo'])) { $_REQUEST['gemeinde']=$_REQUEST['gemeinde_combo']; $_REQUEST['ort']=$_REQUEST['ort_combo']; } function getGemeindeDropDown($postleitzahl) { global $db, $_REQUEST, $gemeinde; $return=''; $found=false; $firstentry=''; $gemeinde_x = (isset($_REQUEST['gemeinde'])?$_REQUEST['gemeinde']:''); $qry = "SELECT distinct name FROM bis.tbl_gemeinde WHERE plz='".addslashes($postleitzahl)."'"; $return.= ''; if(!$found && (isset($importort) && $importort!='')) { $return.= $importort; } $gemeinde = $gemeinde_x; return $return; } if(isset($_GET['type']) && $_GET['type']=='getgemeindecontent' && isset($_GET['plz'])) { header('Content-Type: text/html; charset=UTF-8'); echo getGemeindeDropDown($_GET['plz']); exit; } function getOrtDropDown($postleitzahl, $gemeindename) { global $db, $_REQUEST; $return=''; $ort = (isset($_REQUEST['ort'])?$_REQUEST['ort']:''); $qry = "SELECT distinct ortschaftsname FROM bis.tbl_gemeinde WHERE plz='".addslashes($postleitzahl)."' AND name='".addslashes($gemeindename)."'"; $return.=''; return $return; } if(isset($_GET['type']) && $_GET['type']=='getortcontent' && isset($_GET['plz']) && isset($_GET['gemeinde'])) { header('Content-Type: text/html; charset=UTF-8'); echo getOrtDropDown($_GET['plz'], $_GET['gemeinde']); exit; } // Defaultwerte $adresstyp_arr = array('h'=>'Hauptwohnsitz','n'=>'Nebenwohnsitz','f'=>'Firma',''=>''); //Loeschen einer Adresse if(isset($_GET['deleteadresse'])) { $showmenue=1; $tabselect=1; if(!$rechte->isBerechtigt('basis/firma:begrenzt',null, 'suid')) die('Sie haben keine Berechtigung fuer diese Aktion'); if(is_numeric($standort_id)) { $standort_obj = new standort(); if(!$standort_obj->delete($standort_id)) { $errorstr=($errorstr?$errorstr.', ':'').'Fehler beim Loeschen Standort:'.$standort_obj->errormsg; } $standort_obj = new standort(); if(!$standort_obj->deletepersonfunktionstandort('',$standort_id)) { $errorstr=($errorstr?$errorstr.', ':'').'Fehler beim Loeschen Person Funktion Standort:'.$standort_obj->errormsg; } } if(is_numeric($adresse_id)) { $adresse_obj = new adresse(); if(!$adresse_obj->delete($adresse_id)) { $errorstr=($errorstr?$errorstr.', ':'').'Fehler beim Loeschen der Adresse:'.$adresse_obj->errormsg; } } } if(isset($_GET['deletekontakt'])) { $showmenue=1; $tabselect=2; if(!$rechte->isBerechtigt('basis/firma:begrenzt',null, 'suid')) die('Sie haben keine Berechtigung fuer diese Aktion'); if(is_numeric($kontakt_id)) { $kontakt_obj = new kontakt(); if(!$kontakt_obj->delete($kontakt_id)) { $errorstr=($errorstr?$errorstr.', ':'').'Fehler beim Loeschen Standort:'.$kontakt_obj->errormsg; } } } if(isset($_GET['deletepersonfunktionstandort'])) { $showmenue=1; $tabselect=1; if(!$rechte->isBerechtigt('basis/firma:begrenzt',null, 'suid')) die('Sie haben keine Berechtigung fuer diese Aktion'); if(is_numeric($personfunktionstandort_id)) { $standort_obj = new standort(); if(!$standort_obj->deletepersonfunktionstandort($personfunktionstandort_id)) { $errorstr=($errorstr?$errorstr.', ':'').'Fehler beim Loeschen Person Funktion Standort:'.$standort_obj->errormsg; } } } ?> Firma - Detailwork parent.frames[1].location.href=\'firma_details.php?firma_id='.$firma_id.'&tabselect=1\'; '; break; case 'eingabeOrganisationseinheit': $htmlcode=eingabeOrganisationseinheit($firma_id,$firma_organisationseinheit_id,$oe_kurzbz,$adresstyp_arr,$user,$rechte); break; case 'saveOrganisationseinheit': $htmlcode=saveOrganisationseinheit($firma_id,$firma_organisationseinheit_id,$oe_kurzbz,$oe_parent_kurzbz,$adresstyp_arr,$user,$rechte); break; default: if (!$showmenue) $htmlcode=getStandort($firma_id,$standort_id,$adresse_id,$adresstyp_arr,$user,$rechte); break; } if ($showmenue) echo '
'.getStandort($firma_id,$standort_id,$adresse_id,$adresstyp_arr,$user,$rechte).'
'.getlistPersonenfunktionen($firma_id,$standort_id,$personfunktionstandort_id,$adresstyp_arr,$user,$rechte).'
'.listKontakte($firma_id,$standort_id,$adresse_id,$kontakt_id,$adresstyp_arr,$user,$rechte).'

'; else echo $htmlcode; echo ($errorstr?'
'.$errorstr:''); ?> load_firmaorganisationseinheit($firma_organisationseinheit_id)) { $firma->new = false; } else { return 'Firmaorganisationseinheit wurde nicht gefunden: '.$firma_organisationseinheit_id; } } else { $firma->new = true; $firma->insertamum = date('Y-m-d H:i:s'); $firma->insertvon = $user; } $firma->firma_id=$firma_id; $oe_kurzbz = (isset($_POST['oe_kurzbz'])?$_POST['oe_kurzbz']:null); $kundennummer = (isset($_POST['kundennummer'])?$_POST['kundennummer']:null); $bezeichnung = (isset($_POST['bezeichnung'])?$_POST['bezeichnung']:''); $ext_id = (isset($_POST['ext_id'])?$_POST['ext_id']:null); $oe_parent_kurzbz = (isset($_POST['oe_parent_kurzbz'])?$_POST['oe_parent_kurzbz']:''); $organisationseinheit_obj = new organisationseinheit(); if ($oe_kurzbz) { if (!$organisationseinheit_obj->load($oe_kurzbz)) { return 'Organisation fehler '.$organisationseinheit_obj->errormsg; } //$bezeichnung=($bezeichnung?$bezeichnung:$organisationseinheit_obj->bezeichnung); } else { echo 'Organisation fehlt'; return false; } $firma->updateamum = date('Y-m-d H:i:s'); $firma->updatevon = $user; $firma->oe_kurzbz=$organisationseinheit_obj->oe_kurzbz; $firma->bezeichnung=$bezeichnung; $firma->kundennummer=$kundennummer; $firma->ext_id=$ext_id; if($firma_organisationseinheit_id=='' && $firma->get_firmaorganisationseinheit($firma->firma_id, $firma->oe_kurzbz)) { return "Organisationseinheit ".$firma->oe_kurzbz." ist bereits zugeteilt!"; } if (!$firma->saveorganisationseinheit()) echo $firma->errormsg; return $firma->firma_organisationseinheit_id; } #-------------------------------------------------------------------------------------------------------------------------------------------------------------# /** * Organisation zur Firma */ function eingabeOrganisationseinheit($firma_id,$firma_organisationseinheit_id,$oe_kurzbz,$adresstyp_arr,$user,$rechte) { // Init $htmlstr=''; // Plausib if (empty($firma_id) || !is_numeric($firma_id) ) return 'Firma fehlt.'; // Datenlesen zur Firma $firma = new firma(); if ($firma_organisationseinheit_id && !$firma->get_firmaorganisationseinheit($firma_id,$oe_kurzbz)) return '
Fehler Firma ID '.$firma_id.' '.$firma->errormsg; $htmlstr.= ''; // $htmlstr.= ' '; //Kontakttype laden $organisationseinheit_obj = new organisationseinheit(); $organisationseinheit_obj->getAll(); $i=0; foreach ($firma->result as $row) { $htmlstr.="\n"; $htmlstr.="\n"; $i++; $htmlstr.= " "; $htmlstr.= ""; $htmlstr.= ""; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.="\n"; } if (!$firma_organisationseinheit_id) { $i++; $htmlstr.="\n"; $htmlstr.="\n"; $i++; $htmlstr.= " "; //$htmlstr.= ''; $htmlstr.= ""; $htmlstr.= ""; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.="\n"; } $htmlstr.= '
Bezeichnung OrganisationseinheitKurzbezeichnungBezeichnung Kundennummer  
"; // $htmlstr.= "
"; // $htmlstr.= "
'; return $htmlstr; } #-------------------------------------------------------------------------------------------------------------------------------------------------------------# /** * Kontakte zu Firmen,Standorte in Listenform */ function saveKontakt($firma_id,$standort_id,$adresse_id,$kontakt_id,$adresstyp_arr,$user,$rechte) { if( !$rechte->isBerechtigt('admin',null,'suid') && !$rechte->isBerechtigt('basis/firma:begrenzt',null, 'suid')) return 'Sie haben keine Berechtigung fuer diese Aktion - Kontakte'; // Plausib if (empty($firma_id) || !is_numeric($firma_id) ) return 'Firma fehlt.'; if (empty($standort_id) || !is_numeric($standort_id) ) return 'Standort fehlt.'; // Init $htmlstr=''; // Datenlesen $person_id = (isset($_POST['person_id'])?$_POST['person_id']:null); $kontakttyp = (isset($_POST['kontakttyp'])?$_POST['kontakttyp']:''); $anmerkung = (isset($_POST['anmerkung'])?$_REQUEST['anmerkung']:''); $kontakt = (isset($_POST['kontakt'])?$_REQUEST['kontakt']:''); $zustellung = (isset($_POST['zustellung'])?true:false); $ext_id = (isset($_POST['ext_id'])?$_POST['ext_id']:''); //---------------------------------------- // ADRESSEN Neuanlage - Aenderung //---------------------------------------- $kontakt_obj = new kontakt(); if($kontakt_id!='' && is_numeric($kontakt_id) ) { if($kontakt_obj->load($kontakt_id)) { $kontakt_obj->new = false; } else { return 'Kontakt wurde nicht gefunden:'.$kontakt_id; } } else { $kontakt_obj->new = true; $kontakt_obj->insertamum = date('Y-m-d H:i:s'); $kontakt_obj->insertvon = $user; } $kontakt_obj->person_id=null; $kontakt_obj->firma_id=null; $kontakt_obj->standort_id=$standort_id; $kontakt_obj->kontakttyp = $kontakttyp; $kontakt_obj->anmerkung = $anmerkung; $kontakt_obj->kontakt = $kontakt; $kontakt_obj->zustellung = $zustellung; $kontakt_obj->updateamum = date('Y-m-d H:i:s'); $kontakt_obj->updatvon = $user; $kontakt_obj->ext_id=($ext_id?$ext_id:null); if(!$kontakt_obj->save()) return 'Fehler beim Speichern des Kontakt '.$kontakttyp .' '.$kontakt.' ID '. $kontakt_id.' :'.$kontakt_obj->errormsg; if ($kontakt_obj->new) $kontakt_id=$kontakt_obj->kontakt_id; return 'Kontakt: '.$kontakttyp .' '.$kontakt.' ID '. $kontakt_id.' gespeichert'; } #-------------------------------------------------------------------------------------------------------------------------------------------------------------# /** * Kontakte zu Firmen, Standorte in Listenform */ function listKontakte($firma_id,$standort_id,$adresse_id,$kontakt_id,$adresstyp_arr,$user,$rechte) { // Plausib if (empty($firma_id) || !is_numeric($firma_id) ) return 'Firma fehlt.'; if (empty($standort_id) || !is_numeric($standort_id) ) return 'Standort fehlt.'; // Init $htmlstr=''; // Datenlesen $kontakt_obj = new kontakt(); if($standort_id!='' && is_numeric($standort_id) ) { $kontakt_obj->result=array(); if (!$kontakt_obj->load_standort($standort_id)) { if ($kontakt_obj->errormsg) return $kontakt_obj->errormsg; else return eingabeKontakt($firma_id,$standort_id,$adresse_id,$kontakt_id,$adresstyp_arr,$user,$rechte); } } $htmlstr.= ''; $i=0; foreach ($kontakt_obj->result as $row) { $htmlstr .= "\n"; $i++; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.= ""; $htmlstr.= ''; } $htmlstr.= '
ID Typ Kontakt Anmerkung Zustellung
'.$row->kontakt_id.''.$row->kontakttyp.''.$row->kontakt.''.$row->anmerkung.''.($row->zustellung?'Ja':'Nein').'editierenstandort_id&kontakt_id=$row->kontakt_id' onclick='return confdel()'>loeschen
'; return $htmlstr; } #-------------------------------------------------------------------------------------------------------------------------------------------------------------# /** * Kontakte zu Firmen,Standorte in Listenform */ function eingabeKontakt($firma_id,$standort_id,$adresse_id,$kontakt_id,$adresstyp_arr,$user,$rechte) { // Plausib if (empty($firma_id) || !is_numeric($firma_id) ) return 'Firma für Kontakt fehlt.'; if (empty($standort_id) || !is_numeric($standort_id) ) return 'Standort für Kontakt fehlt.'; // Init $htmlstr=''; // Datenlesen $kontakt_obj = new kontakt(); if($kontakt_id!='' && is_numeric($kontakt_id) ) { $kontakt_obj->result=array(); if (!$kontakt_obj->load($kontakt_id)) return $kontakt_obj->errormsg; } else { $kontakt_obj->standort_id=$standort_id; } $htmlstr.="
\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.="\n"; // Submit-Knopf Zeile $htmlstr.=""; $htmlstr.="\n"; $htmlstr.="
\n"; //Kontakttype laden $kontakttyp_obj = new kontakt(); $kontakttyp_obj->result=array(); if (!$kontakttyp_obj->getKontakttyp()) { if ($kontakttyp_obj->errormsg) return $kontakttyp_obj->errormsg; else $kontakttyp_obj->result=array(); } $htmlstr.=""; $htmlstr.= ""; $htmlstr.=""; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="
Typ:  Kontakt:  Anmerkung:   Zustellung: zustellung?' style="background-color: #FFF4F4;" ':' style="background-color: #E3FDEE;" ')." type='checkbox' name='zustellung' ".($kontakt_obj->zustellung?'checked':'')."> 
\n"; $htmlstr.=''; $htmlstr.=""; $htmlstr.=''; $htmlstr.="
    
\n"; $htmlstr.="
\n"; return $htmlstr; } #-------------------------------------------------------------------------------------------------------------------------------------------------------------# /** * Kontakte zu Firmen,Standorte in Listenform */ function savePersonenfunktionen($firma_id,$standort_id,$personfunktionstandort_id,$adresstyp_arr,$user,$rechte) { if( !$rechte->isBerechtigt('admin',null,'suid') && !$rechte->isBerechtigt('basis/firma:begrenzt',null, 'suid')) return 'Sie haben keine Berechtigung fuer diese Aktion - Kontakte'; // Datenlesen // personfunktionstandort_id funktion_kurzbz person_id position anrede standort_id $funktion_kurzbz = (isset($_POST['funktion_kurzbz'])?$_POST['funktion_kurzbz']:''); $person_id = (isset($_POST['person_id'])?$_POST['person_id']:null); $position = (isset($_POST['position'])?$_REQUEST['position']:''); $anrede = (isset($_POST['anrede'])?$_REQUEST['anrede']:''); $funktion_kurzbz = (isset($_POST['funktion_kurzbz'])?$_POST['funktion_kurzbz']:''); // Plausib //if (empty($personfunktionstandort_id) || !is_numeric($personfunktionstandort_id) ) // return 'Personfunktionstandort_id fehlt.'; if (empty($firma_id) || !is_numeric($firma_id) ) return 'Firma fehlt.'; if (empty($standort_id) || !is_numeric($standort_id) ) return 'Standort fehlt.'; //if (empty($person_id) || !is_numeric($person_id) ) // return 'Personen ID fehlt.'; if (empty($funktion_kurzbz) ) return 'Funktion fehlt.'; // Init $htmlstr=''; //---------------------------------------- // personfunktionstandort Neuanlage - Aenderung //---------------------------------------- $standort_obj = new standort(); if($personfunktionstandort_id!='' && is_numeric($personfunktionstandort_id) ) { if($standort_obj->load_personfunktionstandort($personfunktionstandort_id)) { $standort_obj->new = false; } else { return 'Person Funktion am Standort wurde nicht gefunden:'.$personfunktionstandort_id; } } else { $standort_obj->new = true; $standort_obj->insertamum = date('Y-m-d H:i:s'); $standort_obj->insertvon = $user; } // personfunktionstandort_id funktion_kurzbz person_id position anrede standort_id $standort_obj->personfunktionstandort_id=$personfunktionstandort_id; $standort_obj->standort_id=($standort_id?$standort_id:null); $standort_obj->funktion_kurzbz=($funktion_kurzbz?$funktion_kurzbz:null); $standort_obj->person_id=($person_id?$person_id:null); $standort_obj->position=$position; $standort_obj->anrede = $anrede; if(!$standort_obj->savepersonfunktionstandort()) return 'Fehler beim Speichern der Person Funktion am Standort :'.$standort_obj->errormsg; if ($standort_obj->new) $personfunktionstandort_id=$standort_obj->personfunktionstandort_id; return 'Funktion der Person am Standort : '.$funktion_kurzbz .' '.$position.' ID '. $personfunktionstandort_id.' gespeichert'; } #-------------------------------------------------------------------------------------------------------------------------------------------------------------# /** * Ansprechpartner */ function getlistPersonenfunktionen($firma_id,$standort_id,$personfunktionstandort_id,$adresstyp_arr,$user,$rechte) { // Plausib if (empty($firma_id) || !is_numeric($firma_id) ) return 'Firma fehlt.'; if (empty($standort_id) || !is_numeric($standort_id) ) return 'Standort für Personenfunktionen fehlt.'; if (!empty($personfunktionstandort_id) && !is_numeric($personfunktionstandort_id) ) return 'ID für Personenfunktionen falsch.'; // Init $htmlstr=''; // Datenlesen $standort_obj = new standort(); if($standort_id!='' && is_numeric($standort_id) ) { $standort_obj->result=array(); if (!$standort_obj->load_personfunktionstandort('',$firma_id,$standort_id)) { if ($standort_obj->errormsg) return $standort_obj->errormsg; else return eingabePersonenfunktionen($firma_id,$standort_id,$personfunktionstandort_id,$adresstyp_arr,$user,$rechte); } } //Kontakttype laden $funktion_obj = new funktion(); $funktion_obj->result=array(); $funktionen=array(); if ($funktion_obj->getAll()) { for ($i=0;$iresult);$i++) $funktionen[$funktion_obj->result[$i]->funktion_kurzbz]=$funktion_obj->result[$i]->beschreibung; } $htmlstr.= ''; $i=0; foreach ($standort_obj->result as $row) { $htmlstr .= "\n"; $i++; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.= ''; $htmlstr.= ''; $person=($row->person_anrede?$row->person_anrede.' ':'').($row->titelpre?$row->titelpre.' ':'').($row->vorname?$row->vorname.' ':'').($row->nachname?$row->nachname.' ':''); $htmlstr.= ''; $htmlstr.= ''; $htmlstr.= ""; $htmlstr.= ""; $htmlstr.= ''; } $htmlstr.= '
ID Funktion Position Anrede Person
'. $row->personfunktionstandort_id.''.(isset($funktionen[$row->funktion_kurzbz])?$funktionen[$row->funktion_kurzbz]:$row->funktion_kurzbz).''.$row->position.''.$row->anrede.''.$person.'Funktion editierenKontaktdaten editierenstandort_id."&personfunktionstandort_id=".$row->personfunktionstandort_id."&firma_id=".$firma_id."' onclick='return confdel()'>Funktion loeschen
'; return $htmlstr; } #-------------------------------------------------------------------------------------------------------------------------------------------------------------# /** * Firmenliste - lt. Suchekriterien */ function eingabePersonenfunktionen($firma_id,$standort_id,$personfunktionstandort_id,$adresstyp_arr,$user,$rechte) { // Plausib if (empty($firma_id) || !is_numeric($firma_id) ) return 'Firma fehlt.'; if (empty($standort_id) || !is_numeric($standort_id) ) return 'Standort für Personenfunktionen fehlt.'; // Init $htmlstr=''; $standort_obj = new standort(); if($personfunktionstandort_id!='' && is_numeric($personfunktionstandort_id) ) { $standort_obj->result=array(); if (!$standort_obj->load_personfunktionstandort($personfunktionstandort_id,'',$standort_id)) return $standort_obj->errormsg; else if (isset($standort_obj->result[0]) ) $standort_obj=$standort_obj->result[0]; } else { $standort_obj->standort_id=$standort_id; } $htmlstr.="
\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.="\n"; // Submit-Knopf Zeile $tabselect=1; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.="
\n"; //Kontakttypen laden $funktion_obj = new funktion(); $funktion_obj->result=array(); if (!$funktion_obj->getAll()) { if ($funktion_obj->errormsg) return $funktion_obj->errormsg; else $funktion_obj->result=array(); } $htmlstr.=""; $htmlstr.= ""; $htmlstr.=""; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.=""; $htmlstr.="'; $htmlstr.=""; $person=($standort_obj->person_anrede?$standort_obj->person_anrede.' ':'').($standort_obj->titelpre?$standort_obj->titelpre.' ':'').($standort_obj->vorname?$standort_obj->vorname.' ':'').($standort_obj->nachname?$standort_obj->nachname.' ':''); $htmlstr.=($person?'':'')."
Funktion:  Position:  Anrede:  
Person: \n"; /* $htmlstr.=" "; */ $htmlstr.=" "; //$htmlstr.'
'; //$htmlstr.='?
 '.$person.'
\n"; $htmlstr.=''; $htmlstr.=""; $htmlstr.=''; $htmlstr.=""; $htmlstr.=""; $htmlstr.="
        
\n"; $htmlstr.="
\n"; return $htmlstr; } #-------------------------------------------------------------------------------------------------------------------------------------------------------------# /** * Firmenliste - lt. Suchekriterien */ function getStandort($firma_id,$standort_id,$adresse_id,$adresstyp_arr,$user,$rechte) { // Plausib if (empty($firma_id) || !is_numeric($firma_id) ) return 'Firma fehlt.'; // Init $htmlstr=''; // Datenlesen $standort_obj = new standort(); if($standort_id!='' && is_numeric($standort_id) ) { $standort_obj->result=array(); if (!$standort_obj->load($standort_id)) return $standort_obj->errormsg; $adresse_id=$standort_obj->adresse_id; } else { $standort_obj->firma_id=$firma_id; $standort_obj->standort_id=$standort_id; $standort_obj->adresse_id=$adresse_id; } $adresse_obj = new adresse(); if ($adresse_id!='' && !$adresse_obj->load($adresse_id)) { return $adresse_obj->errormsg; } else { $adresse_obj->adresse_id=$adresse_id; $adresse_obj->typ='f'; } $htmlstr.="
\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.="\n"; //Nationen laden $nation_arr = array(); $nation = new nation(); $nation->getAll(); foreach($nation->nation as $row) $nation_arr[$row->code]=$row->kurztext; //Auswahl Nation $htmlstr.=""; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.="
\n"; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.="
Kurzbz:  Bezeichnung:  Name:  
\n"; $htmlstr.=""; $htmlstr.= ""; //Posleitzahl $htmlstr.=""; $htmlstr.="\n"; //Gemeinde $htmlstr.=""; $htmlstr.="\n"; //Ort $htmlstr.=""; $htmlstr.="\n"; $htmlstr.="
Nation: Plz: Gemeinde:
"; if($adresse_obj->nation=='A' && $adresse_obj->plz!='') { $htmlstr.=getGemeindeDropDown($adresse_obj->plz); $style="style='display:none'"; } else { $style=""; } $htmlstr.="
"; $htmlstr.="
Ort:
"; if($adresse_obj->nation=='A' && $adresse_obj->plz!='') { $htmlstr.=getOrtDropDown($adresse_obj->plz, $adresse_obj->gemeinde); $style="style='display:none'"; } else { $style=""; } $htmlstr.="
"; $htmlstr.="
\n"; $htmlstr.=""; $htmlstr.="\n"; $htmlstr.=""; $htmlstr.=""; $htmlstr.=""; $htmlstr.=""; $htmlstr.="
Strasse: Zustelladresse:zustelladresse?'checked':'').">  
"; $htmlstr.="\n"; $htmlstr.="\n"; $htmlstr.=''; $htmlstr.="
"; $htmlstr.="\n"; $htmlstr.=" \n"; $htmlstr.="
\n"; return $htmlstr; } // ---------------------------------------------------------------------------------------------------------------------------------- /** * Standortwartung - Adressen,Personen,Kontakte */ function saveStandort($firma_id,$standort_id,$adresse_id,$adresstyp_arr,$user,$rechte) { if(!$rechte->isBerechtigt('basis/firma:begrenzt',null, 'suid')) return 'Sie haben keine Berechtigung fuer diese Aktion'; // Standort speichern $kurzbz = (isset($_POST['kurzbz'])?$_POST['kurzbz']:''); $bezeichnung = (isset($_POST['bezeichnung'])?$_REQUEST['bezeichnung']:''); // Adressen $adresstyp = (isset($_POST['adresstyp'])?$_POST['adresstyp']:''); $strasse = (isset($_POST['strasse'])?$_POST['strasse']:''); $plz = (isset($_POST['plz'])?$_POST['plz']:''); $ort = (isset($_REQUEST['ort'])?$_REQUEST['ort']:''); $name = (isset($_POST['name'])?$_POST['name']:''); $gemeinde = (isset($_REQUEST['gemeinde'])?$_REQUEST['gemeinde']:''); $nation = (isset($_POST['nation'])?$_POST['nation']:''); $zustelladresse = (isset($_POST['zustelladresse'])?true:false); //---------------------------------------- // ADRESSEN Neuanlage - Aenderung //---------------------------------------- $adresse_obj = new adresse(); if(is_numeric($adresse_id)) { if($adresse_obj->load($adresse_id)) { $adresse_obj->new = false; } else { return 'Adresse wurde nicht gefunden:'.$adresse_id; } } else { $adresse_obj->new = true; $adresse_obj->insertamum = date('Y-m-d H:i:s'); $adresse_obj->insertvon = $user; } $adresse_obj->name=$name; $adresse_obj->strasse = $strasse; $adresse_obj->nation = $nation; $adresse_obj->plz = $plz; $adresse_obj->ort = $ort; $adresse_obj->gemeinde = $gemeinde; $adresse_obj->typ = 'f'; $adresse_obj->heimatadresse = false; $adresse_obj->zustelladresse = $zustelladresse; $adresse_obj->updateamum = date('Y-m-d H:i:s'); $adresse_obj->updatvon = $user; if(!$adresse_obj->save()) return 'Fehler beim Speichern der Adresse:'.$adresse_obj->errormsg; if ($adresse_obj->new) $adresse_id=$adresse_obj->adresse_id; $standort_obj = new standort(); if(is_numeric($standort_id)) { if($standort_obj->load($standort_id)) { $standort_obj->new = false; } else { return 'Standort wurde nicht gefunden:'.$standort_id; } } else { $standort_obj->new = true; $standort_obj->insertamum = date('Y-m-d H:i:s'); $standort_obj->insertvon = $user; } if(is_numeric($adresse_id)) $standort_obj->adresse_id=$adresse_id; else $standort_obj->adresse_id=null; $standort_obj->kurzbz=$kurzbz; $standort_obj->bezeichnung=$bezeichnung; $standort_obj->firma_id=$firma_id; $standort_obj->updatevon=$user; $standort_obj->updateamum = date('Y-m-d H:i:s'); if(!$standort_obj->save()) { if ($standort_obj->new) $adresse_obj->delete($adresse_id); return 'Fehler beim Speichern des Standort:'.$standort_obj->errormsg; } if ($standort_obj->new) $standort_id=$standort_obj->standort_id; if (empty($standort_id)) return 'Abbruch nach Standort Verarbeitung! ID Fehlt '; echo ' '; return 'Standort wurde erfolgreich gespeichert '; } ?>