|
|
@@ -641,6 +641,16 @@ function tblMsgsLoadMoreRows(n) {
|
|
|
, `A_RECORD_UPDATE_DATE`=NOW()
|
|
|
, `actionExecutedTime`=NOW()
|
|
|
where `ID`='{$msg['_raw']->ID}'
|
|
|
+ and `A_STATUS`='WAITING'
|
|
|
+ and `A_RECORD_UPDATE_AUTHOR`=''
|
|
|
+ and `A_RECORD_UPDATE_DATE` is null
|
|
|
+ and (
|
|
|
+ ('{$usrLogin}'!=`A_RECORD_CREATE_AUTHOR`)
|
|
|
+ or ('{$usrLogin}'=`A_RECORD_CREATE_AUTHOR`
|
|
|
+ and 'user'=`userTargetType`
|
|
|
+ and '{$usrLogin}'=`userTargetName`
|
|
|
+ )
|
|
|
+ )
|
|
|
";
|
|
|
$res = $db->query($sql);
|
|
|
if (!$res || $db->has_errors()) throw new Exception("Wystąpiły błędy podczas próby zapisu wiadomości: " . implode("\n<br>", $db->get_errors()));
|
|
|
@@ -951,6 +961,7 @@ function tblMsgsLoadMoreRows(n) {
|
|
|
tblName: "TEST_PERMS",
|
|
|
type: "info",
|
|
|
usrLogin: "plabudda"} */
|
|
|
+ $usrLogin = User::getLogin();
|
|
|
$message = new stdClass();
|
|
|
$message->id = $rawMsg->ID;
|
|
|
$message->idThread = $rawMsg->idThread;// TODO: ID_THREAD
|
|
|
@@ -962,6 +973,16 @@ function tblMsgsLoadMoreRows(n) {
|
|
|
$message->author = $rawMsg->A_RECORD_CREATE_AUTHOR;
|
|
|
$message->created = $rawMsg->A_RECORD_CREATE_DATE;
|
|
|
$message->_read = ('WAITING' != $rawMsg->A_STATUS);
|
|
|
+ $message->_readByUser = ('WAITING' != $rawMsg->A_STATUS);
|
|
|
+ if ('WAITING' == $rawMsg->A_STATUS
|
|
|
+ && $usrLogin == $rawMsg->A_RECORD_CREATE_AUTHOR) {
|
|
|
+ if ('user' == $rawMsg->userTargetType
|
|
|
+ && $usrLogin == $rawMsg->userTargetName) {
|
|
|
+ $message->_readByUser = false;
|
|
|
+ } else {
|
|
|
+ $message->_readByUser = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
if ($message->_read) {
|
|
|
if (!empty($rawMsg->A_RECORD_UPDATE_DATE)) $message->_readDate = $rawMsg->A_RECORD_UPDATE_DATE;
|
|
|
if (!empty($rawMsg->A_RECORD_UPDATE_AUTHOR)) $message->_readBy = $rawMsg->A_RECORD_UPDATE_AUTHOR;
|