mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-23 15:09:37 +00:00
Fixed Bug where wrong Messages are sent if they are not sent immediately
Messages are only sent with the Employee-Adress of the Sender instead of the private Address. If the Sender is not an Employee, the Messages are sent with the System-EMail
This commit is contained in:
@@ -33,7 +33,7 @@ class ViewMessage extends CI_Controller
|
||||
// Load model MessageToken_model, not calling the authentication system
|
||||
$this->load->model('system/MessageToken_model', 'MessageTokenModel');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Using the MessageTokenModel instead of MessageLib to allow
|
||||
* viewing the message without prompting the login
|
||||
@@ -50,32 +50,37 @@ class ViewMessage extends CI_Controller
|
||||
if (is_array($msg->retval) && count($msg->retval) > 0)
|
||||
{
|
||||
$setReadMessageStatusByToken = $this->MessageTokenModel->setReadMessageStatusByToken($token);
|
||||
|
||||
|
||||
if (isError($setReadMessageStatusByToken))
|
||||
{
|
||||
show_error($msg->$setReadMessageStatusByToken);
|
||||
}
|
||||
|
||||
|
||||
$sender_id = $msg->retval[0]->sender_id;
|
||||
$receiver_id = $msg->retval[0]->receiver_id;
|
||||
$sender = $this->MessageTokenModel->getSenderData($sender_id);
|
||||
|
||||
|
||||
// To decide how to change the redirection
|
||||
$isEmployee = $this->MessageTokenModel->isEmployee($receiver_id);
|
||||
if (!is_bool($isEmployee) && isError($isEmployee))
|
||||
{
|
||||
show_error($isEmployee);
|
||||
}
|
||||
|
||||
|
||||
if($this->config->item('redirect_view_message_url') != '')
|
||||
$href = APP_ROOT . $this->config->item('redirect_view_message_url') . $token;
|
||||
else
|
||||
$href = '';
|
||||
|
||||
$data = array (
|
||||
'sender_id' => $sender_id,
|
||||
'sender' => $sender->retval[0],
|
||||
'message' => $msg->retval[0],
|
||||
'isEmployee' => $isEmployee,
|
||||
'href' => APP_ROOT . $this->config->item('redirect_view_message_url') . $token
|
||||
'href' => $href
|
||||
);
|
||||
|
||||
|
||||
$this->load->view('system/messageHTML.php', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,14 +426,14 @@ class MessageLib
|
||||
if ((!is_null($result->retval[$i]->receiver) && $result->retval[$i]->receiver != '')
|
||||
|| (!is_null($result->retval[$i]->employeecontact) && $result->retval[$i]->employeecontact != ''))
|
||||
{
|
||||
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token;
|
||||
$href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[$i]->token;
|
||||
// Using a template for the html email body
|
||||
$body = $this->ci->parser->parse(
|
||||
'templates/mailHTML',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
'subject' => $result->retval[$i]->subject,
|
||||
'body' => $result->retval[$i]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
@@ -447,8 +447,8 @@ class MessageLib
|
||||
'templates/mailTXT',
|
||||
array(
|
||||
'href' => $href,
|
||||
'subject' => $result->retval[0]->subject,
|
||||
'body' => $result->retval[0]->body
|
||||
'subject' => $result->retval[$i]->subject,
|
||||
'body' => $result->retval[$i]->body
|
||||
),
|
||||
true
|
||||
);
|
||||
@@ -457,11 +457,11 @@ class MessageLib
|
||||
$this->ci->loglib->logError('Error while parsing the mail template');
|
||||
}
|
||||
|
||||
// If the sender kontakt does not exist, then system-sender is used if empty
|
||||
// If the sender is not an employee, then system-sender is used if empty
|
||||
$sender = '';
|
||||
if (!is_null($result->retval[0]->sender) && $result->retval[0]->sender != '')
|
||||
if (!is_null($result->retval[0]->senderemployeecontact) && $result->retval[0]->senderemployeecontact != '')
|
||||
{
|
||||
$sender = $result->retval[0]->sender;
|
||||
$sender = $result->retval[0]->senderemployeecontact.'@'.DOMAIN;
|
||||
}
|
||||
|
||||
$receiverContact = $result->retval[$i]->receiver;
|
||||
@@ -606,11 +606,11 @@ class MessageLib
|
||||
$bodyMsg = $altBody = $body;
|
||||
}
|
||||
|
||||
// If the sender kontakt does not exist, then system-sender is used if empty
|
||||
// If the sender is not an employee, then system-sender is used if empty
|
||||
$sender = '';
|
||||
if (!is_null($result->retval[0]->sender) && $result->retval[0]->sender != '')
|
||||
if (!is_null($result->retval[0]->senderemployeecontact) && $result->retval[0]->senderemployeecontact != '')
|
||||
{
|
||||
$sender = $result->retval[0]->sender;
|
||||
$sender = $result->retval[0]->senderemployeecontact.'@'.DOMAIN;
|
||||
}
|
||||
|
||||
$receiverContact = $result->retval[0]->receiver;
|
||||
|
||||
@@ -261,6 +261,7 @@ class Recipient_model extends DB_Model
|
||||
ks.kontakt as sender,
|
||||
kr.kontakt as receiver,
|
||||
mu.mitarbeiter_uid as employeeContact,
|
||||
ms.mitarbeiter_uid as senderemployeeContact,
|
||||
mr.person_id as receiver_id,
|
||||
mr.token,
|
||||
mm.subject,
|
||||
@@ -278,7 +279,13 @@ class Recipient_model extends DB_Model
|
||||
m.mitarbeiter_uid
|
||||
FROM public.tbl_benutzer b INNER JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
|
||||
WHERE b.aktiv = TRUE
|
||||
) mu ON (mu.person_id = mr.person_id)';
|
||||
) mu ON (mu.person_id = mr.person_id)
|
||||
LEFT JOIN (
|
||||
SELECT b.person_id,
|
||||
m.mitarbeiter_uid
|
||||
FROM public.tbl_benutzer b INNER JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
|
||||
WHERE b.aktiv = TRUE
|
||||
) ms ON (ms.person_id = mm.person_id)';
|
||||
|
||||
$parametersArray = array($kontaktType, $kontaktType);
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<td valign="top">
|
||||
<br>
|
||||
<b>Message:</b>
|
||||
</td>
|
||||
<td>
|
||||
@@ -38,7 +39,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($isEmployee === false)
|
||||
if ($isEmployee === false && $href != '')
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
@@ -48,7 +49,7 @@
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
?>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user