- 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
+4 -4
View File
@@ -36,7 +36,7 @@ class Notiz_model extends DB_Model
$this->db->trans_start(false);
$result = $this->delete(array('notiz_id' => $notiz_id));
if (is_object($result) && $result->error == EXIT_SUCCESS)
if (isSuccess($result))
{
$result = $this->NotizzuordnungModel->delete(array('notiz_id' => $notiz_id));
}
@@ -45,7 +45,7 @@ class Notiz_model extends DB_Model
$this->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->db->trans_status() === false || (is_object($result) && $result->error != EXIT_SUCCESS))
if ($this->db->trans_status() === false || isError($result))
{
$this->db->trans_rollback();
$result = error($result->msg, EXIT_ERROR);
@@ -72,7 +72,7 @@ class Notiz_model extends DB_Model
$result = $this->insert(array('titel' => $titel, 'text' => $text, 'erledigt' => true));
$notiz_id = $result->retval;
if (is_object($result) && $result->error == EXIT_SUCCESS)
if (isSuccess($result))
{
$result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, 'prestudent_id' => $prestudent_id));
}
@@ -81,7 +81,7 @@ class Notiz_model extends DB_Model
$this->db->trans_complete();
// Check if everything went ok during the transaction
if ($this->db->trans_status() === false || (is_object($result) && $result->error != EXIT_SUCCESS))
if ($this->db->trans_status() === false || isError($result))
{
$this->db->trans_rollback();
$result = error($result->msg, EXIT_ERROR);
+1 -2
View File
@@ -82,8 +82,7 @@ class Person_model extends DB_Model
"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 (hasData($result))
{
if (count($result->retval) == 1 && $result->retval[0]->svnr == $person["svnr"])
{