mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 07:22:17 +00:00
- Cleaned the controllers by moving the database related code and more complex logic
in the models or libraries - DmsLib bug fix - Person_model bug fix
This commit is contained in:
@@ -15,8 +15,6 @@ if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Studiengang2 extends APIv1_Controller
|
||||
{
|
||||
private static $PROPERTIES_SEPARATOR = "properties_separator";
|
||||
|
||||
/**
|
||||
* Course API constructor.
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Studienplan extends APIv1_Controller
|
||||
{
|
||||
@@ -23,14 +23,12 @@ class Studienplan extends APIv1_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('organisation/studienplan_model', 'StudienplanModel');
|
||||
|
||||
|
||||
$this->load->model("organisation/studienplan_model", "StudienplanModel");
|
||||
}
|
||||
|
||||
public function getStudienplan()
|
||||
{
|
||||
$studienplan_id = $this->get('studienplan_id');
|
||||
$studienplan_id = $this->get("studienplan_id");
|
||||
|
||||
if (isset($studienplan_id))
|
||||
{
|
||||
@@ -46,15 +44,11 @@ class Studienplan extends APIv1_Controller
|
||||
|
||||
public function getStudienplaene()
|
||||
{
|
||||
$studiengang_kz = $this->get('studiengang_kz');
|
||||
$studiengang_kz = $this->get("studiengang_kz");
|
||||
|
||||
if (isset($studiengang_kz))
|
||||
{
|
||||
$result = $this->StudienplanModel->addJoin('lehre.tbl_studienordnung', 'studienordnung_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->StudienplanModel->loadWhere(array('studiengang_kz' => $this->get('studiengang_kz')));
|
||||
}
|
||||
$result = $this->StudienplanModel->getStudienplaene($studiengang_kz);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -66,37 +60,19 @@ class Studienplan extends APIv1_Controller
|
||||
|
||||
public function getStudienplaeneFromSem()
|
||||
{
|
||||
$studiengang_kz = $this->get('studiengang_kz');
|
||||
$studiensemester_kurzbz = $this->get('studiensemester_kurzbz');
|
||||
$ausbildungssemester = $this->get('ausbildungssemester');
|
||||
$orgform_kurzbz = $this->get('orgform_kurzbz');
|
||||
$studiengang_kz = $this->get("studiengang_kz");
|
||||
$studiensemester_kurzbz = $this->get("studiensemester_kurzbz");
|
||||
$ausbildungssemester = $this->get("ausbildungssemester");
|
||||
$orgform_kurzbz = $this->get("orgform_kurzbz");
|
||||
|
||||
if (isset($studiengang_kz) && isset($studiensemester_kurzbz))
|
||||
{
|
||||
$result = $this->StudienplanModel->addJoin('lehre.tbl_studienordnung', 'studienordnung_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->StudienplanModel->addJoin('lehre.tbl_studienplan_semester', 'studienplan_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$whereArray = array('tbl_studienplan.aktiv' => 'TRUE',
|
||||
'tbl_studienordnung.studiengang_kz' => $studiengang_kz,
|
||||
'tbl_studienplan_semester.studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
);
|
||||
|
||||
if(isset($ausbildungssemester))
|
||||
{
|
||||
$whereArray['tbl_studienplan_semester.semester'] = $ausbildungssemester;
|
||||
}
|
||||
|
||||
if(isset($orgform_kurzbz))
|
||||
{
|
||||
$whereArray['orgform_kurzbz'] = $orgform_kurzbz;
|
||||
}
|
||||
|
||||
$result = $this->StudienplanModel->loadWhere($whereArray);
|
||||
}
|
||||
}
|
||||
$result = $this->StudienplanModel->getStudienplaeneBySemester(
|
||||
$studiengang_kz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester,
|
||||
$orgform_kurzbz
|
||||
);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Kontakt extends APIv1_Controller
|
||||
{
|
||||
@@ -24,9 +24,7 @@ class Kontakt extends APIv1_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model PersonModel
|
||||
$this->load->model('person/kontakt_model', 'KontaktModel');
|
||||
|
||||
|
||||
$this->load->model("person/kontakt_model", "KontaktModel");
|
||||
}
|
||||
|
||||
public function getKontakt()
|
||||
@@ -35,15 +33,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($kontakt_id))
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_standort', 'standort_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('kontakt_id' => $kontakt_id));
|
||||
}
|
||||
}
|
||||
$result = $this->KontaktModel->getWholeKontakt($kontakt_id);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -59,7 +49,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($kontakt_id))
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('kontakt_id' => $kontakt_id));
|
||||
$result = $this->KontaktModel->load($kontakt_id);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -75,15 +65,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_standort', 'standort_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('person_id' => $person_id));
|
||||
}
|
||||
}
|
||||
$result = $this->KontaktModel->getWholeKontakt(null, $person_id);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -99,7 +81,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('person_id' => $person_id));
|
||||
$result = $this->KontaktModel->loadWhere(array("person_id" => $person_id));
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -116,15 +98,7 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (isset($person_id) && isset($kontakttyp))
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_standort', 'standort_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->KontaktModel->loadWhere(array('person_id' => $person_id, 'kontakttyp' => $kontakttyp));
|
||||
}
|
||||
}
|
||||
$result = $this->KontaktModel->getWholeKontakt(null, $person_id, $kontakttyp);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
@@ -140,9 +114,9 @@ class Kontakt extends APIv1_Controller
|
||||
|
||||
if (is_array($post))
|
||||
{
|
||||
if (isset($post['kontakt_id']))
|
||||
if (isset($post["kontakt_id"]))
|
||||
{
|
||||
$result = $this->KontaktModel->update($post['kontakt_id'], $post);
|
||||
$result = $this->KontaktModel->update($post["kontakt_id"], $post);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -31,27 +31,30 @@ class Person extends APIv1_Controller
|
||||
*/
|
||||
public function getPerson()
|
||||
{
|
||||
$personID = $this->get("person_id");
|
||||
$person_id = $this->get("person_id");
|
||||
$code = $this->get("code");
|
||||
$email = $this->get("email");
|
||||
|
||||
if (isset($code) || isset($email) || isset($personID))
|
||||
if (isset($code) || isset($email) || isset($person_id))
|
||||
{
|
||||
if (isset($code) && isset($email))
|
||||
{
|
||||
$result = $this->PersonModel->addJoin("public.tbl_kontakt", "person_id");
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->PersonModel->loadWhere(array("zugangscode" => $code, "kontakt" => $email));
|
||||
}
|
||||
}
|
||||
elseif (isset($code))
|
||||
{
|
||||
$result = $this->PersonModel->loadWhere(array("zugangscode" => $code));
|
||||
$result = $this->PersonModel->getPersonKontaktByZugangscode($code, $email);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->PersonModel->load($personID);
|
||||
$parametersArray = array();
|
||||
|
||||
if (isset($code))
|
||||
{
|
||||
$parametersArray["zugangscode"] = $code;
|
||||
}
|
||||
else
|
||||
{
|
||||
$parametersArray["person_id"] = $person_id;
|
||||
}
|
||||
|
||||
$result = $this->PersonModel->loadWhere($parametersArray);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
@@ -61,6 +64,26 @@ class Person extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getCheckBewerbung()
|
||||
{
|
||||
$email = $this->get("email");
|
||||
$studiensemester_kurzbz = $this->get("studiensemester_kurzbz");
|
||||
|
||||
if (isset($email))
|
||||
{
|
||||
$result = $this->PersonModel->checkBewerbung($email, $studiensemester_kurzbz);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
@@ -74,28 +97,7 @@ class Person extends APIv1_Controller
|
||||
{
|
||||
if(isset($person["person_id"]) && !(is_null($person["person_id"])) && ($person["person_id"] != ""))
|
||||
{
|
||||
if (isset($person["svnr"]) && $person["svnr"] != "")
|
||||
{
|
||||
$this->PersonModel->addOrder("svnr", "DESC");
|
||||
$result = $this->PersonModel->loadWhere(array(
|
||||
"person_id != " => $person["person_id"],
|
||||
"SUBSTRING(svnr FROM 1 FOR 10) = " => $person["svnr"])
|
||||
);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS &&
|
||||
is_array($result->retval) && count($result->retval) > 0)
|
||||
{
|
||||
if (count($result->retval) == 1)
|
||||
{
|
||||
$person["svnr"] = $person["svnr"] . "v1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$person["svnr"] = $person["svnr"] . "v" . ($result->retval[0]->svnr{11} + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->PersonModel->update($person["person_id"], $person);
|
||||
$result = $this->PersonModel->updatePerson($person);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,26 +112,6 @@ class Person extends APIv1_Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getCheckBewerbung()
|
||||
{
|
||||
$email = $this->get("email");
|
||||
$studiensemester_kurzbz = $this->get("studiensemester_kurzbz");
|
||||
|
||||
if (isset($email))
|
||||
{
|
||||
$result = $this->PersonModel->checkBewerbung($email, $studiensemester_kurzbz);
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
private function _validate($person = NULL)
|
||||
{
|
||||
if (!isset($person))
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Ort extends APIv1_Controller
|
||||
{
|
||||
@@ -23,9 +23,7 @@ class Ort extends APIv1_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
// Load model OrtModel
|
||||
$this->load->model('ressource/ort_model', 'OrtModel');
|
||||
|
||||
|
||||
$this->load->model("ressource/ort_model", "OrtModel");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,7 +31,7 @@ class Ort extends APIv1_Controller
|
||||
*/
|
||||
public function getOrt()
|
||||
{
|
||||
$ort_kurzbz = $this->get('ort_kurzbz');
|
||||
$ort_kurzbz = $this->get("ort_kurzbz");
|
||||
|
||||
if (isset($ort_kurzbz))
|
||||
{
|
||||
@@ -52,17 +50,11 @@ class Ort extends APIv1_Controller
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$raumtyp_kurzbz = $this->get('raumtyp_kurzbz');
|
||||
$raumtyp_kurzbz = $this->get("raumtyp_kurzbz");
|
||||
|
||||
$this->OrtModel->addOrder('ort_kurzbz');
|
||||
|
||||
if (!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz != '')
|
||||
if (!is_null($raumtyp_kurzbz) && $raumtyp_kurzbz != "")
|
||||
{
|
||||
$result = $this->OrtModel->addJoin('public.tbl_ortraumtyp', 'ort_kurzbz');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->OrtModel->loadWhere(array('raumtyp_kurzbz' => $raumtyp_kurzbz));
|
||||
}
|
||||
$result = $this->OrtModel->getAll($raumtyp_kurzbz);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -79,9 +71,9 @@ class Ort extends APIv1_Controller
|
||||
{
|
||||
if ($this->_validate($this->post()))
|
||||
{
|
||||
if (isset($this->post()['ort_kurzbz']))
|
||||
if (isset($this->post()["ort_kurzbz"]))
|
||||
{
|
||||
$result = $this->OrtModel->update($this->post()['ort_kurzbz'], $this->post());
|
||||
$result = $this->OrtModel->update($this->post()["ort_kurzbz"], $this->post());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ class DmsLib
|
||||
{
|
||||
$filename = uniqid() . "." . pathinfo($dms["name"], PATHINFO_EXTENSION);
|
||||
|
||||
return $this->ci->DmsFSModel->write($filename, $dms["file_content"]);
|
||||
$result = $this->ci->DmsFSModel->write($filename, $dms["file_content"]);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result->retval = $filename;
|
||||
|
||||
@@ -1,14 +1,45 @@
|
||||
<?php
|
||||
|
||||
class Studienplan_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_studienplan';
|
||||
$this->pk = 'studienplan_id';
|
||||
$this->dbTable = "lehre.tbl_studienplan";
|
||||
$this->pk = "studienplan_id";
|
||||
}
|
||||
|
||||
public function getStudienplaene($studiengang_kz)
|
||||
{
|
||||
$this->addJoin("lehre.tbl_studienordnung", "studienordnung_id");
|
||||
|
||||
return $this->loadWhere(array("studiengang_kz" => $studiengang_kz));
|
||||
}
|
||||
|
||||
public function getStudienplaeneBySemester($studiengang_kz, $studiensemester_kurzbz, $ausbildungssemester = null, $orgform_kurzbz = null)
|
||||
{
|
||||
$this->addJoin("lehre.tbl_studienordnung", "studienordnung_id");
|
||||
$this->addJoin("lehre.tbl_studienplan_semester", "studienplan_id");
|
||||
|
||||
$whereArray = array(
|
||||
"tbl_studienplan.aktiv" => "TRUE",
|
||||
"tbl_studienordnung.studiengang_kz" => $studiengang_kz,
|
||||
"tbl_studienplan_semester.studiensemester_kurzbz" => $studiensemester_kurzbz
|
||||
);
|
||||
|
||||
if(!is_null($ausbildungssemester))
|
||||
{
|
||||
$whereArray["tbl_studienplan_semester.semester"] = $ausbildungssemester;
|
||||
}
|
||||
|
||||
if(!is_null($orgform_kurzbz))
|
||||
{
|
||||
$whereArray["orgform_kurzbz"] = $orgform_kurzbz;
|
||||
}
|
||||
|
||||
return $this->StudienplanModel->loadWhere($whereArray);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
class Kontakt_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
@@ -7,7 +8,40 @@ class Kontakt_model extends DB_Model
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_kontakt';
|
||||
$this->pk = 'kontakt_id';
|
||||
$this->dbTable = "public.tbl_kontakt";
|
||||
$this->pk = "kontakt_id";
|
||||
}
|
||||
|
||||
public function getWholeKontakt($kontakt_id, $person_id = null, $kontakttyp = null)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
$this->addJoin("public.tbl_standort", "standort_id", "LEFT");
|
||||
$this->addJoin("public.tbl_firma", "firma_id", "LEFT");
|
||||
|
||||
if (isset($kontakt_id))
|
||||
{
|
||||
$result = $this->load($kontakt_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$parametersArray = array();
|
||||
|
||||
if (!is_null($person_id))
|
||||
{
|
||||
$parametersArray["person_id"] = $person_id;
|
||||
}
|
||||
if (!is_null($kontakttyp))
|
||||
{
|
||||
$parametersArray["kontakttyp"] = $kontakttyp;
|
||||
}
|
||||
|
||||
if (count($parametersArray) > 0)
|
||||
{
|
||||
$result = $this->loadWhere($parametersArray);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,15 @@ class Person_model extends DB_Model
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_person';
|
||||
$this->pk = 'person_id';
|
||||
$this->dbTable = "public.tbl_person";
|
||||
$this->pk = "person_id";
|
||||
}
|
||||
|
||||
public function getPersonKontaktByZugangscode($zugangscode, $email)
|
||||
{
|
||||
$this->addJoin("public.tbl_kontakt", "person_id");
|
||||
|
||||
return $this->loadWhere(array("zugangscode" => $zugangscode, "kontakt" => $email));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,6 +36,8 @@ class Person_model extends DB_Model
|
||||
return $chkRights;
|
||||
|
||||
$result = null;
|
||||
$checkBewerbungQuery = "";
|
||||
$parametersArray = array($email, $email, $email);
|
||||
|
||||
if (is_null($studiensemester_kurzbz))
|
||||
{
|
||||
@@ -36,11 +45,9 @@ class Person_model extends DB_Model
|
||||
FROM public.tbl_person p JOIN public.tbl_kontakt k ON p.person_id = k.person_id
|
||||
LEFT JOIN public.tbl_benutzer b ON p.person_id = b.person_id
|
||||
WHERE k.kontakttyp = 'email'
|
||||
AND (kontakt = ? OR alias || '@technikum-wien.at' = ? OR uid || '@technikum-wien.at' = ?)
|
||||
AND (kontakt = ? OR alias || '@" . DOMAIN . "' = ? OR uid || '@" . DOMAIN . "' = ?)
|
||||
ORDER BY p.insertamum DESC
|
||||
LIMIT 1";
|
||||
|
||||
$result = $this->db->query($checkBewerbungQuery, array($email, $email, $email));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -50,17 +57,45 @@ class Person_model extends DB_Model
|
||||
JOIN public.tbl_prestudent ps ON p.person_id = ps.person_id
|
||||
JOIN public.tbl_prestudentstatus pst ON pst.prestudent_id = ps.prestudent_id
|
||||
WHERE k.kontakttyp = 'email'
|
||||
AND (kontakt = ? OR alias || '@technikum-wien.at' = ? OR uid || '@technikum-wien.at' = ?)
|
||||
AND (kontakt = ? OR alias || '@" . DOMAIN . "' = ? OR uid || '@" . DOMAIN . "' = ?)
|
||||
AND studiensemester_kurzbz = ?
|
||||
ORDER BY p.insertamum DESC
|
||||
LIMIT 1";
|
||||
|
||||
$result = $this->db->query($checkBewerbungQuery, array($email, $email, $email, $studiensemester_kurzbz));
|
||||
array_push($parametersArray, $studiensemester_kurzbz);
|
||||
}
|
||||
|
||||
$result = $this->db->query($checkBewerbungQuery, $parametersArray);
|
||||
|
||||
if (is_object($result))
|
||||
return $this->_success($result->result());
|
||||
else
|
||||
return $this->_error($this->db->error(), FHC_DB_ERROR);
|
||||
}
|
||||
|
||||
public function updatePerson($person)
|
||||
{
|
||||
if (isset($person["svnr"]) && $person["svnr"] != "")
|
||||
{
|
||||
$this->PersonModel->addOrder("svnr", "DESC");
|
||||
$result = $this->PersonModel->loadWhere(array(
|
||||
"person_id != " => $person["person_id"],
|
||||
"SUBSTRING(svnr FROM 1 FOR 10) = " => $person["svnr"])
|
||||
);
|
||||
if (is_object($result) && $result->error == EXIT_SUCCESS &&
|
||||
is_array($result->retval) && count($result->retval) > 0)
|
||||
{
|
||||
if (count($result->retval) == 1 && $result->retval[0]->svnr == $person["svnr"])
|
||||
{
|
||||
$person["svnr"] = $person["svnr"] . "v1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$person["svnr"] = $person["svnr"] . "v" . ($result->retval[0]->svnr{11} + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->PersonModel->update($person["person_id"], $person);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,23 @@
|
||||
<?php
|
||||
|
||||
class Ort_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_ort';
|
||||
$this->pk = 'ort_kurzbz';
|
||||
$this->dbTable = "public.tbl_ort";
|
||||
$this->pk = "ort_kurzbz";
|
||||
}
|
||||
}
|
||||
|
||||
public function getAll($raumtyp_kurzbz)
|
||||
{
|
||||
$this->addOrder("ort_kurzbz");
|
||||
|
||||
$this->addJoin("public.tbl_ortraumtyp", "ort_kurzbz");
|
||||
|
||||
return $this->OrtModel->loadWhere(array("raumtyp_kurzbz" => $raumtyp_kurzbz));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user