From 11a47cddaebe4eccfac17ccaca4e9f0b9642f3bf Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 12 Apr 2016 17:06:49 -0400
Subject: [PATCH] queue: Fix crash deleting a column

Also, avoid setting FLAG_INHERIT_COLUMNS for queues which do not inherit
from another queue.
---
 include/class.queue.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/class.queue.php b/include/class.queue.php
index 289a003c4..a0e7c57ec 100644
--- a/include/class.queue.php
+++ b/include/class.queue.php
@@ -58,6 +58,12 @@ class CustomQueue extends VerySimpleModel {
         ));
     }
 
+    function __onload() {
+        // Ensure valid state
+        if ($this->hasFlag(self::FLAG_INHERIT_COLUMNS) || !$this->parent_id)
+            $this->clearFlag(self::FLAG_INHERIT_COLUMNS);
+    }
+
     function getId() {
         return $this->id;
     }
@@ -745,7 +751,7 @@ class CustomQueue extends VerySimpleModel {
             // Re-sort the in-memory columns array
             $this->columns->sort(function($c) { return $c->sort; });
         }
-        else {
+        elseif ($this->parent) {
             // No columns -- imply column inheritance
             $this->setFlag(self::FLAG_INHERIT_COLUMNS);
         }
-- 
GitLab