mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
Send messages about close invitation by timeout
This commit is contained in:
parent
644cec05cb
commit
d70ed401cb
@ -215,6 +215,21 @@ function invitation_reject($visitor_id) {
|
||||
function invitation_close_old() {
|
||||
$db = Database::getInstance();
|
||||
|
||||
// Get all threads to close
|
||||
$threads = $db->query(
|
||||
"SELECT * FROM {chatthread} " .
|
||||
"WHERE istate = :state_invited " .
|
||||
"AND invitationstate = :invitation_wait " .
|
||||
"AND (:now - dtmcreated) > :lifetime",
|
||||
array(
|
||||
':invitation_wait' => Thread::INVITATION_WAIT,
|
||||
':state_invited' => Thread::STATE_INVITED,
|
||||
':lifetime' => Settings::get('invitation_lifetime'),
|
||||
':now' => time()
|
||||
),
|
||||
array('return_rows' => Database::RETURN_ALL_ROWS)
|
||||
);
|
||||
|
||||
// Remove old invitations
|
||||
$db->query(
|
||||
"UPDATE {chatsitevisitor} v, {chatthread} t SET " .
|
||||
@ -233,6 +248,17 @@ function invitation_close_old() {
|
||||
':now' => time()
|
||||
)
|
||||
);
|
||||
|
||||
// Iterate over all threads and send messages to operator about close by
|
||||
// timeout
|
||||
foreach($threads as $thread_info) {
|
||||
$thread = Thread::createFromDbInfo($thread_info);
|
||||
$thread->postMessage(
|
||||
Thread::KIND_FOR_AGENT,
|
||||
getstring_('chat.visitor.invitation.ignored', $thread->locale)
|
||||
);
|
||||
unset($thread);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,6 +82,7 @@ chat.visitor.email=E-Mail: {0}
|
||||
chat.visitor.info=Info: {0}
|
||||
chat.visitor.invitation.accepted=Visitor accepted invitation from operator {0}
|
||||
chat.visitor.invitation.canceled=Operator canceled invitation
|
||||
chat.visitor.invitation.ignored=Visitor ignored invitation and it was closed automatically
|
||||
chat.visitor.invitation.rejected=Visitor rejected invitation
|
||||
chat.visitor.invitation.sent=Operator {0} invites visitor at {1} page
|
||||
chat.wait=Thank you for contacting us. An operator will be with you shortly.
|
||||
|
@ -82,6 +82,7 @@ chat.visitor.email=E-Mail: {0}
|
||||
chat.visitor.info=О Посетителе: {0}
|
||||
chat.visitor.invitation.accepted=Посетитель принял приглашение от оператора {0}
|
||||
chat.visitor.invitation.canceled=Оператор отменил приглашение
|
||||
chat.visitor.invitation.ignored=Посетитель проигнорировал приглашение и оно было закрыто автоматически
|
||||
chat.visitor.invitation.rejected=Посетитель отклонил приглашение
|
||||
chat.visitor.invitation.sent=Оператор {0} пригласил посетителя на странице {1}
|
||||
chat.wait=Пожалуйста, подождите немного, к Вам присоединится оператор..
|
||||
|
Loading…
Reference in New Issue
Block a user