Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Resolves two database errors pertaining to selecting messages for users ... #308

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions OpenVBX/models/vbx_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function get_message($id)
$user_group_select = "IF(u.email IS NOT NULL , 'user', 'group') as owner_type, IF( u.email IS NOT NULL , u.email , g.name) as owner, IF (u.email IS NOT NULL, u.id, g.id) as owner_id";

$ci->db->from($this->table)->select("messages.*, $user_group_select", false);

if(is_array($id))
{
$ci->db->where($id);
Expand All @@ -293,7 +293,7 @@ function get_message($id)
if(empty($result))
{
$_id = $id;
if (is_array($id))
if (is_array($id))
{
$_id = $id['call_sid'];
}
Expand Down Expand Up @@ -395,14 +395,14 @@ function get_messages($options, $offset, $size)
}

function notify_message($message)
{
{
$ci =& get_instance();
$ci->load->model('vbx_user');
$ci->load->model('vbx_group');
$ci->load->model('vbx_incoming_numbers');

$recording_host = $ci->settings->get('recording_host', VBX_PARENT_TENANT);

$vm_url = $message->content_url;
if (!empty($recording_host) && trim($recording_host) != '') {
$vm_url = str_replace('api.twilio.com',trim($recording_host), $vm_url);
Expand Down Expand Up @@ -525,7 +525,7 @@ function message_owner()
{
return $group->name;
}

$user = new User();
$user->get_by_id($this->user_id);
return $user->full_name();
Expand Down Expand Up @@ -577,7 +577,7 @@ function get_folders($user_id, $group_ids)
{
$folders[$inbox_id]->total = $user_message_total[0]->count;
}

if(!empty($group_ids))
{
$groups = $ci->db
Expand Down Expand Up @@ -606,7 +606,7 @@ function get_folders($user_id, $group_ids)
->where_in('gm.group_id', $group_ids)
->where('archived', false)
->where('m.tenant_id', $ci->tenant->id)
->group_by('m.status, g.id')
->group_by('m.status, g.id, g.name') //ND added g.name here to fix error
->get()->result();

$group_folder_totals = array();
Expand Down
Loading