mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Umstellung auf Basisklasse und Datenbankklasse
This commit is contained in:
@@ -24,71 +24,55 @@
|
||||
* Klasse betriebsmitteltyp (FAS-Online)
|
||||
* @create 13-01-2007
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class betriebsmitteltyp
|
||||
class betriebsmitteltyp extends basis_db
|
||||
{
|
||||
var $conn; // resource DB-Handle
|
||||
var $errormsg; // string
|
||||
var $new; // boolean
|
||||
var $result = array();
|
||||
public $new;
|
||||
public $result = array();
|
||||
|
||||
//Tabellenspalten
|
||||
var $betriebsmitteltyp; //string
|
||||
var $beschreibung; //string
|
||||
var $anzahl; //smallint
|
||||
var $kaution; //numeric(5,2)
|
||||
public $betriebsmitteltyp; //string
|
||||
public $beschreibung; //string
|
||||
public $anzahl; //smallint
|
||||
public $kaution; //numeric(5,2)
|
||||
|
||||
// ************************************************
|
||||
// * Konstruktor
|
||||
// * @param $conn Connection zur DB
|
||||
// * $betriebsmitteltyp
|
||||
// ************************************************
|
||||
function betriebsmitteltyp($conn, $betriebsmitteltyp=null, $unicode=false)
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $betriebsmitteltyp
|
||||
*/
|
||||
public function __construct($betriebsmitteltyp=null)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
/*
|
||||
if($unicode!=null)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
*/
|
||||
parent::__construct();
|
||||
|
||||
if($betriebsmitteltyp!=null)
|
||||
$this->load($betriebsmitteltyp);
|
||||
}
|
||||
|
||||
// *******************************************************
|
||||
// * Laedt die Funktion mit der ID $betriebsmitteltyp
|
||||
// * @param $betriebsmitteltyp
|
||||
// * @return true wenn ok, false im Fehlerfall
|
||||
// ********************************************************
|
||||
function load($code)
|
||||
/**
|
||||
* Laedt die Funktion mit der ID $betriebsmitteltyp
|
||||
* @param $betriebsmitteltyp
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function load($betriebsmitteltyp)
|
||||
{
|
||||
$this->errormsg = 'Noch nicht implementiert';
|
||||
$this->errormsg = 'Noch nicht implementiert';
|
||||
return false;
|
||||
}
|
||||
|
||||
// *****************************************
|
||||
// * Laedt alle betriebsmitteltypen
|
||||
// * @return true wenn ok, false wenn Fehler
|
||||
// *****************************************
|
||||
function getAll()
|
||||
/**
|
||||
* Laedt alle BetriebsmittelTypen
|
||||
* @return true wenn ok, false wenn Fehler
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$qry = "SELECT * FROM public.tbl_betriebsmitteltyp ORDER BY betriebsmitteltyp";
|
||||
|
||||
if($result = pg_query($this->conn, $qry))
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = pg_fetch_object($result))
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$bmt = new betriebsmitteltyp($this->conn, null, null);
|
||||
$bmt = new betriebsmitteltyp();
|
||||
|
||||
$bmt->betriebsmitteltyp = $row->betriebsmitteltyp;
|
||||
$bmt->beschreibung = $row->beschreibung;
|
||||
@@ -101,44 +85,34 @@ class betriebsmitteltyp
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim laden der Daten';
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addslashes($var)
|
||||
{
|
||||
return ($var!=''?"'".addslashes($var)."'":'null');
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// * Speichert die Daten in die Datenbank
|
||||
// * @return true wenn erfolgreich, false im Fehlerfall
|
||||
// ************************************************************
|
||||
function save()
|
||||
|
||||
/**
|
||||
* Speichert die Daten in die Datenbank
|
||||
* @return true wenn erfolgreich, false im Fehlerfall
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$dbanzahl=0;
|
||||
$qry='';
|
||||
$qry1='SELECT * FROM public.tbl_betriebsmitteltyp WHERE beschreibung='.$this->addslashes($this->beschreibung).';';
|
||||
if($result1=pg_query($this->conn,$qry1))
|
||||
if($this->db_query($qry1))
|
||||
{
|
||||
if(pg_num_rows($result1)>0) //eintrag gefunden
|
||||
if($this->db_num_rows()>0) //eintrag gefunden
|
||||
{
|
||||
if($row1 = pg_fetch_object($result1))
|
||||
if($row1 = $this->db_fetch_object())
|
||||
{
|
||||
if($row1->anzahl==null)
|
||||
{
|
||||
$dbanzahl=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbanzahl=$row1->anzahl;
|
||||
}
|
||||
|
||||
$qry='UPDATE public.tbl_betriebsmitteltyp SET '.
|
||||
'anzahl ='.$dbanzahl."+".$this->anzahl.' '.
|
||||
'anzahl ='.addslashes($dbanzahl)."+".addslashes($this->anzahl).' '.
|
||||
'WHERE beschreibung='.$this->addslashes($this->beschreibung).';';
|
||||
echo nl2br($qry."\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -148,21 +122,21 @@ class betriebsmitteltyp
|
||||
$this->addslashes($this->beschreibung).', '.
|
||||
$this->addslashes($this->anzahl).', '.
|
||||
$this->addslashes($this->kaution).');';
|
||||
echo nl2br($qry."\n");
|
||||
}
|
||||
if(pg_query($this->conn,$qry))
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Betriebsmitteltypen-Datensatzes: '.$this->betriebsmitteltyp.' '.$qry;
|
||||
$this->errormsg = 'Fehler beim Speichern des Betriebsmitteltypen-Datensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Zugriff auf den Betriebsmitteltypen-Datensatz: '.$this->betriebsmitteltyp.' '.$qry;
|
||||
$this->errormsg = 'Fehler beim Zugriff auf den Betriebsmitteltypen-Datensatz';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user