From c2d33ac1af47d7ff8cade1238ff5fe57d9d5e7e0 Mon Sep 17 00:00:00 2001 From: Karl Burkhart Date: Fri, 26 Nov 2010 12:32:49 +0000 Subject: [PATCH] --- include/wawi_bestellstatus.class.php | 171 +++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 include/wawi_bestellstatus.class.php diff --git a/include/wawi_bestellstatus.class.php b/include/wawi_bestellstatus.class.php new file mode 100644 index 000000000..91f0e8c9b --- /dev/null +++ b/include/wawi_bestellstatus.class.php @@ -0,0 +1,171 @@ +, + * Andreas Oesterreicher and + * Karl Burkhart . + */ +/** + * Klasse WaWi Bestelldetail + */ + +require_once(dirname(__FILE__).'/basis_db.class.php'); + +class wawi_bestellstatus extends basis_db +{ + public $new; // bool + public $result = array(); // Aufteilungsobjekt array + + public $bestellung_bestellstatus_id; // integer + public $bestellung_id; + public $bestellstatus_kurzbz; + public $uid; + public $oe_kurzbz; + public $datum; + public $insertvon; + public $insertamum; + public $updatevon; + public $updateamum; + + public $bestellstatus_kurzbz; + + /** + * + * Konstruktor + * @param unknown_type $aufteilung_id + */ + public function __construct($bestellung_bestellstatus_id=null) + { + parent::__construct(); + + if(!is_null($bestellung_bestellstatus_id)) + $this->load($bestellung_bestellstatus_id); + } + + /** + * + * lädt den Bestellstatus der übergebenen ID + * @param $bestellung_bestellstatus_id + */ + public function load($bestellung_bestellstatus_id) + { + if(!is_numeric($bestellung_bestellstatus_id)) + { + $this->errormsg ="Ungültige Bestellstatus ID."; + return false; + } + + $qry= "SELECT bestellstatus.* from wawi.tbl_bestellung_bestellstatus as bestellstatus where bestellstatus = ".$this->addslashes($bestellung_bestellstatus_id).";"; + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->bestellung_bestellstatus_id = $row->bestellung_bestellstatus_id; + $this->bestellung_id = $row->bestellung_id; + $this->bestellstatus_kurzbz = $row->bestellstatus_kurzbz; + $this->uid = $row->uid; + $this->oe_kurzbz = $row->oe_kurzbz; + $this->datum = $row->datum; + $this->insertvon = $row->insertvon; + $this->insertamum = $row->insertamum; + $this->updatevon = $row->updatevon; + $this->updateamum = $row->updateamum; + } + return true; + } + else + { + $this->errormsg = "Fehler bei der Abfrage aufgetreten."; + return false; + } + } + + /** + * + * Lädt alle Bestellstati zurück + */ + public function getAll() + { + $qry = "SELECT bestellstatus.* from wawi.tbl_bestellung_bestellstatus as bestellstatus;"; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $status = new wawi_bestellstatus(); + + $status->bestellung_bestellstatus_id = $row->bestellung_bestellstatus_id; + $status->bestellung_id = $row->bestellung_id; + $status->bestellstatus_kurzbz = $row->bestellstatus_kurzbz; + $status->uid = $row->uid; + $status->oe_kurzbz = $row->oe_kurzbz; + $status->datum = $row->datum; + $status->insertvon = $row->insertvon; + $status->insertamum = $row->insertamum; + $status->updatevon = $row->updatevon; + $status->updateamum = $row->updateamum; + + $this->result[] = $status; + } + return true; + + } + else + { + $this->errormsg = "Fehler bei der Abfrage aufgetreten."; + return false; + } + } + + /** + * + * Return true wenn es den übergebenen Statuseintrag für die Übergebene Bestell ID gibt + * @param $bestellung_id + * @param $status_kurzbz + */ + public function isStatiVorhanden($bestellung_id, $status_kurzbz) + { + if(!is_numeric($bestellung_id) || $bestellung_id == '') + { + $this->errormsg = "Bestellung ID fehlerhaft."; + return false; + } + if($status_kurzbz == '') + { + $this->errormsg = "Status Kurzbezeichnung ist fehlerhaft."; + return false; + } + + $qry = "select bestellstatus.* from wawi.tbl_bestellung_bestellstatus as bestellstatus + where + bestellung = ".$this->addslashes($bestellung_id)." and bestellstatus_kurzbz = ".$this->addslashes($status_kurzbz).";"; + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + return true; + else + return false; + } + else + { + $this->errormsg = "Fehler bei der Abfrage aufgetreten."; + return false; + } + } +} \ No newline at end of file