Merge branch 'feature-5698/Clean_ViewMessage_MessageToken_model'

This commit is contained in:
Andreas Österreicher
2020-01-15 13:17:41 +01:00
3 changed files with 33 additions and 118 deletions
+4 -3
View File
@@ -37,12 +37,13 @@ class Redirect extends FHC_Controller
public function redirectByToken($token)
{
$msg = $this->MessageTokenModel->getMessageByToken($token);
if ($msg->error)
if (isError($msg))
{
show_error(getError($msg));
}
$oe_kurzbz = $msg->retval[0]->oe_kurzbz;
$oe_kurzbz = null;
if (hasData($msg)) $oe_kurzbz = getData($msg)[0]->oe_kurzbz;
if ($oe_kurzbz != null && $oe_kurzbz != '')
{
@@ -51,7 +52,7 @@ class Redirect extends FHC_Controller
$getOERoot = $this->MessageTokenModel->getOERoot($oe_kurzbz);
if (isSuccess($getOERoot)) // If no errors occurred
{
$organisationRoot = $getOERoot->retval;
$organisationRoot = getData($getOERoot);
}
else
{
+5 -7
View File
@@ -43,8 +43,7 @@ class ViewMessage extends FHC_Controller
public function toHTML($token)
{
$msg = $this->MessageTokenModel->getMessageByToken($token);
if ($msg->error)
if (isError($msg))
{
show_error(getError($msg));
}
@@ -52,10 +51,9 @@ class ViewMessage extends FHC_Controller
if (is_array(getData($msg)) && count(getData($msg)) > 0)
{
$setReadMessageStatusByToken = $this->MessageTokenModel->setReadMessageStatusByToken($token);
if (isError($setReadMessageStatusByToken))
{
show_error($msg);
show_error(getError($setReadMessageStatusByToken));
}
$sender_id = getData($msg)[0]->sender_id;
@@ -64,9 +62,9 @@ class ViewMessage extends FHC_Controller
// To decide how to change the redirection
$isEmployee = $this->MessageTokenModel->isEmployee($receiver_id);
if (!is_bool($isEmployee) && isError($isEmployee))
if (isError($isEmployee))
{
show_error($isEmployee);
show_error(getError($isEmployee));
}
if($this->config->item('redirect_view_message_url') != '')
@@ -78,7 +76,7 @@ class ViewMessage extends FHC_Controller
'sender_id' => $sender_id,
'sender' => getData($sender)[0],
'message' => getData($msg)[0],
'isEmployee' => $isEmployee,
'isEmployee' => hasData($isEmployee),
'href' => $href
);