mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 01:42:17 +00:00
- Added permissions for table public.tbl_rt_person
- Added method postAddReihungstest to controller Prestudent - Added method getReihungstestByPersonID to controller Reihungstest - Fixed tables structure in the migration script 011_reihungstest.php - Added model RtPerson_model
This commit is contained in:
@@ -24,8 +24,6 @@ class Prestudent extends APIv1_Controller
|
||||
parent::__construct();
|
||||
// Load model PrestudentModel
|
||||
$this->load->model('crm/prestudent_model', 'PrestudentModel');
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,8 +109,52 @@ class Prestudent extends APIv1_Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function postAddReihungstest()
|
||||
{
|
||||
$ddReihungstest = $this->_parseData($this->post());
|
||||
|
||||
if ($this->_validateAddReihungstest($ddReihungstest))
|
||||
{
|
||||
$this->load->model('crm/RtPerson_model', 'RtPersonModel');
|
||||
|
||||
if(isset($ddReihungstest['new']) && $ddReihungstest['new'] === true)
|
||||
{
|
||||
// Remove new parameter to avoid DB insert errors
|
||||
unset($ddReihungstest['new']);
|
||||
|
||||
$result = $this->RtPersonModel->insert($ddReihungstest);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pksArray = array($ddReihungstest['person_id'], $ddReihungstest['rt_id']);
|
||||
|
||||
$result = $this->RtPersonModel->update($pksArray, $ddReihungstest);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
private function _validate($prestudent = NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private function _validateAddReihungstest($ddReihungstest = NULL)
|
||||
{
|
||||
if (!isset($ddReihungstest['person_id']) || !isset($ddReihungstest['rt_id']) ||
|
||||
!isset($ddReihungstest['ort_kurzbz']))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,6 @@ class Reihungstest extends APIv1_Controller
|
||||
parent::__construct();
|
||||
// Load model ReihungstestModel
|
||||
$this->load->model('crm/reihungstest_model', 'ReihungstestModel');
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +69,37 @@ class Reihungstest extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function getReihungstestByPersonID()
|
||||
{
|
||||
$person_id = $this->get('person_id');
|
||||
|
||||
if (isset($person_id))
|
||||
{
|
||||
$result = $this->ReihungstestModel->addJoin('public.tbl_rt_person', 'reihungstest_id = rt_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->ReihungstestModel->addJoin('public.tbl_person', 'person_id');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->ReihungstestModel->addJoin('public.tbl_ort', 'tbl_ort.ort_kurzbz = tbl_rt_person.ort_kurzbz');
|
||||
if ($result->error == EXIT_SUCCESS)
|
||||
{
|
||||
$result = $this->ReihungstestModel->loadWhere(array('person_id' => $person_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
|
||||
Reference in New Issue
Block a user