- Added functions isSuccess, isError and hasData in message helper

- Updated the code using these new functions
This commit is contained in:
bison-paolo
2016-10-14 15:04:15 +02:00
parent f8c70df0bc
commit a20bf91193
13 changed files with 89 additions and 54 deletions
@@ -53,7 +53,7 @@ class Nation extends APIv1_Controller
$result = $this->NationModel->addOrder('engltext');
}
if ($result->error == EXIT_SUCCESS)
if (isSuccess($result))
{
if ($this->get('ohnesperre'))
{
@@ -118,12 +118,7 @@ class Studiensemester extends APIv1_Controller
$result = $this->StudiensemesterModel->loadWhere(array('start <=' => 'NOW()', 'ende >=' => 'NOW()'));
}
if (is_object($result) && $result->error == EXIT_SUCCESS && is_array($result->retval) &&
count($result->retval) > 0)
{
// Return $result
}
else
if (!hasData($result))
{
$this->StudiensemesterModel->addOrder('ende');
$this->StudiensemesterModel->addLimit(1);
@@ -93,7 +93,7 @@ class Person extends APIv1_Controller
$person = $this->_parseData($this->post());
$validation = $this->_validate($this->post());
if (is_object($validation) && $validation->error == EXIT_SUCCESS)
if (isSuccess($validation))
{
if(isset($person["person_id"]) && !(is_null($person["person_id"])) && ($person["person_id"] != ""))
{
@@ -112,7 +112,7 @@ class Message extends APIv1_Controller
{
$validation = $this->_validatePostMessage($this->post());
if (is_object($validation) && $validation->error == EXIT_SUCCESS)
if (isSuccess($validation))
{
$result = $this->messagelib->sendMessage(
isset($this->post()['person_id']) ? $this->post()['person_id'] : null,
@@ -139,7 +139,7 @@ class Message extends APIv1_Controller
{
$validation = $this->_validatePostMessageVorlage($this->post());
if (is_object($validation) && $validation->error == EXIT_SUCCESS)
if (isSuccess($validation))
{
$result = $this->messagelib->sendMessageVorlage(
isset($this->post()['sender_id']) ? $this->post()['sender_id'] : null,