diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index 572fc90c6ae09e77c624dbdaf973d10ffa3bc5a9..15fcee9f26d86540d0769c9f9d6dfeb855769c11 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -22,6 +22,7 @@ $user  = $ticket->getOwner(); //Ticket User (EndUser)
 $team  = $ticket->getTeam();  //Assigned team.
 $sla   = $ticket->getSLA();
 $lock  = $ticket->getLock();  //Ticket lock obj
+$mylock = ($lock && $lock->getStaffId() == $thisstaff->getId()) ? $lock : null;
 $id    = $ticket->getId();    //Ticket ID.
 
 //Useful warnings and errors the user might want to know!
@@ -514,7 +515,7 @@ $tcount = $ticket->getThreadEntries($types)->count();
         <input type="hidden" name="id" value="<?php echo $ticket->getId(); ?>">
         <input type="hidden" name="msgId" value="<?php echo $msgId; ?>">
         <input type="hidden" name="a" value="reply">
-        <input type="hidden" name="lockCode" value="<?php echo $ticket->getLock()->getCode(); ?>">
+        <input type="hidden" name="lockCode" value="<?php echo ($mylock) ? $mylock->getCode() : ''; ?>">
         <span class="error"></span>
         <table style="width:100%" border="0" cellspacing="0" cellpadding="3">
            <tbody id="to_sec">
@@ -703,7 +704,7 @@ $tcount = $ticket->getThreadEntries($types)->count();
         <input type="hidden" name="id" value="<?php echo $ticket->getId(); ?>">
         <input type="hidden" name="locktime" value="<?php echo $cfg->getLockTime() * 60; ?>">
         <input type="hidden" name="a" value="postnote">
-        <input type="hidden" name="lockCode" value="<?php echo $ticket->getLock()->getCode(); ?>">
+        <input type="hidden" name="lockCode" value="<?php echo ($mylock) ? $mylock->getCode() : ''; ?>">
         <table width="100%" border="0" cellspacing="0" cellpadding="3">
             <?php
             if($errors['postnote']) {?>
@@ -1057,14 +1058,14 @@ $(function() {
     });
 <?php
     // Set the lock if one exists
-    if ($lock) { ?>
+    if ($mylock) { ?>
 !function() {
   var setLock = setInterval(function() {
     if (typeof(window.autoLock) === 'undefined')
       return;
     clearInterval(setLock);
     autoLock.setLock({
-      id:<?php echo $lock->getId(); ?>,
+      id:<?php echo $mylock->getId(); ?>,
       time: <?php echo $cfg->getLockTime() * 60; ?>}, 'acquire');
   }, 50);
 }();