From 26799839150d0d40b066aec0cf9a558a36fccadc Mon Sep 17 00:00:00 2001 From: Rudolf Hangl Date: Thu, 18 Mar 2010 15:22:33 +0000 Subject: [PATCH] --- vilesci/stammdaten/firma_details.php | 36 +- vilesci/stammdaten/firma_detailwork.php | 534 ++++++++++++------ vilesci/stammdaten/firma_frameset.html | 2 +- .../stammdaten/stammdaten_autocomplete.php | 43 +- 4 files changed, 417 insertions(+), 198 deletions(-) diff --git a/vilesci/stammdaten/firma_details.php b/vilesci/stammdaten/firma_details.php index 64e0c1690..b16295dec 100644 --- a/vilesci/stammdaten/firma_details.php +++ b/vilesci/stammdaten/firma_details.php @@ -54,6 +54,7 @@ // Defaultwerte $adresstyp_arr = array('h'=>'Hauptwohnsitz','n'=>'Nebenwohnsitz','f'=>'Firma',''=>''); $errorstr=''; + $tabselect=0; //Loeschen einer Adresse if(isset($_GET['deleteadresse'])) @@ -97,6 +98,7 @@ } else $errorstr=($errorstr?$errorstr.', ':'').'Fehler beim Loeschen Firma/Organisation : ID fehlt'; + $tabselect=1; } ?> @@ -107,6 +109,7 @@ Firma - Details + @@ -125,9 +128,9 @@ return false; } - function workFirmaDetail(wohin) + function workFirmaDetail(wohin,welches) { - + $('.selector').tabs('option', 'selected', welches); $("div##"+wohin).show("slow"); // div# langsam oeffnen $("div#"+wohin).html('warten'); var formdata = $('form#addFirma').serialize(); @@ -153,7 +156,9 @@ $(function() { $("ul.css-tabs").tabs("div.css-panes > div", {effect: 'ajax'}).history(); + $('.selector').tabs('option', 'selected', ) }); + @@ -249,7 +254,7 @@ div.css-panes div { if (!$ajax) echo getFirmadetail($firma_id,$adresstyp_arr,$user); else if (is_numeric($status)) - echo "Daten erfolgreich gespeichert" ; + echo "Daten erfolgreich gespeichert"; if (!is_numeric($status)) echo $status; break; @@ -316,7 +321,7 @@ function getFirmadetail($firma_id,$adresstyp_arr,$user) $htmlstr.="\n"; //$htmlstr.=" "; if($firma_id!='' && is_numeric($firma_id) ) - $htmlstr.="\n"; + $htmlstr.="\n"; else $htmlstr.="\n"; $htmlstr.=""; @@ -481,10 +486,10 @@ function getStandortliste($firma_id,$adresstyp_arr,$user) Heimatadr. Zustelladr. Ext.Id - + '; #var_dump($standort_obj); - $i=0; + $i=1; foreach ($standort_obj->result as $row) { @@ -531,9 +536,10 @@ function getStandortliste($firma_id,$adresstyp_arr,$user) $htmlstr.= ''.$adresse_obj->ort.''; $htmlstr.= ''.$adresse_obj->strasse.''; $htmlstr.= ''.$adresstyp_arr[$adresse_obj->typ].''; - $htmlstr.= ''.($adresse_obj->heimatadresse?'Ja':'Nein').''; - $htmlstr.= ''.($adresse_obj->zustelladresse?'Ja':'Nein').''; - $htmlstr.= ''.$row->ext_id.''; + $htmlstr.= ''.($adresse_obj->heimatadresse?'Ja':'Nein').''; + $htmlstr.= ''.($adresse_obj->zustelladresse?'Ja':'Nein').''; + $htmlstr.= ''.$row->ext_id.''; + $htmlstr.= 'editieren'; $htmlstr.= "standort_id&adresse_id=$adresse_obj->adresse_id&firma_id=$firma_id' onclick='return confdel()'>loeschen"; } else @@ -546,7 +552,7 @@ function getStandortliste($firma_id,$adresstyp_arr,$user) } // ---------------------------------------------------------------------------------------------------------------------------------- /* - Standortliste + Organisationsliste */ function getOrganisationsliste($firma_id,$adresstyp_arr,$user) { @@ -568,7 +574,9 @@ function getOrganisationsliste($firma_id,$adresstyp_arr,$user) Typ Bezeichnung Kundennummer - + + '; $i=0; @@ -581,7 +589,7 @@ function getOrganisationsliste($firma_id,$adresstyp_arr,$user) $htmlstr.= ''.$row->bezeichnung.''; $htmlstr.= ''.$row->kundennummer.''; - + $htmlstr.= 'editieren'; $htmlstr.= "firma_organisationseinheit_id."&oe_kurzbz=".$row->oe_kurzbz."&firma_id=".$firma_id."' onclick='return confdel()'>loeschen"; $htmlstr.= ''; } @@ -591,7 +599,7 @@ function getOrganisationsliste($firma_id,$adresstyp_arr,$user) } // ---------------------------------------------------------------------------------------------------------------------------------- /* - Anmerungen + Anmerkungen */ function getAnmerkungen($firma_id,$user) { @@ -620,7 +628,7 @@ function getAnmerkungen($firma_id,$user) $htmlstr.= ""; $htmlstr.= "Anmerkungen:"; if($firma_id!='' && is_numeric($firma_id) ) - $htmlstr.="\n"; + $htmlstr.="\n"; else $htmlstr.="\n"; $htmlstr.= ""; diff --git a/vilesci/stammdaten/firma_detailwork.php b/vilesci/stammdaten/firma_detailwork.php index f9a89a7a8..78770e266 100644 --- a/vilesci/stammdaten/firma_detailwork.php +++ b/vilesci/stammdaten/firma_detailwork.php @@ -15,56 +15,144 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * Authors: Christian Paminger < christian.paminger@technikum-wien.at > + * Authors: Christian Paminger < christian.paminger@technikum-wien.at > * Andreas Oesterreicher < andreas.oesterreicher@technikum-wien.at > - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > + * Rudolf Hangl < rudolf.hangl@technikum-wien.at > * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > */ - $firma_id = (isset($_REQUEST["firma_id"])?$_REQUEST['firma_id']:''); - - require_once('../../config/vilesci.config.inc.php'); - require_once('../../include/functions.inc.php'); - - require_once('../../include/firma.class.php'); +$firma_id = (isset($_REQUEST["firma_id"])?$_REQUEST['firma_id']:''); + +require_once('../../config/vilesci.config.inc.php'); +require_once('../../include/functions.inc.php'); - require_once('../../include/funktion.class.php'); - - require_once('../../include/standort.class.php'); - require_once('../../include/adresse.class.php'); +require_once('../../include/firma.class.php'); - require_once('../../include/kontakt.class.php'); - require_once('../../include/person.class.php'); +require_once('../../include/funktion.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.'); +require_once('../../include/standort.class.php'); +require_once('../../include/adresse.class.php'); - // ******* INIT ******** - $user = get_uid(); - //Zugriffsrechte pruefen - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($user); - if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('basis/firma')) - die('Sie haben keine Berechtigung für diese Seite'); - - - // Parameter einlesen - $errorstr=''; +require_once('../../include/kontakt.class.php'); +require_once('../../include/person.class.php'); - $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']:''); +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('admin') && !$rechte->isBerechtigt('basis/firma')) + die('Sie haben keine Berechtigung für diese Seite'); + + +// Parameter einlesen +$errorstr=''; + +$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',''=>''); @@ -146,14 +234,144 @@ + - - + + + + + function formatItem(row) + { + return row[0] + '
  • ' + row[1] + '
  • '; + } + //$(document).ready(function() + //{ + $('#position').autocomplete('stammdaten_autocomplete.php', + { + minChars:1, + matchSubset:1,matchContains:1, + width:400, + formatItem:formatItem, + extraParams:{'work':'position' + ,'funktion_kurzbz':$('#funktion_kurzbz').val() + } + }); + //}); + "; $htmlstr.=" "; $htmlstr.="Anrede: "; - $htmlstr.="\n"; - $htmlstr.=" "; - $htmlstr.="Person: "; - $htmlstr.="\n"; + $htmlstr.="\n"; + $htmlstr.=" "; + $htmlstr.="Person: "; + $htmlstr.="\n"; $htmlstr.=" + function formatItem(row) + { + return row[0] + '
  • ' + row[1] + '
  • '; + } + //$(document).ready(function() + //{ + $('#person_id').autocomplete('stammdaten_autocomplete.php', + { + minChars:2, + matchSubset:1,matchContains:1, + width:400, + formatItem:formatItem, + extraParams:{'work':'person'} + }); + //}); + "; $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?''.$person.'':'').""; + $htmlstr.=($person?''.$person.'':'').""; $htmlstr.="\n"; // Submit-Knopf Zeile @@ -1106,79 +1333,54 @@ function getStandort($firma_id,$standort_id,$adresse_id,$adresstyp_arr,$user,$re foreach($nation->nation as $row) $nation_arr[$row->code]=$row->kurztext; + //Auswahl Nation $htmlstr.="\n"; - $htmlstr.=""; - $htmlstr.= ""; - - $htmlstr.=""; - $htmlstr.="\n"; - $htmlstr.=""; - $htmlstr.=""; - $htmlstr.="\n"; - $htmlstr.=""; - $htmlstr.=""; - $htmlstr.="\n"; - $htmlstr.=""; + $htmlstr.=""; + $htmlstr.= ""; + + //Posleitzahl + $htmlstr.=""; + $htmlstr.="\n"; + + //Gemeinde + $htmlstr.=""; + + $htmlstr.="\n"; + + + //Ort + $htmlstr.=""; + $htmlstr.="\n"; + + $htmlstr.="
    Nation: Gemeinde: Plz: Ort: 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.="
    "; ##var_dump($adresse_obj); $htmlstr.="\n"; @@ -1218,9 +1420,9 @@ function saveStandort($firma_id,$standort_id,$adresse_id,$adresstyp_arr,$user,$r $adresstyp = (isset($_POST['adresstyp'])?$_POST['adresstyp']:''); $strasse = (isset($_POST['strasse'])?$_POST['strasse']:''); $plz = (isset($_POST['plz'])?$_POST['plz']:''); - $ort = (isset($_POST['ort'])?$_POST['ort']:''); + $ort = (isset($_REQUEST['ort'])?$_REQUEST['ort']:''); $name = (isset($_POST['name'])?$_POST['name']:''); - $gemeinde = (isset($_POST['gemeinde'])?$_POST['gemeinde']:''); + $gemeinde = (isset($_REQUEST['gemeinde'])?$_REQUEST['gemeinde']:''); $nation = (isset($_POST['nation'])?$_POST['nation']:''); $heimatadresse = (isset($_POST['heimatadresse'])?true:false); $zustelladresse = (isset($_POST['zustelladresse'])?true:false); @@ -1255,10 +1457,10 @@ function saveStandort($firma_id,$standort_id,$adresse_id,$adresstyp_arr,$user,$r $adresse_obj->person_id=null; $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->nation = $nation; $adresse_obj->typ = $adresstyp; $adresse_obj->heimatadresse = $heimatadresse; $adresse_obj->zustelladresse = $zustelladresse; diff --git a/vilesci/stammdaten/firma_frameset.html b/vilesci/stammdaten/firma_frameset.html index 4525321c6..1627588d1 100644 --- a/vilesci/stammdaten/firma_frameset.html +++ b/vilesci/stammdaten/firma_frameset.html @@ -8,7 +8,7 @@ - + diff --git a/vilesci/stammdaten/stammdaten_autocomplete.php b/vilesci/stammdaten/stammdaten_autocomplete.php index 3909b0ada..93b489ef0 100644 --- a/vilesci/stammdaten/stammdaten_autocomplete.php +++ b/vilesci/stammdaten/stammdaten_autocomplete.php @@ -32,7 +32,7 @@ header('Content-Type: text/html;charset=UTF-8'); // ---------------- Vilesci Include Dateien einbinden - require_once('../../config/cis.config.inc.php'); + require_once('../../config/vilesci.config.inc.php'); require_once('../../include/functions.inc.php'); include_once('../../include/basis_db.class.php'); require_once('../../include/benutzerberechtigung.class.php'); @@ -80,13 +80,16 @@ cellSeparator (default value: "|") { case 'gemeinde': $gemeinde=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:'')); + $nation=trim((isset($_REQUEST['nation']) ? $_REQUEST['nation']:'')); + if ($nation!='A') + exit(); if (is_null($gemeinde) || $gemeinde=='') exit(); $matchcode=mb_strtoupper(addslashes(str_replace(array('*','%',',',';',"'",'"',' '),'%',trim($gemeinde)))); - $pWhere=" upper(position) like '%".addslashes($matchcode)."%' ".($nation?" and nation='".addslashes($nation)."'":''); - $pSql="SELECT distinct nation,gemeinde - FROM public.tbl_adresse + $pWhere=" upper(gemeinde) like '%".addslashes($matchcode)."%' "; + $pSql="SELECT distinct gemeinde + FROM bis.tbl_gemeinde where ". $pWhere ." ORDER BY nation,gemeinde "; @@ -101,23 +104,26 @@ cellSeparator (default value: "|") if (!$oRresult=$db->SQL($pArt,$pDistinct,$pFields,$pTable,$pWhere,$pOrder,$pLimit,$pSql)) { - exit(' |'.$db->errormsg."\n"); + exit(' |'.$db->errormsg."\n"); } for ($i=0;$igemeinde).'|'.html_entity_decode($oRresult[$i]->nation)."\n"; + echo html_entity_decode($oRresult[$i]->gemeinde).'|'.html_entity_decode($nation)."\n"; break; case 'plz': $plz=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:'')); + $nation=trim((isset($_REQUEST['nation']) ? $_REQUEST['nation']:'')); + if ($nation!='A') + exit(); if (is_null($plz) || $plz=='') exit(); - $matchcode=mb_strtoupper(addslashes(str_replace(array('*','%',',',';',"'",'"',' '),'%',trim($gemeinde)))); - $pWhere=" upper(position) like '%".addslashes($matchcode)."%' ".($nation?" and nation='".addslashes($nation)."'":''); - $pSql="SELECT distinct nation,plz - FROM public.tbl_adresse + $matchcode=mb_strtoupper(addslashes(str_replace(array('*','%',',',';',"'",'"',' '),'%',trim($plz)))); + $pWhere=" to_char(plz,'999999') like '%".addslashes($matchcode)."%' "; + $pSql="SELECT distinct plz + FROM bis.tbl_gemeinde where ". $pWhere ." - ORDER BY nation,plz "; + ORDER BY plz "; $pArt=''; $pDistinct=true; @@ -132,16 +138,19 @@ cellSeparator (default value: "|") exit(' |'.$db->errormsg."\n"); } for ($i=0;$iplz).'|'.html_entity_decode($oRresult[$i]->nation)."\n"; + echo html_entity_decode($oRresult[$i]->plz)."\n"; break; case 'ort': - $plz=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:'')); - if (is_null($plz) || $plz=='') + $ort=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:'')); + $nation=trim((isset($_REQUEST['nation']) ? $_REQUEST['nation']:'')); + if ($nation!='A') + exit(); + if (is_null($ort) || $ort=='') exit(); - $matchcode=mb_strtoupper(addslashes(str_replace(array('*','%',',',';',"'",'"',' '),'%',trim($gemeinde)))); - $pWhere=" upper(position) like '%".addslashes($matchcode)."%' ".($nation?" and nation='".addslashes($nation)."'":''); + $matchcode=mb_strtoupper(addslashes(str_replace(array('*','%',',',';',"'",'"',' '),'%',trim($ort)))); + $pWhere=" upper(ort) like '%".addslashes($matchcode)."%' ".($nation?" and nation='".addslashes($nation)."'":''); $pSql="SELECT distinct plz,ort FROM public.tbl_adresse where ". $pWhere ." @@ -273,7 +282,7 @@ cellSeparator (default value: "|") case 'person': $person_id=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:'')); if (is_null($person_id) || $person_id=='') - exit(); + exit('person_id wurde nicht übergeben!'); $matchcode=mb_strtoupper(addslashes(str_replace(array('*','%',',',';',"'",'"',' '),'%',trim($person_id)))); $pWhere=" aktiv ";