mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 10:22:18 +00:00
Adressen Modul
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
|
||||
require_once('../vilesci/config.inc.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
|
||||
$conn = pg_pconnect(CONN_STRING);
|
||||
|
||||
$user = get_uid();
|
||||
loadVariables($conn, $user);
|
||||
?>
|
||||
|
||||
// ****
|
||||
// * Laedt die zu bearbeitenden Daten
|
||||
// ****
|
||||
function AdresseInit(adresse_id, person_id)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
if(adresse_id!='')
|
||||
{
|
||||
//Daten holen
|
||||
var url = '<?php echo APP_ROOT ?>rdf/adresse.rdf.php?adresse_id='+adresse_id+'&'+gettimestamp();
|
||||
|
||||
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
|
||||
getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
var dsource = rdfService.GetDataSourceBlocking(url);
|
||||
|
||||
var subject = rdfService.GetResource("http://www.technikum-wien.at/adresse/" + adresse_id);
|
||||
|
||||
var predicateNS = "http://www.technikum-wien.at/adresse/rdf";
|
||||
|
||||
//Daten holen
|
||||
|
||||
person_id = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#person_id" ));
|
||||
name = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#name" ));
|
||||
strasse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#strasse" ));
|
||||
plz = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#plz" ));
|
||||
ort = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#ort" ));
|
||||
gemeinde = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#gemeinde" ));
|
||||
nation = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#nation" ));
|
||||
typ = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#typ" ));
|
||||
heimatadresse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#heimatadresse" ));
|
||||
zustelladresse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#zustelladresse" ));
|
||||
firma_id = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#firma_id" ));
|
||||
neu = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
neu = true;
|
||||
name='';
|
||||
strasse='';
|
||||
plz='';
|
||||
ort='';
|
||||
gemeinde=''
|
||||
nation='A';
|
||||
typ='h';
|
||||
heimatadresse='Ja';
|
||||
zustelladresse='Ja';
|
||||
firma_id='';
|
||||
}
|
||||
|
||||
document.getElementById('adresse-checkbox-neu').checked=neu;
|
||||
document.getElementById('adresse-textbox-person_id').value=person_id;
|
||||
document.getElementById('adresse-textbox-adresse_id').value=adresse_id;
|
||||
document.getElementById('adresse-textbox-name').value=name;
|
||||
document.getElementById('adresse-textbox-strasse').value=strasse;
|
||||
document.getElementById('adresse-textbox-plz').value=plz;
|
||||
document.getElementById('adresse-textbox-ort').value=ort;
|
||||
document.getElementById('adresse-textbox-gemeinde').value=gemeinde;
|
||||
document.getElementById('adresse-menulist-nation').value=nation;
|
||||
document.getElementById('adresse-menulist-typ').value=typ;
|
||||
if(heimatadresse=='Ja')
|
||||
document.getElementById('adresse-checkbox-heimatadresse').checked=true;
|
||||
else
|
||||
document.getElementById('adresse-checkbox-heimatadresse').checked=false;
|
||||
|
||||
if(zustelladresse=='Ja')
|
||||
document.getElementById('adresse-checkbox-zustelladresse').checked=true;
|
||||
else
|
||||
document.getElementById('adresse-checkbox-zustelladresse').checked=false;
|
||||
document.getElementById('adresse-menulist-firma').value=firma_id;
|
||||
}
|
||||
|
||||
function AdresseSpeichern()
|
||||
{
|
||||
if(window.opener.KontaktAdresseSpeichern(document))
|
||||
window.close();
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
|
||||
header("Cache-Control: no-cache");
|
||||
header("Cache-Control: post-check=0, pre-check=0",false);
|
||||
header("Expires Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Pragma: no-cache");
|
||||
header("Content-type: application/vnd.mozilla.xul+xml");
|
||||
|
||||
include('../vilesci/config.inc.php');
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
|
||||
|
||||
echo '<?xml-stylesheet href="'.APP_ROOT.'skin/tempus.css" type="text/css"?>';
|
||||
echo '<?xml-stylesheet href="'.APP_ROOT.'content/bindings.css" type="text/css"?>';
|
||||
|
||||
if(isset($_GET['adresse_id']) && is_numeric($_GET['adresse_id']))
|
||||
$adresse_id=$_GET['adresse_id'];
|
||||
else
|
||||
$adresse_id='';
|
||||
|
||||
if(isset($_GET['person_id']) && is_numeric($_GET['person_id']))
|
||||
$person_id=$_GET['person_id'];
|
||||
else
|
||||
$person_id='';
|
||||
?>
|
||||
|
||||
<window id="adresse-dialog" title="Adresse"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="AdresseInit(<?php echo ($adresse_id!=''?$adresse_id:"''").','.($person_id!=''?$person_id:"''"); ?>)"
|
||||
>
|
||||
|
||||
<script type="application/x-javascript" src="<?php echo APP_ROOT; ?>content/adressedialog.js.php" />
|
||||
<script type="application/x-javascript" src="<?php echo APP_ROOT; ?>content/functions.js.php" />
|
||||
|
||||
<vbox>
|
||||
|
||||
|
||||
|
||||
<textbox id="adresse-textbox-adresse_id" hidden="true"/>
|
||||
<textbox id="adresse-textbox-person_id" hidden="true"/>
|
||||
<checkbox id="adresse-checkbox-neu" hidden="true"/>
|
||||
|
||||
<groupbox id="adresse-groupbox" flex="1">
|
||||
<caption label="Details"/>
|
||||
<grid id="adresse-grid-detail" style="overflow:auto;margin:4px;" flex="1">
|
||||
<columns >
|
||||
<column flex="1"/>
|
||||
<column flex="5"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="Name" control="adresse-textbox-name"/>
|
||||
<hbox>
|
||||
<textbox id="adresse-textbox-name" maxlength="256" size="30"/>
|
||||
<spacer flex="1" />
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Strasse" control="adresse-textbox-strasse"/>
|
||||
<hbox>
|
||||
<textbox id="adresse-textbox-strasse" maxlength="256" size="30"/>
|
||||
<spacer flex="1" />
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Plz" control="adresse-textbox-plz"/>
|
||||
<hbox>
|
||||
<textbox id="adresse-textbox-plz" maxlength="16" size="5"/>
|
||||
<spacer flex="1" />
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Ort ??" control="adresse-textbox-ort"/>
|
||||
<hbox>
|
||||
<textbox id="adresse-textbox-ort" maxlength="256" size="30"/>
|
||||
<spacer flex="1" />
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Gemeinde ??" />
|
||||
<hbox>
|
||||
<textbox id="adresse-textbox-gemeinde" maxlength="256" size="30" />
|
||||
<spacer flex="1" />
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Nation" control="adresse-menulist-nation"/>
|
||||
<menulist id="adresse-menulist-nation"
|
||||
datasources="<?php echo APP_ROOT ?>rdf/nation.rdf.php" flex="1"
|
||||
ref="http://www.technikum-wien.at/nation/liste" >
|
||||
<template>
|
||||
<menupopup>
|
||||
<menuitem value="rdf:http://www.technikum-wien.at/nation/rdf#nation_code"
|
||||
label="rdf:http://www.technikum-wien.at/nation/rdf#kurztext"
|
||||
uri="rdf:*"/>
|
||||
</menupopup>
|
||||
</template>
|
||||
</menulist>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Typ" control="adresse-menulist-typ"/>
|
||||
<menulist id="adresse-menulist-typ"
|
||||
flex="1">
|
||||
<menupopup>
|
||||
<menuitem value="h" label="Hauptwohnsitz"/>
|
||||
<menuitem value="n" label="Nebenwohnsitz"/>
|
||||
<menuitem value="f" label="Firma"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Heimatadresse" control="adresse-checkbox-heimatadresse"/>
|
||||
<checkbox id="adresse-checkbox-heimatadresse" checked="true"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Zustelladresse" control="adresse-checkbox-zustelladresse"/>
|
||||
<checkbox id="adresse-checkbox-zustelladresse" checked="true"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="Firma" control="adresse-menulist-firma"/>
|
||||
<menulist id="adresse-menulist-firma"
|
||||
datasources="<?php echo APP_ROOT ?>rdf/firma.rdf.php?optional=true" flex="1"
|
||||
ref="http://www.technikum-wien.at/firma/liste" >
|
||||
<template>
|
||||
<menupopup>
|
||||
<menuitem value="rdf:http://www.technikum-wien.at/firma/rdf#firma_id"
|
||||
label="rdf:http://www.technikum-wien.at/firma/rdf#name"
|
||||
uri="rdf:*"/>
|
||||
</menupopup>
|
||||
</template>
|
||||
</menulist>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<hbox>
|
||||
<spacer flex="1" />
|
||||
<button id="adresse-button-speichern" oncommand="AdresseSpeichern()" label="Speichern" />
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</vbox>
|
||||
</window>
|
||||
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
|
||||
// ****************************************
|
||||
// * Insert/Update/Delete
|
||||
// * der Lehreinheiten
|
||||
// *
|
||||
// * Script sorgt fuer den Datenbanzugriff
|
||||
// * fuer das XUL - Lehreinheiten-Modul
|
||||
// *
|
||||
// * Derzeitige Funktionen:
|
||||
// * - Lehreinheitmitarbeiter Zuteilung hinzufuegen/bearbeiten/loeschen
|
||||
// * - Lehreinheitgruppe Zutelung hinzufuegen/loeschen
|
||||
// * - Lehreinheit anlegen/bearbeiten/loeschen
|
||||
// ****************************************
|
||||
|
||||
require_once('../vilesci/config.inc.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
require_once('../include/benutzerberechtigung.class.php');
|
||||
require_once('../include/log.class.php');
|
||||
require_once('../include/adresse.class.php');
|
||||
|
||||
$user = get_uid();
|
||||
|
||||
//error_reporting(0);
|
||||
|
||||
// Datenbank Verbindung
|
||||
if (!$conn = @pg_pconnect(CONN_STRING))
|
||||
$error_msg='Es konnte keine Verbindung zum Server aufgebaut werden!';
|
||||
|
||||
$return = false;
|
||||
$errormsg = 'unknown';
|
||||
$data = '';
|
||||
$error = false;
|
||||
|
||||
//Berechtigungen laden
|
||||
$rechte = new benutzerberechtigung($conn);
|
||||
$rechte->getBerechtigungen($user);
|
||||
if(!$rechte->isBerechtigt('admin'))
|
||||
{
|
||||
$return = false;
|
||||
$errormsg = 'Keine Berechtigung';
|
||||
$data = '';
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if(!$error)
|
||||
{
|
||||
if(isset($_POST['type']) && $_POST['type']=='adressesave')
|
||||
{
|
||||
//Speichert die Adressdaten in die Datenbank
|
||||
$adresse = new adresse($conn, null, true);
|
||||
|
||||
if($_POST['neu']=='false')
|
||||
{
|
||||
$adresse->load($_POST['adresse_id']);
|
||||
$adresse->new = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$adresse->insertamum = date('Y-m-d H:i:s');
|
||||
$adresse->insertvon = $user;
|
||||
$adresse->new = true;
|
||||
}
|
||||
|
||||
$adresse->adresse_id = $_POST['adresse_id'];
|
||||
$adresse->person_id = $_POST['person_id'];
|
||||
$adresse->name = $_POST['name'];
|
||||
$adresse->strasse = $_POST['strasse'];
|
||||
$adresse->plz = $_POST['plz'];
|
||||
$adresse->ort = $_POST['ort'];
|
||||
$adresse->gemeinde = $_POST['gemeinde'];
|
||||
$adresse->nation = $_POST['nation'];
|
||||
$adresse->typ = $_POST['typ'];
|
||||
$adresse->heimatadresse = ($_POST['heimatadresse']=='true'?true:false);
|
||||
$adresse->zustelladresse = ($_POST['zustelladresse']=='true'?true:false);
|
||||
$adresse->firma_id = $_POST['firma_id'];
|
||||
$adresse->updateamum = date('Y-m-d H:i:s');
|
||||
$adresse->updatevon = $user;
|
||||
$adresse->insertamum = date('Y-m-d H:i:s');
|
||||
$adresse->insertvon = $user;
|
||||
|
||||
//Wenn die Nation Oesterreich ist, dann muss die Gemeinde in der Tabelle Gemeinde vorkommen
|
||||
if($_POST['nation']=='A')
|
||||
{
|
||||
$qry = "SELECT * FROM bis.tbl_gemeinde WHERE name='".addslashes($_POST['gemeinde'])."'";
|
||||
if($result = pg_query($conn, $qry))
|
||||
{
|
||||
if(pg_num_rows($result)==0)
|
||||
{
|
||||
$error = true;
|
||||
$errormsg = 'Gemeinde ist ungueltig';
|
||||
$return = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = true;
|
||||
$errormsg = 'Fehler beim Ermitteln der Gemeinde';
|
||||
$return = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$error)
|
||||
{
|
||||
if($adresse->save())
|
||||
{
|
||||
$return = true;
|
||||
$data = $adresse->adresse_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = false;
|
||||
$errormsg = $adresse->errormsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif(isset($_POST['type']) && $_POST['type']=='adressedelete')
|
||||
{
|
||||
//Speichert die Adressdaten in die Datenbank
|
||||
$adresse = new adresse($conn, null, true);
|
||||
|
||||
if($adresse->delete($_POST['adresse_id']))
|
||||
{
|
||||
$return = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = false;
|
||||
$errormsg = $adresse->errormsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = false;
|
||||
$errormsg = 'Unkown type';
|
||||
$data = '';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<RDF:RDF
|
||||
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:NC="http://home.netscape.com/NC-rdf#"
|
||||
xmlns:DBDML="http://www.technikum-wien.at/dbdml/rdf#"
|
||||
>
|
||||
<RDF:Seq RDF:about="http://www.technikum-wien.at/dbdml/msg">
|
||||
<RDF:li>
|
||||
<RDF:Description RDF:about="http://www.technikum-wien.at/dbdml/0" >
|
||||
<DBDML:return><?php echo ($return?'true':'false'); ?></DBDML:return>
|
||||
<DBDML:errormsg><![CDATA[<?php echo $errormsg; ?>]]></DBDML:errormsg>
|
||||
<DBDML:data><![CDATA[<?php echo $data ?>]]></DBDML:data>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
</RDF:Seq>
|
||||
</RDF:RDF>
|
||||
+212
-3
@@ -33,6 +33,9 @@ var AdressenTreeDatasource=''; // Datasource des Adressen Trees
|
||||
var KontaktAdresseSelectID=null; // ID der Adresse die nach dem Rebuild markiert werden soll
|
||||
var KontaktTreeDatasource=''; // Datasource des Kontakt Trees
|
||||
var KontaktKontaktSelectID=null; // ID des Kontaktes der nach dem Rebuild markiert werden soll
|
||||
var BankverbindungTreeDatasource=''; // Datasource des Bankverbindung Trees
|
||||
var KontaktBankverbindungSelectID=null; // ID der Bankverbindung die nach dem Rebuild markiert werden soll
|
||||
var KontaktPerson_id=null;
|
||||
// ********** LISTENER UND OBSERVER ********** //
|
||||
|
||||
// ****
|
||||
@@ -102,10 +105,47 @@ var KontaktKontaktTreeListener =
|
||||
window.setTimeout(KontaktKontaktTreeSelectID,10);
|
||||
}
|
||||
};
|
||||
|
||||
// ****
|
||||
// * Observer fuer Bankverbindung Tree
|
||||
// * startet Rebuild nachdem das Refresh
|
||||
// * der Datasource fertig ist
|
||||
// ****
|
||||
var KontaktBankverbindungTreeSinkObserver =
|
||||
{
|
||||
onBeginLoad : function(pSink) {},
|
||||
onInterrupt : function(pSink) {},
|
||||
onResume : function(pSink) {},
|
||||
onError : function(pSink, pStatus, pError) {},
|
||||
onEndLoad : function(pSink)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
document.getElementById('kontakt-bankverbindung-tree').builder.rebuild();
|
||||
}
|
||||
};
|
||||
|
||||
// ****
|
||||
// * Nach dem Rebuild wird der Eintrag wieder
|
||||
// * markiert
|
||||
// ****
|
||||
var KontaktBankverbindungTreeListener =
|
||||
{
|
||||
willRebuild : function(builder) { },
|
||||
didRebuild : function(builder)
|
||||
{
|
||||
//timeout nur bei Mozilla notwendig da sonst die rows
|
||||
//noch keine values haben. Ab Seamonkey funktionierts auch
|
||||
//ohne dem setTimeout
|
||||
window.setTimeout(KontaktBankverbindungTreeSelectID,10);
|
||||
}
|
||||
};
|
||||
// ********** FUNKTIONEN ********** //
|
||||
function loadKontakte(person_id)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
KontaktPerson_id=person_id;
|
||||
|
||||
//Adressen laden
|
||||
url = "<?php echo APP_ROOT; ?>rdf/adresse.rdf.php?person_id="+person_id+"&"+gettimestamp();
|
||||
var treeAdressen=document.getElementById('kontakt-adressen-tree');
|
||||
@@ -143,6 +183,25 @@ function loadKontakte(person_id)
|
||||
treeKontakt.database.AddDataSource(KontaktTreeDatasource);
|
||||
KontaktTreeDatasource.addXMLSinkObserver(KontaktKontaktTreeSinkObserver);
|
||||
treeKontakt.builder.addListener(KontaktKontaktTreeListener);
|
||||
|
||||
//Bankverbindungen laden
|
||||
url = "<?php echo APP_ROOT; ?>rdf/bankverbindung.rdf.php?person_id="+person_id+"&"+gettimestamp();
|
||||
var treeBankverbindung=document.getElementById('kontakt-bankverbindung-tree');
|
||||
|
||||
//Alte DS entfernen
|
||||
var oldDatasources = treeBankverbindung.database.GetDataSources();
|
||||
while(oldDatasources.hasMoreElements())
|
||||
{
|
||||
treeBankverbindung.database.RemoveDataSource(oldDatasources.getNext());
|
||||
}
|
||||
|
||||
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
|
||||
BankverbindungTreeDatasource = rdfService.GetDataSource(url);
|
||||
BankverbindungTreeDatasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
BankverbindungTreeDatasource.QueryInterface(Components.interfaces.nsIRDFXMLSink);
|
||||
treeBankverbindung.database.AddDataSource(BankverbindungTreeDatasource);
|
||||
BankverbindungTreeDatasource.addXMLSinkObserver(KontaktBankverbindungTreeSinkObserver);
|
||||
treeBankverbindung.builder.addListener(KontaktBankverbindungTreeListener);
|
||||
}
|
||||
|
||||
// ********** ADRESSEN ********** //
|
||||
@@ -162,7 +221,7 @@ function KontaktAdressenTreeSelectID()
|
||||
for(var i=0;i<items;i++)
|
||||
{
|
||||
//ID der row holen
|
||||
col = tree.columns ? tree.columns["kontakt-adresse-treecol-adresse_id"] : "kontakt_adresse-treecol-adresse_id";
|
||||
col = tree.columns ? tree.columns["kontakt-adressen-treecol-adresse_id"] : "kontakt_adressen-treecol-adresse_id";
|
||||
id=tree.view.getCellText(i,col);
|
||||
|
||||
if(id == KontaktAdresseSelectID)
|
||||
@@ -174,13 +233,131 @@ function KontaktAdressenTreeSelectID()
|
||||
return true;
|
||||
}
|
||||
}
|
||||
KontaktAdresseSelectID=null;
|
||||
}
|
||||
}
|
||||
|
||||
// ****
|
||||
// * Speichert die Adressdaten
|
||||
// ****
|
||||
function KontaktAdresseSpeichern(dialog)
|
||||
{
|
||||
neu = dialog.getElementById('adresse-checkbox-neu').checked;
|
||||
person_id = dialog.getElementById('adresse-textbox-person_id').value;
|
||||
adresse_id = dialog.getElementById('adresse-textbox-adresse_id').value;
|
||||
name = dialog.getElementById('adresse-textbox-name').value;
|
||||
strasse = dialog.getElementById('adresse-textbox-strasse').value;
|
||||
plz = dialog.getElementById('adresse-textbox-plz').value;
|
||||
ort = dialog.getElementById('adresse-textbox-ort').value;
|
||||
gemeinde = dialog.getElementById('adresse-textbox-gemeinde').value;
|
||||
nation = dialog.getElementById('adresse-menulist-nation').value;
|
||||
typ = dialog.getElementById('adresse-menulist-typ').value;
|
||||
heimatadresse = dialog.getElementById('adresse-checkbox-heimatadresse').checked;
|
||||
zustelladresse = dialog.getElementById('adresse-checkbox-zustelladresse').checked;
|
||||
firma_id = dialog.getElementById('adresse-menulist-firma').value;
|
||||
|
||||
var url = '<?php echo APP_ROOT ?>content/fasDBDML.php';
|
||||
var req = new phpRequest(url,'','');
|
||||
|
||||
req.add('type', 'adressesave');
|
||||
|
||||
req.add('neu', neu);
|
||||
req.add('person_id', person_id);
|
||||
req.add('adresse_id', adresse_id);
|
||||
req.add('name', name);
|
||||
req.add('strasse', strasse);
|
||||
req.add('plz', plz);
|
||||
req.add('ort', ort);
|
||||
req.add('gemeinde', gemeinde);
|
||||
req.add('nation', nation);
|
||||
req.add('typ', typ);
|
||||
req.add('heimatadresse', heimatadresse);
|
||||
req.add('zustelladresse', zustelladresse);
|
||||
req.add('firma_id', firma_id);
|
||||
|
||||
var response = req.executePOST();
|
||||
|
||||
var val = new ParseReturnValue(response)
|
||||
|
||||
if (!val.dbdml_return)
|
||||
{
|
||||
if(val.dbdml_errormsg=='')
|
||||
alert(response)
|
||||
else
|
||||
alert(val.dbdml_errormsg)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
KontaktAdresseSelectID = val.dbdml_data;
|
||||
AdressenTreeDatasource.Refresh(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function KontaktAdresseNeu()
|
||||
{
|
||||
window.open("<?php echo APP_ROOT; ?>content/adressedialog.xul.php?person_id="+KontaktPerson_id,"","chrome, status=no, width=500, height=350, centerscreen, resizable");
|
||||
}
|
||||
|
||||
function KontaktAdresseBearbeiten()
|
||||
{
|
||||
tree = document.getElementById('kontakt-adressen-tree');
|
||||
|
||||
if (tree.currentIndex==-1) return;
|
||||
|
||||
//Ausgewaehlte ID holen
|
||||
var col = tree.columns ? tree.columns["kontakt-adressen-treecol-adresse_id"] : "kontakt-adressen-treecol-adresse_id";
|
||||
var adresse_id=tree.view.getCellText(tree.currentIndex,col);
|
||||
|
||||
window.open("<?php echo APP_ROOT; ?>content/adressedialog.xul.php?adresse_id="+adresse_id,"","chrome, status=no, width=500, height=350, centerscreen, resizable");
|
||||
}
|
||||
|
||||
function KontaktAdresseDelete()
|
||||
{
|
||||
tree = document.getElementById('kontakt-adressen-tree');
|
||||
|
||||
if (tree.currentIndex==-1) return;
|
||||
|
||||
//Ausgewaehlte ID holen
|
||||
var col = tree.columns ? tree.columns["kontakt-adressen-treecol-adresse_id"] : "kontakt-adressen-treecol-adresse_id";
|
||||
var adresse_id=tree.view.getCellText(tree.currentIndex,col);
|
||||
|
||||
if(confirm('Diese Adresse wirklich loeschen?'))
|
||||
{
|
||||
var url = '<?php echo APP_ROOT ?>content/fasDBDML.php';
|
||||
var req = new phpRequest(url,'','');
|
||||
|
||||
req.add('type', 'adressedelete');
|
||||
|
||||
req.add('adresse_id', adresse_id);
|
||||
|
||||
var response = req.executePOST();
|
||||
|
||||
var val = new ParseReturnValue(response)
|
||||
|
||||
if (!val.dbdml_return)
|
||||
{
|
||||
if(val.dbdml_errormsg=='')
|
||||
alert(response)
|
||||
else
|
||||
alert(val.dbdml_errormsg)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
AdressenTreeDatasource.Refresh(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ********** KONTAKTE ********** //
|
||||
|
||||
// ****
|
||||
// * Selectiert eine Adresse nachdem der Tree
|
||||
// * Selectiert einen Kontakt nachdem der Tree
|
||||
// * rebuildet wurde.
|
||||
// ****
|
||||
function KontaktKontaktTreeSelectID()
|
||||
@@ -188,7 +365,7 @@ function KontaktKontaktTreeSelectID()
|
||||
var tree=document.getElementById('kontakt-kontakt-tree');
|
||||
var items = tree.view.rowCount; //Anzahl der Zeilen ermitteln
|
||||
|
||||
//In der globalen Variable ist die zu selektierende Adresse gespeichert
|
||||
//In der globalen Variable ist die zu selektierende Bankverbindung gespeichert
|
||||
if(KontaktKontaktSelectID!=null)
|
||||
{
|
||||
for(var i=0;i<items;i++)
|
||||
@@ -207,4 +384,36 @@ function KontaktKontaktTreeSelectID()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ********** BANKVERBINDUNG ********** //
|
||||
|
||||
// ****
|
||||
// * Selectiert eine Bankverbindung nachdem der Tree
|
||||
// * rebuildet wurde.
|
||||
// ****
|
||||
function KontaktBankverbindungTreeSelectID()
|
||||
{
|
||||
var tree=document.getElementById('kontakt-bankverbindung-tree');
|
||||
var items = tree.view.rowCount; //Anzahl der Zeilen ermitteln
|
||||
|
||||
//In der globalen Variable ist die zu selektierende Bankverbindung gespeichert
|
||||
if(KontaktBankverbindungSelectID!=null)
|
||||
{
|
||||
for(var i=0;i<items;i++)
|
||||
{
|
||||
//ID der row holen
|
||||
col = tree.columns ? tree.columns["kontakt-bankverbindung-treecol-bankverbindung_id"] : "kontakt_bankverbindung-treecol-bankverbindung_id";
|
||||
id=tree.view.getCellText(i,col);
|
||||
|
||||
if(id == KontaktBankverbindungSelectID)
|
||||
{
|
||||
//Zeile markieren
|
||||
tree.view.selection.select(i);
|
||||
//Sicherstellen, dass die Zeile im sichtbaren Bereich liegt
|
||||
tree.treeBoxObject.ensureRowIsVisible(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,8 @@ else
|
||||
|
||||
<script type="application/x-javascript" src="<?php echo APP_ROOT; ?>content/kontakt.js.php" />
|
||||
<script type="application/x-javascript" src="<?php echo APP_ROOT; ?>content/functions.js.php" />
|
||||
<!--<script type="application/x-javascript" src="<?php echo APP_ROOT; ?>content/fasoverlay.js.php" />-->
|
||||
<script type="application/x-javascript" src="<?php echo APP_ROOT; ?>content/fasoverlay.js.php" />
|
||||
<script type="application/x-javascript" src="<?php echo APP_ROOT; ?>content/phpRequest.js.php" />
|
||||
|
||||
<vbox>
|
||||
<!-- ADRESSEN -->
|
||||
@@ -54,7 +55,7 @@ else
|
||||
<hbox>
|
||||
<tree id="kontakt-adressen-tree" seltype="single" hidecolumnpicker="false" flex="1"
|
||||
datasources="rdf:null" ref="http://www.technikum-wien.at/adresse/liste"
|
||||
onselect="KontaktAdresseSelect();"
|
||||
ondblclick="KontaktAdresseBearbeiten()"
|
||||
flags="dont-build-content"
|
||||
enableColumnDrag="true"
|
||||
style="margin-left:10px;margin-right:10px;margin-bottom:5px;" height="100"
|
||||
@@ -135,9 +136,9 @@ else
|
||||
</template>
|
||||
</tree>
|
||||
<vbox>
|
||||
<button id='kontakt-adressen-neu' label='Neu' oncommand='' />
|
||||
<button id='kontakt-adressen-bearbeiten' label='Bearbeiten' oncommand='' />
|
||||
<button id='kontakt-adressen-loeschen' label='Loeschen' oncommand='' />
|
||||
<button id='kontakt-adressen-neu' label='Neu' oncommand='KontaktAdresseNeu()' />
|
||||
<button id='kontakt-adressen-bearbeiten' label='Bearbeiten' oncommand='KontaktAdresseBearbeiten()' />
|
||||
<button id='kontakt-adressen-loeschen' label='Loeschen' oncommand='KontaktAdresseDelete()' />
|
||||
</vbox>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
@@ -100,7 +100,7 @@ function studiensemesterChange()
|
||||
if(dbdml_return=='true')
|
||||
{
|
||||
//Statusbar setzen
|
||||
document.getElementById("statusbarpanel-text").label = "Studiensemester erfolgreich geändert";
|
||||
document.getElementById("statusbarpanel-text").label = "Studiensemester erfolgreich geaendert";
|
||||
document.getElementById("statusbarpanel-semester").label = stsem;
|
||||
//MitarbeiterDetailStudiensemester_id = dbdml_errormsg;
|
||||
//Ansichten Refreshen
|
||||
|
||||
@@ -332,13 +332,14 @@ class adresse
|
||||
if($this->new)
|
||||
{
|
||||
//naechste ID aus der Sequence holen
|
||||
$qry="SELECT nextval('public.tbl_adresse_adresse_id_seq') as id;";
|
||||
$qry="SELECT currval('public.tbl_adresse_adresse_id_seq') as id;";
|
||||
if($result = pg_query($this->conn, $qry))
|
||||
{
|
||||
if($row = pg_fetch_object($result))
|
||||
{
|
||||
$this->adresse_id = $row->id;
|
||||
pg_query($this->conn, 'COMMIT');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -360,6 +361,7 @@ class adresse
|
||||
$this->errormsg = "*****\nFehler beim Speichern des Adress-Datensatzes: ".$this->person_id."\n".$qry."\n".pg_errormessage($this->conn)."\n*****\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -57,30 +57,76 @@ class bankverbindung
|
||||
function bankverbindung($conn,$bankverbindung_id=null, $unicode=false)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
if ($unicode)
|
||||
|
||||
if($unicode!=null)
|
||||
{
|
||||
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry="SET CLIENT_ENCODING TO 'LATIN9';";
|
||||
}
|
||||
if(!pg_query($conn,$qry))
|
||||
{
|
||||
$this->errormsg = "Encoding konnte nicht gesetzt werden";
|
||||
return false;
|
||||
if ($unicode)
|
||||
{
|
||||
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry="SET CLIENT_ENCODING TO 'LATIN9';";
|
||||
}
|
||||
if(!pg_query($conn,$qry))
|
||||
{
|
||||
$this->errormsg = "Encoding konnte nicht gesetzt werden";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if($bankverbindung_id!=null)
|
||||
$this->load($bankverbindung_id);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Bankverbindung mit der ID $bankverbindung_id
|
||||
* @param $bankverbindung_id ID der zu ladenden Email
|
||||
* @param $bankverbindung_id ID der zu ladenden Bankverbindung
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function load($bankverbindung_id)
|
||||
{
|
||||
//noch nicht implementiert
|
||||
if(!is_numeric($bankverbindung_id))
|
||||
{
|
||||
$this->errormsg = 'Bankverbindung_id ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_bankverbindung WHERE bankverbindung_id='$bankverbindung_id'";
|
||||
|
||||
if($result = pg_query($this->conn, $qry))
|
||||
{
|
||||
if($row = pg_fetch_object($result))
|
||||
{
|
||||
$this->bankverbindung_id = $row->bankverbindung_id;
|
||||
$this->person_id = $row->person_id;
|
||||
$this->name = $row->name;
|
||||
$this->anschrift = $row->anschrift;
|
||||
$this->bic = $row->bic;
|
||||
$this->blz = $row->blz;
|
||||
$this->iban = $row->iban;
|
||||
$this->kontonr = $row->kontonr;
|
||||
$this->typ = $row->typ;
|
||||
$this->verrechnung = ($row->verrechnung=='t'?true:false);
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->udpatevon = $row->updatevon;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->ext_id = $row->ext_id;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Datensatz wurde nicht gefunden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,14 +167,17 @@ class bankverbindung
|
||||
$this->errormsg = 'IBAN darf nicht länger als 32 Zeichen sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
//Zahlenwerte ueberpruefen
|
||||
$this->errormsg = 'Ein Zahlenfeld enthaelt ungueltige Zeichen';
|
||||
if(!is_numeric($this->person_id)) return false;
|
||||
|
||||
if(!is_numeric($this->person_id))
|
||||
{
|
||||
$this->errormsg = 'Person_id ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->errormsg = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
// ************************************************
|
||||
// * wenn $var '' ist wird "null" zurueckgegeben
|
||||
// * wenn $var !='' ist werden datenbankkritische
|
||||
@@ -139,6 +188,7 @@ class bankverbindung
|
||||
{
|
||||
return ($var!=''?"'".addslashes($var)."'":'null');
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert den aktuellen Datensatz in die Datenbank
|
||||
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
|
||||
@@ -156,7 +206,7 @@ class bankverbindung
|
||||
{
|
||||
//Neuen Datensatz einfuegen
|
||||
|
||||
$qry = 'INSERT INTO tbl_bankverbindung (person_id, name, anschrift, blz, bic,
|
||||
$qry = 'BEGIN;INSERT INTO public.tbl_bankverbindung (person_id, name, anschrift, blz, bic,
|
||||
kontonr, iban, typ, ext_id, verrechnung, insertamum, insertvon, updateamum, updatevon) VALUES('.
|
||||
$this->addslashes($this->person_id).', '.
|
||||
$this->addslashes($this->name).', '.
|
||||
@@ -187,10 +237,10 @@ class bankverbindung
|
||||
$this->errormsg = 'person_id muss eine gueltige Zahl sein: '.$this->person_id.'';
|
||||
return false;
|
||||
}
|
||||
$qryz="SELECT * FROM tbl_bankverbindung WHERE bankverbindung_id='$this->bankverbindung_id';";
|
||||
$qryz="SELECT * FROM public.tbl_bankverbindung WHERE bankverbindung_id='$this->bankverbindung_id';";
|
||||
if($resultz = pg_query($this->conn, $qryz))
|
||||
{
|
||||
while($rowz = pg_fetch_object($resultz))
|
||||
if($rowz = pg_fetch_object($resultz))
|
||||
{
|
||||
$update=false;
|
||||
if($rowz->person_id!=$this->person_id) $update=true;
|
||||
@@ -206,18 +256,18 @@ class bankverbindung
|
||||
|
||||
if($update)
|
||||
{
|
||||
$qry='UPDATE tbl_bankverbindung SET '.
|
||||
$qry='UPDATE public.tbl_bankverbindung SET '.
|
||||
'person_id='.$this->addslashes($this->person_id).', '.
|
||||
'name='.$this->addslashes($this->name).', '.
|
||||
'anschrift='.$this->addslashes($this->anschrift).', '.
|
||||
'blz='.$this->addslashes($this->blz).', '.
|
||||
'bic='.$this->addslashes($this->bic).', '.
|
||||
'kontonr='.$this->addslashes($this->kontonr).', '.
|
||||
'iban='.$this->addslashes($this->iban).', '.
|
||||
'typ='.$this->addslashes($this->typ).', '.
|
||||
'verrechnung='.($this->verrechnung?'true':'false').', '.
|
||||
'ext_id='.$this->addslashes($this->ext_id).' '.
|
||||
'WHERE bankverbindung_id='.$this->addslashes($this->bankverbindung_id).';';
|
||||
'anschrift='.$this->addslashes($this->anschrift).', '.
|
||||
'blz='.$this->addslashes($this->blz).', '.
|
||||
'bic='.$this->addslashes($this->bic).', '.
|
||||
'kontonr='.$this->addslashes($this->kontonr).', '.
|
||||
'iban='.$this->addslashes($this->iban).', '.
|
||||
'typ='.$this->addslashes($this->typ).', '.
|
||||
'verrechnung='.($this->verrechnung?'true':'false').', '.
|
||||
'ext_id='.$this->addslashes($this->ext_id).' '.
|
||||
'WHERE bankverbindung_id='.$this->addslashes($this->bankverbindung_id).';';
|
||||
$this->done=true;
|
||||
}
|
||||
}
|
||||
@@ -229,23 +279,32 @@ class bankverbindung
|
||||
//echo $qry."\n";
|
||||
if(pg_query($this->conn, $qry))
|
||||
{
|
||||
//Log schreiben
|
||||
/*$sql = $qry;
|
||||
$qry = "SELECT nextval('log_seq') as id;";
|
||||
if(!$row = pg_fetch_object(pg_query($this->conn, $qry)))
|
||||
if($this->new)
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Log-Sequence';
|
||||
return false;
|
||||
//Sequence auslesen
|
||||
$qry = "SELECT currval('public.tbl_bankverbindung_bankverbindung_id_seq') as id";
|
||||
if($result = pg_query($this->conn, $qry))
|
||||
{
|
||||
if($row = pg_fetch_object($result))
|
||||
{
|
||||
$this->bankverbindung_id = $row->id;
|
||||
pg_query($this->conn, 'COMMIT');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||
pg_query($this->conn, 'ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||
pg_query($this->conn, 'ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$qry = "INSERT INTO log(log_pk, creationdate, creationuser, sql) VALUES('$row->id', now(), '$this->updatevon', '".addslashes($sql)."')";
|
||||
if(pg_query($this->conn, $qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Log-Eintrages';
|
||||
return false;
|
||||
} */
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -267,7 +326,70 @@ class bankverbindung
|
||||
*/
|
||||
function delete($bankverbindung_id)
|
||||
{
|
||||
//noch nicht implementiert!
|
||||
if(!is_numeric($bankverbindung_id))
|
||||
{
|
||||
$this->errormsg = 'Bankverbindung_id ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "DELETE FROM public.tbl_bankverbindung WHERE bankverbindung_id='$bankverbindung_id'";
|
||||
|
||||
if(pg_query($this->conn, $qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Bankverbindung mit der ID $bankverbindung_id
|
||||
* @param $bankverbindung_id ID der zu ladenden Bankverbindung
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function load_pers($person_id)
|
||||
{
|
||||
if(!is_numeric($person_id))
|
||||
{
|
||||
$this->errormsg = 'Person_id ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_bankverbindung WHERE person_id='$person_id'";
|
||||
|
||||
if($result = pg_query($this->conn, $qry))
|
||||
{
|
||||
while($row = pg_fetch_object($result))
|
||||
{
|
||||
$obj = new bankverbindung($this->conn, null, null);
|
||||
|
||||
$obj->bankverbindung_id = $row->bankverbindung_id;
|
||||
$obj->person_id = $row->person_id;
|
||||
$obj->name = $row->name;
|
||||
$obj->anschrift = $row->anschrift;
|
||||
$obj->bic = $row->bic;
|
||||
$obj->blz = $row->blz;
|
||||
$obj->iban = $row->iban;
|
||||
$obj->kontonr = $row->kontonr;
|
||||
$obj->typ = $row->typ;
|
||||
$obj->verrechnung = ($row->verrechnung=='t'?true:false);
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->udpatevon = $row->updatevon;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->ext_id = $row->ext_id;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
+153
-52
@@ -50,34 +50,76 @@ class firma
|
||||
function firma($conn,$firma_id=null, $unicode=false)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
if ($unicode)
|
||||
|
||||
if($unicode!=null)
|
||||
{
|
||||
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
|
||||
if ($unicode)
|
||||
{
|
||||
$qry = "SET CLIENT_ENCODING TO 'UNICODE';";
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry="SET CLIENT_ENCODING TO 'LATIN9';";
|
||||
}
|
||||
if(!pg_query($conn,$qry))
|
||||
{
|
||||
$this->errormsg = "Encoding konnte nicht gesetzt werden";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry="SET CLIENT_ENCODING TO 'LATIN9';";
|
||||
}
|
||||
if(!pg_query($conn,$qry))
|
||||
{
|
||||
$this->errormsg = "Encoding konnte nicht gesetzt werden";
|
||||
return false;
|
||||
}
|
||||
//if($firma_id != null) $this->load($firma_id);
|
||||
if($firma_id != null)
|
||||
$this->load($firma_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Funktion mit der ID $adress_id
|
||||
* @param $adress_id ID der zu ladenden Funktion
|
||||
* Laedt die Firma mit der ID $firma_id
|
||||
* @param $firma_id ID der zu ladenden Funktion
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function load($adress_id)
|
||||
function load($firma_id)
|
||||
{
|
||||
//noch nicht implementiert
|
||||
if(!is_numeric($firma_id))
|
||||
{
|
||||
$this->errormsg = 'Firma_id ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SElECT * FROM public.tbl_firma WHERE firma_id='$firma_id'";
|
||||
|
||||
if($result = pg_query($this->conn, $qry))
|
||||
{
|
||||
if($row = pg_fetch_object($result))
|
||||
{
|
||||
$this->firma_id = $row->firma_id;
|
||||
$this->name = $row->name;
|
||||
$this->adresse = $row->adresse;
|
||||
$this->email = $row->email;
|
||||
$this->telefon = $row->telefon;
|
||||
$this->fax = $row->fax;
|
||||
$this->anmerkung = $row->anmerkung;
|
||||
$this->firmentyp_kurzbz = $row->firmentyp_kurzbz;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->updatevon = $row->updatevon;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->ext_id = $row->ext_id;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Datensatz wurde nicht gefunden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft die Variablen auf gueltigkeit
|
||||
* Prueft die Variablen auf Gueltigkeit
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function checkvars()
|
||||
@@ -99,6 +141,7 @@ class firma
|
||||
$this->errormsg = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
// ************************************************
|
||||
// * wenn $var '' ist wird "null" zurueckgegeben
|
||||
// * wenn $var !='' ist werden datenbankkritische
|
||||
@@ -109,6 +152,7 @@ class firma
|
||||
{
|
||||
return ($var!=''?"'".addslashes($var)."'":'null');
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert den aktuellen Datensatz in die Datenbank
|
||||
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
|
||||
@@ -124,24 +168,19 @@ class firma
|
||||
if($this->new)
|
||||
{
|
||||
//Neuen Datensatz einfuegen
|
||||
|
||||
//naechste ID aus der Sequence holen
|
||||
$qry="SELECT nextval('public.tbl_firma_firma_id_seq') as id;";
|
||||
if(!$row = pg_fetch_object(pg_query($this->conn,$qry)))
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||
return false;
|
||||
}
|
||||
$this->firma_id = $row->id;
|
||||
|
||||
$qry='INSERT INTO public.tbl_firma (firma_id, name, anmerkung, ext_id, insertamum, insertvon, updateamum, updatevon, firmentyp_kurzbz) VALUES('.
|
||||
$this->addslashes($this->firma_id).', '.
|
||||
$qry='INSERT INTO public.tbl_firma (name, adresse, email, telefon, fax, anmerkung, firmentyp_kurzbz, updateamum, updatevon, insertamum, insertvon, ext_id) VALUES('.
|
||||
$this->addslashes($this->name).', '.
|
||||
$this->addslashes($this->adresse).', '.
|
||||
$this->addslashes($this->email).', '.
|
||||
$this->addslashes($this->telefon).', '.
|
||||
$this->addslashes($this->fax).', '.
|
||||
$this->addslashes($this->anmerkung).', '.
|
||||
$this->addslashes($this->ext_id).', now(), '.
|
||||
$this->addslashes($this->insertvon).', now(), '.
|
||||
$this->addslashes($this->firmentyp_kurzbz).', '.
|
||||
$this->addslashes($this->updateamum).', '.
|
||||
$this->addslashes($this->updatevon).', '.
|
||||
$this->addslashes($this->firmentyp_kurzbz).');';
|
||||
$this->addslashes($this->insertamum).', '.
|
||||
$this->addslashes($this->insertvon).', '.
|
||||
$this->addslashes($this->ext_id).'); ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,32 +197,41 @@ class firma
|
||||
'firma_id='.$this->addslashes($this->firma_id).', '.
|
||||
'name='.$this->addslashes($this->name).', '.
|
||||
'anmerkung='.$this->addslashes($this->anmerkung).', '.
|
||||
'updateamum= now(), '.
|
||||
'updatevon='.$this->addslashes($this->updatevon).' '.
|
||||
'firmentyp='.$this->addslashes($this->firmentyp_kurzbz).' '.
|
||||
'updateamum= now(), '.
|
||||
'updatevon='.$this->addslashes($this->updatevon).' '.
|
||||
'firmentyp='.$this->addslashes($this->firmentyp_kurzbz).' '.
|
||||
'WHERE firma_id='.$this->addslashes($this->firma_id).';';
|
||||
}
|
||||
//echo $qry;
|
||||
if(pg_query($this->conn,$qry))
|
||||
{
|
||||
//Log schreiben
|
||||
/*$sql = $qry;
|
||||
$qry = "SELECT nextval('log_seq') as id;";
|
||||
if(!$row = pg_fetch_object(pg_query($this->conn, $qry)))
|
||||
if($this->new)
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Log-Sequence';
|
||||
return false;
|
||||
//Sequence lesen
|
||||
$qry="SELECT currval('public.tbl_firma_firma_id_seq') as id;";
|
||||
if($result = pg_query($this->conn, $qry))
|
||||
{
|
||||
if($row = pg_fetch_object($result))
|
||||
{
|
||||
$this->firma_id = $row->firma_id;
|
||||
pg_query($this->conn, 'COMMIT');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||
pg_query($this->conn, 'ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||
pg_query($this->conn, 'ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$qry = "INSERT INTO log(log_pk, creationdate, creationuser, sql) VALUES('$row->id', now(), '$this->updatevon', '".addslashes($sql)."')";
|
||||
if(pg_query($this->conn, $qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Log-Eintrages';
|
||||
return false;
|
||||
} */
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -199,7 +247,60 @@ class firma
|
||||
*/
|
||||
function delete($firma_id)
|
||||
{
|
||||
//noch nicht implementiert!
|
||||
if(!is_numeric($firma_id))
|
||||
{
|
||||
$this->errormsg = 'Firma_id ist ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM public.tbl_firma WHERE firma_id='$firma_id'";
|
||||
|
||||
if(pg_query($this->conn, $qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle Firmen
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
function getAll()
|
||||
{
|
||||
$qry = "SElECT * FROM public.tbl_firma";
|
||||
|
||||
if($result = pg_query($this->conn, $qry))
|
||||
{
|
||||
while($row = pg_fetch_object($result))
|
||||
{
|
||||
$fa = new firma($this->conn, null, null);
|
||||
|
||||
$fa->firma_id = $row->firma_id;
|
||||
$fa->name = $row->name;
|
||||
$fa->adresse = $row->adresse;
|
||||
$fa->email = $row->email;
|
||||
$fa->telefon = $row->telefon;
|
||||
$fa->fax = $row->fax;
|
||||
$fa->anmerkung = $row->anmerkung;
|
||||
$fa->firmentyp_kurzbz = $row->firmentyp_kurzbz;
|
||||
$fa->updateamum = $row->updateamum;
|
||||
$fa->updatevon = $row->updatevon;
|
||||
$fa->insertamum = $row->insertamum;
|
||||
$fa->insertvon = $row->insertvon;
|
||||
$fa->ext_id = $row->ext_id;
|
||||
|
||||
$this->result[] = $fa;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
// header für no cache
|
||||
header("Cache-Control: no-cache");
|
||||
header("Cache-Control: post-check=0, pre-check=0",false);
|
||||
header("Expires Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Pragma: no-cache");
|
||||
// content type setzen
|
||||
header("Content-type: application/xhtml+xml");
|
||||
// xml
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
// DAO
|
||||
require_once('../vilesci/config.inc.php');
|
||||
require_once('../include/bankverbindung.class.php');
|
||||
require_once('../include/datum.class.php');
|
||||
|
||||
// Datenbank Verbindung
|
||||
if (!$conn = pg_pconnect(CONN_STRING))
|
||||
die('Es konnte keine Verbindung zum Server aufgebaut werden!');
|
||||
|
||||
if(isset($_GET['person_id']))
|
||||
$person_id = $_GET['person_id'];
|
||||
else
|
||||
$person_id = '';
|
||||
|
||||
if(isset($_GET['bankverbindung_id']))
|
||||
$bankverbindung_id = $_GET['bankverbindung_id'];
|
||||
else
|
||||
$bankverbindung_id = '';
|
||||
|
||||
$datum = new datum();
|
||||
|
||||
$bankverbindung = new bankverbindung($conn, null, true);
|
||||
|
||||
$rdf_url='http://www.technikum-wien.at/bankverbindung';
|
||||
|
||||
echo '
|
||||
<RDF:RDF
|
||||
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:BANKVERBINDUNG="'.$rdf_url.'/rdf#"
|
||||
>
|
||||
|
||||
<RDF:Seq about="'.$rdf_url.'/liste">
|
||||
';
|
||||
|
||||
if($bankverbindung_id!='')
|
||||
{
|
||||
$bankverbindung->load($bankverbindung_id);
|
||||
draw_rdf($bankverbindung);
|
||||
}
|
||||
else
|
||||
{
|
||||
$bankverbindung->load_pers($person_id);
|
||||
foreach ($bankverbindung->result as $row)
|
||||
draw_rdf($row);
|
||||
}
|
||||
|
||||
function draw_rdf($row)
|
||||
{
|
||||
global $rdf_url;
|
||||
|
||||
echo '
|
||||
<RDF:li>
|
||||
<RDF:Description id="'.$row->bankverbindung_id.'" about="'.$rdf_url.'/'.$row->bankverbindung_id.'" >
|
||||
<BANKVERBINDUNG:bankverbindung_id><![CDATA['.$row->bankverbindung_id.']]></BANKVERBINDUNG:bankverbindung_id>
|
||||
<BANKVERBINDUNG:person_id><![CDATA['.$row->person_id.']]></BANKVERBINDUNG:person_id>
|
||||
<BANKVERBINDUNG:name><![CDATA['.$row->name.']]></BANKVERBINDUNG:name>
|
||||
<BANKVERBINDUNG:anschrift><![CDATA['.$row->anschrift.']]></BANKVERBINDUNG:anschrift>
|
||||
<BANKVERBINDUNG:bic><![CDATA['.$row->bic.']]></BANKVERBINDUNG:bic>
|
||||
<BANKVERBINDUNG:blz><![CDATA['.$row->blz.']]></BANKVERBINDUNG:blz>
|
||||
<BANKVERBINDUNG:iban><![CDATA['.$row->iban.']]></BANKVERBINDUNG:iban>
|
||||
<BANKVERBINDUNG:kontonr><![CDATA['.$row->kontonr.']]></BANKVERBINDUNG:kontonr>
|
||||
<BANKVERBINDUNG:typ><![CDATA['.$row->typ.']]></BANKVERBINDUNG:typ>
|
||||
<BANKVERBINDUNG:verrechnung><![CDATA['.($row->verrechnung?'Ja':'Nein').']]></BANKVERBINDUNG:verrechnung>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
';
|
||||
}
|
||||
?>
|
||||
</RDF:Seq>
|
||||
</RDF:RDF>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
// header für no cache
|
||||
header("Cache-Control: no-cache");
|
||||
header("Cache-Control: post-check=0, pre-check=0",false);
|
||||
header("Expires Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Pragma: no-cache");
|
||||
// content type setzen
|
||||
header("Content-type: application/xhtml+xml");
|
||||
// xml
|
||||
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
// DAO
|
||||
require_once('../vilesci/config.inc.php');
|
||||
require_once('../include/firma.class.php');
|
||||
require_once('../include/datum.class.php');
|
||||
|
||||
// Datenbank Verbindung
|
||||
if (!$conn = pg_pconnect(CONN_STRING))
|
||||
die('Es konnte keine Verbindung zum Server aufgebaut werden!');
|
||||
|
||||
if(isset($_GET['firma_id']))
|
||||
$firma_id = $_GET['firma_id'];
|
||||
else
|
||||
$firma_id = '';
|
||||
|
||||
$datum = new datum();
|
||||
|
||||
$firma = new firma($conn, null, true);
|
||||
|
||||
$rdf_url='http://www.technikum-wien.at/firma';
|
||||
|
||||
echo '
|
||||
<RDF:RDF
|
||||
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:FIRMA="'.$rdf_url.'/rdf#"
|
||||
>
|
||||
|
||||
<RDF:Seq about="'.$rdf_url.'/liste">
|
||||
';
|
||||
|
||||
if(isset($_GET['optional']) && $_GET['optional']=='true')
|
||||
{
|
||||
echo '
|
||||
<RDF:li>
|
||||
<RDF:Description id="" about="" >
|
||||
<FIRMA:firma_id><![CDATA[]]></FIRMA:firma_id>
|
||||
<FIRMA:name><![CDATA[-- keine Auswahl --]]></FIRMA:name>
|
||||
<FIRMA:adresse><![CDATA[]]></FIRMA:adresse>
|
||||
<FIRMA:email><![CDATA[]]></FIRMA:email>
|
||||
<FIRMA:telefon><![CDATA[]]></FIRMA:telefon>
|
||||
<FIRMA:fax><![CDATA[]]></FIRMA:fax>
|
||||
<FIRMA:anmerkung><![CDATA[]]></FIRMA:anmerkung>
|
||||
<FIRMA:firmentyp_kurzbz><![CDATA[]]></FIRMA:firmentyp_kurzbz>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
';
|
||||
}
|
||||
|
||||
if($firma_id!='')
|
||||
{
|
||||
$firma->load($firma_id);
|
||||
draw_rdf($firma);
|
||||
}
|
||||
else
|
||||
{
|
||||
$firma->getAll($firma_id);
|
||||
foreach ($firma->result as $row)
|
||||
draw_rdf($row);
|
||||
}
|
||||
|
||||
function draw_rdf($row)
|
||||
{
|
||||
global $rdf_url;
|
||||
|
||||
echo '
|
||||
<RDF:li>
|
||||
<RDF:Description id="'.$row->firma_id.'" about="'.$rdf_url.'/'.$row->firma_id.'" >
|
||||
<FIRMA:firma_id><![CDATA['.$row->firma_id.']]></FIRMA:firma_id>
|
||||
<FIRMA:name><![CDATA['.$row->name.']]></FIRMA:name>
|
||||
<FIRMA:adresse><![CDATA['.$row->adresse.']]></FIRMA:adresse>
|
||||
<FIRMA:email><![CDATA['.$row->email.']]></FIRMA:email>
|
||||
<FIRMA:telefon><![CDATA['.$row->telefon.']]></FIRMA:telefon>
|
||||
<FIRMA:fax><![CDATA['.$row->fax.']]></FIRMA:fax>
|
||||
<FIRMA:anmerkung><![CDATA['.$row->anmerkung.']]></FIRMA:anmerkung>
|
||||
<FIRMA:firmentyp_kurzbz><![CDATA['.$row->firmentyp_kurzbz.']]></FIRMA:firmentyp_kurzbz>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
';
|
||||
}
|
||||
?>
|
||||
</RDF:Seq>
|
||||
</RDF:RDF>
|
||||
Reference in New Issue
Block a user