mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Firmenverwaltung Filter nach OE
This commit is contained in:
+74
-60
@@ -16,9 +16,9 @@
|
||||
* 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> and.
|
||||
* Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at>.
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at> and.
|
||||
* Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at>.
|
||||
*/
|
||||
/**
|
||||
* Klasse firma
|
||||
@@ -29,14 +29,14 @@ require_once(dirname(__FILE__).'/organisationseinheit.class.php');
|
||||
|
||||
class firma extends basis_db
|
||||
{
|
||||
public $new; // boolean
|
||||
public $new; // boolean
|
||||
public $result = array(); // adresse Objekt
|
||||
|
||||
//Tabellenspalten
|
||||
public $firma_id; // integer
|
||||
public $name; // string
|
||||
public $anmerkung; // string
|
||||
public $lieferbedingungen; // string
|
||||
public $lieferbedingungen; // string
|
||||
public $ext_id; // integer
|
||||
public $insertamum; // timestamp
|
||||
public $insertvon; // bigint
|
||||
@@ -96,7 +96,7 @@ class firma extends basis_db
|
||||
$this->firma_id = $row->firma_id;
|
||||
$this->name = $row->name;
|
||||
$this->anmerkung = $row->anmerkung;
|
||||
$this->lieferbedingungen = $row->lieferbedingungen;
|
||||
$this->lieferbedingungen = $row->lieferbedingungen;
|
||||
$this->firmentyp_kurzbz = $row->firmentyp_kurzbz;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->updatevon = $row->updatevon;
|
||||
@@ -149,7 +149,7 @@ class firma extends basis_db
|
||||
$this->errormsg = 'Anmerkung darf nicht länger als 256 Zeichen sein';
|
||||
return false;
|
||||
}
|
||||
if(mb_strlen($this->lieferbedingungen)>256)
|
||||
if(mb_strlen($this->lieferbedingungen)>256)
|
||||
{
|
||||
$this->errormsg = 'Lieferbedingungen darf nicht länger als 256 Zeichen sein';
|
||||
return false;
|
||||
@@ -176,19 +176,19 @@ class firma extends basis_db
|
||||
$qry='INSERT INTO public.tbl_firma (name, anmerkung, lieferbedingungen,
|
||||
firmentyp_kurzbz, updateamum, updatevon, insertamum, insertvon, schule,steuernummer,
|
||||
gesperrt,aktiv,finanzamt) VALUES('.
|
||||
$this->db_add_param($this->name).', '.
|
||||
$this->db_add_param($this->anmerkung).', '.
|
||||
$this->db_add_param($this->lieferbedingungen).', '.
|
||||
$this->db_add_param($this->firmentyp_kurzbz).', '.
|
||||
$this->db_add_param($this->updateamum).', '.
|
||||
$this->db_add_param($this->updatevon).', '.
|
||||
$this->db_add_param($this->insertamum).', '.
|
||||
$this->db_add_param($this->insertvon).', '.
|
||||
$this->db_add_param($this->schule, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->steuernummer).', '.
|
||||
$this->db_add_param($this->gesperrt, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->aktiv, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->finanzamt, FHC_INTEGER).' ); ';
|
||||
$this->db_add_param($this->name).', '.
|
||||
$this->db_add_param($this->anmerkung).', '.
|
||||
$this->db_add_param($this->lieferbedingungen).', '.
|
||||
$this->db_add_param($this->firmentyp_kurzbz).', '.
|
||||
$this->db_add_param($this->updateamum).', '.
|
||||
$this->db_add_param($this->updatevon).', '.
|
||||
$this->db_add_param($this->insertamum).', '.
|
||||
$this->db_add_param($this->insertvon).', '.
|
||||
$this->db_add_param($this->schule, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->steuernummer).', '.
|
||||
$this->db_add_param($this->gesperrt, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->aktiv, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->finanzamt, FHC_INTEGER).' ); ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -204,15 +204,15 @@ class firma extends basis_db
|
||||
'firma_id='.$this->db_add_param($this->firma_id).', '.
|
||||
'name='.$this->db_add_param($this->name).', '.
|
||||
'anmerkung='.$this->db_add_param($this->anmerkung).', '.
|
||||
'lieferbedingungen='.$this->db_add_param($this->lieferbedingungen).', '.
|
||||
'lieferbedingungen='.$this->db_add_param($this->lieferbedingungen).', '.
|
||||
'updateamum= now(), '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).', '.
|
||||
'firmentyp_kurzbz='.$this->db_add_param($this->firmentyp_kurzbz).', '.
|
||||
'schule='.$this->db_add_param($this->schule, FHC_BOOLEAN).', '.
|
||||
'steuernummer='.$this->db_add_param($this->steuernummer).', '.
|
||||
'gesperrt='.$this->db_add_param($this->gesperrt, FHC_BOOLEAN).', '.
|
||||
'aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).', '.
|
||||
'finanzamt='.$this->db_add_param($this->finanzamt, FHC_INTEGER).' '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).', '.
|
||||
'firmentyp_kurzbz='.$this->db_add_param($this->firmentyp_kurzbz).', '.
|
||||
'schule='.$this->db_add_param($this->schule, FHC_BOOLEAN).', '.
|
||||
'steuernummer='.$this->db_add_param($this->steuernummer).', '.
|
||||
'gesperrt='.$this->db_add_param($this->gesperrt, FHC_BOOLEAN).', '.
|
||||
'aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).', '.
|
||||
'finanzamt='.$this->db_add_param($this->finanzamt, FHC_INTEGER).' '.
|
||||
'WHERE firma_id='.$this->db_add_param($this->firma_id, FHC_INTEGER).';';
|
||||
}
|
||||
|
||||
@@ -646,15 +646,21 @@ class firma extends basis_db
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle Firmen Standorte, und Adressen nach Suchstring und/oder eines bestimmen Firmentyps
|
||||
* Laedt alle Firmen Standorte, und Adressen nach Suchstring und/oder eines bestimmen Firmentyps, und/oder einer bestimmten Organisationseinheit
|
||||
* @param string $filter Optional. Searchstring.
|
||||
* @param string $firmentyp_kurzbz Optional. Firmentyp
|
||||
* @param boolean $standorte Default false. Wenn false, findet ein distinct on auf die firma_id statt
|
||||
* @param string $oefilter Oe_kurzbz. Optional. Filtert die Firmen auf die uebergebene oe_kurzbz.
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function searchFirma($filter='',$firmentyp_kurzbz='', $standorte=false)
|
||||
public function searchFirma($filter='',$firmentyp_kurzbz='', $standorte=false, $oefilter='')
|
||||
{
|
||||
$this->result = array();
|
||||
$this->errormsg = '';
|
||||
|
||||
$qry ="SELECT * FROM (SElECT ";
|
||||
$oes = '';
|
||||
if ($oefilter!='')
|
||||
$oes = implode("','",$oefilter);
|
||||
$qry ="SELECT * FROM (SELECT ";
|
||||
if(!$standorte)
|
||||
$qry.=" distinct on(firma_id)";
|
||||
$qry.=" tbl_firma.firma_id,tbl_firma.* ,tbl_standort.kurzbz,tbl_standort.adresse_id,tbl_standort.standort_id,tbl_standort.bezeichnung ";
|
||||
@@ -662,6 +668,8 @@ class firma extends basis_db
|
||||
$qry.=" FROM public.tbl_firma";
|
||||
$qry.=" LEFT JOIN public.tbl_standort USING(firma_id) ";
|
||||
$qry.=" LEFT JOIN public.tbl_adresse on ( tbl_adresse.adresse_id=tbl_standort.adresse_id ) ";
|
||||
if ($oes!='')
|
||||
$qry.=" LEFT JOIN public.tbl_firma_organisationseinheit ON (tbl_firma.firma_id=tbl_firma_organisationseinheit.firma_id) ";
|
||||
$qry.=" WHERE 1=1";
|
||||
|
||||
if($filter!='')
|
||||
@@ -673,7 +681,7 @@ class firma extends basis_db
|
||||
OR lower(ort) like lower('%".$this->db_escape($filter)."%')
|
||||
OR lower(strasse) like lower('%".$this->db_escape($filter)."%')
|
||||
|
||||
OR lower(bezeichnung) like lower('%".$this->db_escape($filter)."%')
|
||||
OR lower(tbl_standort.bezeichnung) like lower('%".$this->db_escape($filter)."%')
|
||||
OR lower(anmerkung) like lower('%".$this->db_escape($filter)."%')
|
||||
".(is_numeric($filter)?" OR tbl_firma.firma_id='".$this->db_escape($filter)."'":'')."
|
||||
OR tbl_firma.firma_id IN (SELECT firma_id FROM public.tbl_firmatag
|
||||
@@ -682,6 +690,9 @@ class firma extends basis_db
|
||||
|
||||
if($firmentyp_kurzbz!='')
|
||||
$qry.=" and firmentyp_kurzbz=".$this->db_add_param($firmentyp_kurzbz);
|
||||
|
||||
if($oes!='')
|
||||
$qry.=" and oe_kurzbz IN ('".$oes."') ";
|
||||
|
||||
//if($filter=='' && $firmentyp_kurzbz=='')
|
||||
// $qry.=" limit 500 ";
|
||||
@@ -696,7 +707,7 @@ class firma extends basis_db
|
||||
$fa->firma_id = $row->firma_id;
|
||||
$fa->name = $row->name;
|
||||
$fa->anmerkung = $row->anmerkung;
|
||||
$fa->lieferbedingungen = $row->lieferbedingungen;
|
||||
//$fa->lieferbedingungen = $row->lieferbedingungen;
|
||||
$fa->firmentyp_kurzbz = $row->firmentyp_kurzbz;
|
||||
$fa->updateamum = $row->updateamum;
|
||||
$fa->updatevon = $row->updatevon;
|
||||
@@ -773,11 +784,12 @@ class firma extends basis_db
|
||||
|
||||
/**
|
||||
* Laedt alle Firmen - Organisationseinheiten nach Firmen ID und/oder OE Kurzbz
|
||||
* @param $firma_id ID die gelesen werden soll
|
||||
* @param $oe_kurzbz Organisationskurzbezeichnung
|
||||
* @param integer $firma_id ID die gelesen werden soll
|
||||
* @param string $oe_kurzbz Organisationskurzbezeichnung
|
||||
* @param string $firmentyp_kurzbz Optional. Firmentyp, der geliefert werden soll
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function get_firmaorganisationseinheit($firma_id='',$oe_kurzbz='')
|
||||
public function get_firmaorganisationseinheit($firma_id='', $oe_kurzbz='', $firmentyp_kurzbz='')
|
||||
{
|
||||
$this->result = array();
|
||||
$this->errormsg = '';
|
||||
@@ -797,9 +809,11 @@ class firma extends basis_db
|
||||
$qry.=" WHERE true ";
|
||||
|
||||
if($firma_id!='')
|
||||
$qry.=" and tbl_firma_organisationseinheit.firma_id=".$this->db_add_param($firma_id, FHC_INTEGER);
|
||||
$qry.=" AND tbl_firma_organisationseinheit.firma_id=".$this->db_add_param($firma_id, FHC_INTEGER);
|
||||
if($oe_kurzbz!='')
|
||||
$qry.=" and tbl_firma_organisationseinheit.oe_kurzbz=".$this->db_add_param($oe_kurzbz);
|
||||
$qry.=" AND tbl_firma_organisationseinheit.oe_kurzbz=".$this->db_add_param($oe_kurzbz);
|
||||
if($firmentyp_kurzbz!='')
|
||||
$qry.=" AND firmentyp_kurzbz=".$this->db_add_param($firmentyp_kurzbz);
|
||||
|
||||
$qry.=" ORDER BY tbl_firma.name, tbl_firma_organisationseinheit.oe_kurzbz;";
|
||||
if($this->db_query($qry))
|
||||
@@ -920,14 +934,14 @@ class firma extends basis_db
|
||||
//Neuen Datensatz einfuegen
|
||||
$qry='INSERT INTO public.tbl_firma_organisationseinheit (firma_id,oe_kurzbz,
|
||||
bezeichnung,kundennummer, updateamum, updatevon, insertamum, insertvon) VALUES('.
|
||||
$this->db_add_param($this->firma_id, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->oe_kurzbz).', '.
|
||||
$this->db_add_param($this->bezeichnung).', '.
|
||||
$this->db_add_param($this->kundennummer).', '.
|
||||
$this->db_add_param($this->updateamum).', '.
|
||||
$this->db_add_param($this->updatevon).', '.
|
||||
$this->db_add_param($this->insertamum).', '.
|
||||
$this->db_add_param($this->insertvon).' ); ';
|
||||
$this->db_add_param($this->firma_id, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->oe_kurzbz).', '.
|
||||
$this->db_add_param($this->bezeichnung).', '.
|
||||
$this->db_add_param($this->kundennummer).', '.
|
||||
$this->db_add_param($this->updateamum).', '.
|
||||
$this->db_add_param($this->updatevon).', '.
|
||||
$this->db_add_param($this->insertamum).', '.
|
||||
$this->db_add_param($this->insertvon).' ); ';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -945,7 +959,7 @@ class firma extends basis_db
|
||||
'bezeichnung='.$this->db_add_param($this->bezeichnung).', '.
|
||||
'kundennummer='.$this->db_add_param($this->kundennummer).', '.
|
||||
'updateamum= now(), '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).' '.
|
||||
'updatevon='.$this->db_add_param($this->updatevon).' '.
|
||||
'WHERE firma_organisationseinheit_id='.$this->db_add_param($this->firma_organisationseinheit_id, FHC_INTEGER).';';
|
||||
}
|
||||
if($this->db_query($qry))
|
||||
@@ -1059,25 +1073,25 @@ class firma extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt Alle firmen die zu einem bestimmten mobilitaetsprogramm zugeordnet sind
|
||||
* @param $mobilitaetsprogramm_code
|
||||
* @return boolean
|
||||
*/
|
||||
function getFirmenMobilitaetsprogramm($mobilitaetsprogramm_code)
|
||||
{
|
||||
$qry = 'SELECT * FROM public.tbl_firma JOIN public.tbl_firma_mobilitaetsprogramm USING(firma_id) WHERE mobilitaetsprogramm_code ='.$this->db_add_param($mobilitaetsprogramm_code, FHC_INTEGER).';';
|
||||
/**
|
||||
* Lädt Alle firmen die zu einem bestimmten mobilitaetsprogramm zugeordnet sind
|
||||
* @param $mobilitaetsprogramm_code
|
||||
* @return boolean
|
||||
*/
|
||||
function getFirmenMobilitaetsprogramm($mobilitaetsprogramm_code)
|
||||
{
|
||||
$qry = 'SELECT * FROM public.tbl_firma JOIN public.tbl_firma_mobilitaetsprogramm USING(firma_id) WHERE mobilitaetsprogramm_code ='.$this->db_add_param($mobilitaetsprogramm_code, FHC_INTEGER).';';
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$fi = new firma();
|
||||
$fi = new firma();
|
||||
|
||||
$fi->firma_id = $row->firma_id;
|
||||
$fi->name = $row->name;
|
||||
$fi->anmerkung = $row->anmerkung;
|
||||
$fi->lieferbedingungen = $row->lieferbedingungen;
|
||||
$fi->lieferbedingungen = $row->lieferbedingungen;
|
||||
$fi->firmentyp_kurzbz = $row->firmentyp_kurzbz;
|
||||
$fi->updateamum = $row->updateamum;
|
||||
$fi->updatevon = $row->updatevon;
|
||||
@@ -1090,7 +1104,7 @@ class firma extends basis_db
|
||||
$fi->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
$fi->finanzamt = $row->finanzamt;
|
||||
|
||||
$this->result[] = $fi;
|
||||
$this->result[] = $fi;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1100,6 +1114,6 @@ class firma extends basis_db
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user