mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
added workaround for parsing data
This commit is contained in:
@@ -207,7 +207,7 @@ $config['directory_trigger'] = 'd';
|
||||
| your log files will fill up very fast.
|
||||
|
|
||||
*/
|
||||
$config['log_threshold'] = 0;
|
||||
$config['log_threshold'] = 4;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -41,13 +41,13 @@ class Kontakt extends APIv1_Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response();
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
public function postKontakt()
|
||||
{
|
||||
$post = $this->post();
|
||||
$post = $this->_parseData($this->post());
|
||||
|
||||
if(is_array($post))
|
||||
{
|
||||
@@ -67,4 +67,19 @@ class Kontakt extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
private function _parseData($person)
|
||||
{
|
||||
if(is_array($person))
|
||||
{
|
||||
foreach($person as $key=>$value)
|
||||
{
|
||||
if($value === "")
|
||||
{
|
||||
$person[$key] = null;
|
||||
}
|
||||
}
|
||||
return $person;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,8 +60,7 @@ class Person extends APIv1_Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields = $this->PersonModel->getFields();
|
||||
$this->response($fields, REST_Controller::HTTP_OK);
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,15 +69,17 @@ class Person extends APIv1_Controller
|
||||
*/
|
||||
public function postPerson()
|
||||
{
|
||||
$person = $this->_parseData($this->post());
|
||||
|
||||
if($this->_validate($this->post()))
|
||||
{
|
||||
if(isset($this->post()['person_id']))
|
||||
if(isset($person['person_id']) && !(is_null($person["person_id"])) && ($person["person_id"] != ""))
|
||||
{
|
||||
$result = $this->PersonModel->update($this->post()['person_id'], $this->post());
|
||||
$result = $this->PersonModel->update($person['person_id'], $person);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->PersonModel->insert($this->post());
|
||||
$result = $this->PersonModel->insert($person);
|
||||
}
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
@@ -108,6 +109,21 @@ class Person extends APIv1_Controller
|
||||
$this->response();
|
||||
}
|
||||
}
|
||||
|
||||
private function _parseData($person)
|
||||
{
|
||||
if(is_array($person))
|
||||
{
|
||||
foreach($person as $key=>$value)
|
||||
{
|
||||
if($value === "")
|
||||
{
|
||||
$person[$key] = null;
|
||||
}
|
||||
}
|
||||
return $person;
|
||||
}
|
||||
}
|
||||
|
||||
private function _validate($person = NULL)
|
||||
{
|
||||
@@ -115,7 +131,10 @@ class Person extends APIv1_Controller
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//TODO
|
||||
return true;
|
||||
|
||||
$person['nachname'] = trim($person['nachname']);
|
||||
$person['vorname'] = trim($person['vorname']);
|
||||
$person['vornamen'] = trim($person['vornamen']);
|
||||
|
||||
@@ -11,46 +11,6 @@ class Person_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_person';
|
||||
$this->pk = 'person_id';
|
||||
}
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$fields = array(
|
||||
//Tabellenspalten
|
||||
"person_id" => NULL,
|
||||
"sprache" => NULL,
|
||||
"anrede" => NULL,
|
||||
"titelpost" => NULL,
|
||||
"titelpre" => NULL,
|
||||
"nachname" => NULL,
|
||||
"vorname" => NULL,
|
||||
"vornamen" => NULL,
|
||||
"gebdatum" => NULL,
|
||||
"gebort" => NULL,
|
||||
"gebzeit" => NULL,
|
||||
"foto" => NULL,
|
||||
"anmerkungen" => NULL,
|
||||
"homepage" => NULL,
|
||||
"svnr" => NULL,
|
||||
"ersatzkennzeichen" => NULL,
|
||||
"familienstand" => NULL,
|
||||
"anzahlkinder" => NULL,
|
||||
"aktiv"=>TRUE,
|
||||
"insertamum" => NULL,
|
||||
"insertvon" => NULL,
|
||||
"updateamum" => NULL,
|
||||
"updatevon" => NULL,
|
||||
"geschlecht" => "u",
|
||||
"staatsbuergerschaft" => NULL,
|
||||
"geburtsnation" => NULL,
|
||||
"ext_id" => NULL,
|
||||
"kurzbeschreibung"> NULL,
|
||||
"zugangscode" => NULL,
|
||||
"foto_sperre" => FALSE,
|
||||
"matr_nr"=> NULL
|
||||
);
|
||||
|
||||
return $this->_success($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user