diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index a3049eae54..febe7762b9 100755 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -1601,7 +1601,8 @@ class MessageManager . "ON m.user_receiver_id = u.user_id " . "WHERE u.user_id = $userId " . "AND m.msg_status = " . MESSAGE_STATUS_UNREAD . " " - . "AND m.id > $lastId"; + . "AND m.id > $lastId " + . "ORDER BY m.send_date DESC"; $result = Database::query($sql); diff --git a/main/inc/lib/webservices/MessagesWebService.class.php b/main/inc/lib/webservices/MessagesWebService.class.php index 40d262e2ec..a20b4afdb8 100644 --- a/main/inc/lib/webservices/MessagesWebService.class.php +++ b/main/inc/lib/webservices/MessagesWebService.class.php @@ -113,6 +113,7 @@ class MessagesWebService extends WebService 'firstname' => $message['firstname'], 'completeName' => api_get_person_name($message['firstname'], $message['lastname']), ), + 'sendDate' => $message['send_date'], 'content' => $message['content'], 'hasAttachments' => $hasAttachments, 'platform' => array( diff --git a/tests/scripts/update_user_extra_field.php b/tests/scripts/update_user_extra_field.php new file mode 100644 index 0000000000..b73dc7f7dd --- /dev/null +++ b/tests/scripts/update_user_extra_field.php @@ -0,0 +1,44 @@ +'; + } else { + echo 'User does not exists: '.$user['user'].'
'; + } +} diff --git a/webservices/rest.php b/webservices/rest.php index 8591cbd27b..702b651ea6 100644 --- a/webservices/rest.php +++ b/webservices/rest.php @@ -76,4 +76,6 @@ switch ($action) { } /* View */ +header('Content-Type: application/json'); +header('Access-Control-Allow-Origin: *'); echo json_encode($json);