From 57d690dde58ab2432266629f2a43f1879730f2ff Mon Sep 17 00:00:00 2001 From: Karl Burkhart Date: Wed, 1 Dec 2010 16:13:54 +0000 Subject: [PATCH] --- include/wawi_bestelldetails.class.php | 50 +++++++++++-------------- include/wawi_bestellung.class.php | 3 +- include/wawi_tags.class.php | 53 ++++++++++++++++++++++++--- 3 files changed, 71 insertions(+), 35 deletions(-) diff --git a/include/wawi_bestelldetails.class.php b/include/wawi_bestelldetails.class.php index 1ee35041d..bc21a6d37 100644 --- a/include/wawi_bestelldetails.class.php +++ b/include/wawi_bestelldetails.class.php @@ -42,11 +42,12 @@ class wawi_bestelldetail extends basis_db public $insertvon; // char public $updateamum; // timestamp public $updatevon; // char - - public $result = array(); public $user; public $new; + public $result = array(); + + /** * * Konstruktor @@ -172,11 +173,6 @@ class wawi_bestelldetail extends basis_db public function validate() { - if(!is_numeric($this->bestelldetail_id)) - { - $this->errormsg = "Bestelldetail_id fehlerhaft."; - return false; - } if(!is_numeric($this->bestellung_id)) { $this->errormsg = "Bestellung_id fehlerhaft."; @@ -228,10 +224,10 @@ class wawi_bestelldetail extends basis_db $this->addslashes($this->beschreibung).', '. $this->addslashes($this->artikelnummer).', '. $this->addslashes($this->preisprove).', '. - $this->addslashes($this->mwst).', '. - $this->addslashes($this->erhalten).', '. - $this->addslashes($this->sort).', '. - $this->addslashes($this->text).', '. + $this->addslashes($this->mwst).', + false, '. + $this->addslashes($this->sort).', + false , '. $this->addslashes($this->insertamum).', '. $this->addslashes($this->insertvon).', '. $this->addslashes($this->updateamum).', '. @@ -241,22 +237,20 @@ class wawi_bestelldetail extends basis_db else { // Update - $qry = 'UPDATE wawi.tbl_bestellung SET - bestellung_id = '.$this->bestellung_id.', - position = '.$this->position.', - menge = '.$this->menge.', - verpackungseinheit = '.$this->verpackungseinheit.', - beschreibung = '.$this->beschreibung.', - artikelnummer = '.$this->artikelnummer.', - preisprove = '.$this->preisprove.', - mwst = '.$this->mwst.', - erhalten = '.$this->erhalten.', - sort = '.$this->sort.', - text = '.$this->text.', - insertamum = '.$this->insertamum.', - insertvon = '.$this->insertvon.', - updateamum = '.$this->updateamum.', - updatevon = '.$this->updatevon.' WHERE bestelldetail_id = '.$this->bestelldetail_id.';'; + $qry = 'UPDATE wawi.tbl_bestelldetail SET + bestellung_id = '.$this->addslashes($this->bestellung_id).', + position = '.$this->addslashes($this->position).', + menge = '.$this->addslashes($this->menge).', + verpackungseinheit = '.$this->addslashes($this->verpackungseinheit).', + beschreibung = '.$this->addslashes($this->beschreibung).', + artikelnummer = '.$this->addslashes($this->artikelnummer).', + preisprove = '.$this->addslashes($this->preisprove).', + mwst = '.$this->addslashes($this->mwst).', + erhalten = '.$this->addslashes($this->erhalten).', + sort = '.$this->addslashes($this->sort).', + text = '.$this->addslashes($this->text).', + updateamum = '.$this->addslashes($this->updateamum).', + updatevon = '.$this->addslashes($this->updatevon).' WHERE bestelldetail_id = '.$this->bestelldetail_id.';'; } if($this->db_query($qry)) @@ -264,7 +258,7 @@ class wawi_bestelldetail extends basis_db if($this->new) { //aktuelle Sequence holen - $qry="SELECT currval('seq_bestelldetail_bestelldetail_id') as id;"; + $qry="SELECT currval('wawi.seq_bestelldetail_bestelldetail_id') as id;"; if($this->db_query($qry)) { if($row = $this->db_fetch_object()) diff --git a/include/wawi_bestellung.class.php b/include/wawi_bestellung.class.php index 04858ae41..93e164cd3 100644 --- a/include/wawi_bestellung.class.php +++ b/include/wawi_bestellung.class.php @@ -478,10 +478,9 @@ class wawi_bestellung extends basis_db bemerkung = '.$this->addslashes($this->bemerkung).', liefertermin = '.$this->addslashes($this->liefertermin).', updateamum = '.$this->addslashes($this->updateamum).', - updatevon ='.$this->addslashes($this->udpatevon).', + updatevon ='.$this->addslashes($this->updatevon).', ext_id = '.$this->addslashes($this->ext_id).' WHERE bestellung_id = '.$this->bestellung_id.';'; } - echo $qry; if($this->db_query($qry)) { if($this->new) diff --git a/include/wawi_tags.class.php b/include/wawi_tags.class.php index 5a3a6fb42..e33821fec 100644 --- a/include/wawi_tags.class.php +++ b/include/wawi_tags.class.php @@ -31,10 +31,12 @@ class wawi_tags extends basis_db public $result = array(); // Konto Objekt //Tabellenspalten - public $tag; // integer - public $bestellung_id; // string + public $tag; // integer + public $bestellung_id; // string public $insertamum; // timestamp public $insertvon; // string + + public $bestelldetail_id; @@ -51,6 +53,11 @@ class wawi_tags extends basis_db $this->load($tag); } + /** + * + * Gibt die Tags einer Bestellung zurück + * @param unknown_type $bestellung_id + */ public function GetTagsByBestellung($bestellung_id) { if(!is_numeric($bestellung_id)) @@ -83,6 +90,10 @@ class wawi_tags extends basis_db return true; } + /** + * + * gibt die Tags per strichpunkt getrennt zurück + */ public function GetStringTags() { $string = ''; @@ -94,8 +105,40 @@ class wawi_tags extends basis_db } return $string; } + + + public function GetTagsByBesteldetail($bestelldetail_id) + { + /*if(!is_numeric($bestelldetail_id)) + { + $this->errormsg = "Ungültige Bestelldetail ID"; + return false; + }*/ + + $qry = "Select * from wawi.tbl_bestelldetailtag where bestelldetail_id = ".$bestelldetail_id.";"; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $bestelltag = new wawi_tags(); + + $bestelltag->tag = $row->tag; + $bestelltag->bestelldetail_id = $row->bestelldetail_id; + $bestelltag->insertamum = $row->insertamum; + $bestelltag->insertvon = $row->insertvon; + + $this->result[] = $bestelltag; + } + } + else + { + $this->errormsg = "Fehler bei Abfrage aufgetreten."; + return false; + } + return true; + } + + } - - -