Skip to content
Snippets Groups Projects
Commit 8b206e9f authored by Jared Hancock's avatar Jared Hancock
Browse files

oops: Allow the ticket lock feature to be disabled

This fixes a slight regression, where, if the locking mechanism were
disabled, then tickets could no longer be responded to.
parent 7a763c01
Branches
Tags
No related merge requests found
...@@ -69,18 +69,20 @@ if($_POST && !$errors): ...@@ -69,18 +69,20 @@ if($_POST && !$errors):
if(!$_POST['response']) if(!$_POST['response'])
$errors['response']=__('Response required'); $errors['response']=__('Response required');
if (!$lock) { if ($cfg->getLockTime()) {
$errors['err'] = __('This action requires a lock. Please try again'); if (!$lock) {
} $errors['err'] = __('This action requires a lock. Please try again');
// Use locks to avoid double replies }
elseif ($lock->getStaffId()!=$thisstaff->getId()) { // Use locks to avoid double replies
$errors['err'] = __('Action Denied. Ticket is locked by someone else!'); elseif ($lock->getStaffId()!=$thisstaff->getId()) {
} $errors['err'] = __('Action Denied. Ticket is locked by someone else!');
// Attempt to renew the lock if possible }
elseif (($lock->isExpired() && !$lock->renew()) // Attempt to renew the lock if possible
||($lock->getCode() != $_POST['lockCode']) elseif (($lock->isExpired() && !$lock->renew())
) { ||($lock->getCode() != $_POST['lockCode'])
$errors['err'] = __('Your lock has expired. Please try again'); ) {
$errors['err'] = __('Your lock has expired. Please try again');
}
} }
//Make sure the email is not banned //Make sure the email is not banned
...@@ -200,15 +202,17 @@ if($_POST && !$errors): ...@@ -200,15 +202,17 @@ if($_POST && !$errors):
$vars['cannedattachments'] = array_merge( $vars['cannedattachments'] = array_merge(
$vars['cannedattachments'] ?: array(), $attachments); $vars['cannedattachments'] ?: array(), $attachments);
if (!$lock) { if ($cfg->getLockTime()) {
$errors['err'] = __('This action requires a lock. Please try again'); if (!$lock) {
} $errors['err'] = __('This action requires a lock. Please try again');
// Use locks to avoid double replies }
elseif ($lock->getStaffId()!=$thisstaff->getId()) { // Use locks to avoid double replies
$errors['err'] = __('Action Denied. Ticket is locked by someone else!'); elseif ($lock->getStaffId()!=$thisstaff->getId()) {
} $errors['err'] = __('Action Denied. Ticket is locked by someone else!');
elseif ($lock->getCode() != $_POST['lockCode']) { }
$errors['err'] = __('Your lock has expired. Please try again'); elseif ($lock->getCode() != $_POST['lockCode']) {
$errors['err'] = __('Your lock has expired. Please try again');
}
} }
$wasOpen = ($ticket->isOpen()); $wasOpen = ($ticket->isOpen());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment