From 590e8a31cc8e50c2dbad8f543bc7be1cbb091fa6 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 27 May 2015 09:54:48 -0500
Subject: [PATCH] Fix a few more reported issues

* Fix crash saving a page (regression)
* Fix red banner deleting a department
* Fix crash deleting a knowledgebase article
---
 include/class.attachment.php | 5 ++---
 include/class.dept.php       | 2 +-
 include/class.page.php       | 1 +
 scp/js/jquery.dropdown.js    | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/class.attachment.php b/include/class.attachment.php
index c4fc059c4..3b25f87a0 100644
--- a/include/class.attachment.php
+++ b/include/class.attachment.php
@@ -176,11 +176,10 @@ extends InstrumentedList {
     }
 
     function deleteAll($inline_only=false){
-        $objects = $this;
         if ($inline_only)
-            $objects = $objects->filter(array('inline' => 1));
+            return $this->objects()->filter(array('inline' => 1))->delete();
 
-        return $objects->delete();
+        return parent::expunge();
     }
 
     function deleteInlines() {
diff --git a/include/class.dept.php b/include/class.dept.php
index 4e42d9335..a66198500 100644
--- a/include/class.dept.php
+++ b/include/class.dept.php
@@ -408,7 +408,7 @@ implements TemplateVariable {
             $this->getConfig()->destroy();
         }
 
-        return $num;
+        return true;
     }
 
     function __toString() {
diff --git a/include/class.page.php b/include/class.page.php
index 69596e882..6625c3f5c 100644
--- a/include/class.page.php
+++ b/include/class.page.php
@@ -45,6 +45,7 @@ class Page extends VerySimpleModel {
     function getHashtable() {
         $base = $this->ht;
         unset($base['topics']);
+        unset($base['attachments']);
         return $base;
     }
 
diff --git a/scp/js/jquery.dropdown.js b/scp/js/jquery.dropdown.js
index 84a843dfd..b516ea9d9 100644
--- a/scp/js/jquery.dropdown.js
+++ b/scp/js/jquery.dropdown.js
@@ -55,7 +55,7 @@ if(jQuery) (function($) {
 
 		dropdown.css({
 				left: -offset.left + (dropdown.hasClass('anchor-right') ?
-				trigger.offset().left - (dropdown.outerWidth() - trigger.outerWidth() - 4) : trigger.offset().left),
+				trigger.offset().left - (dropdown.outerWidth() - trigger.outerWidth() - 7) : trigger.offset().left),
 				top: -offset.top + trigger.offset().top + trigger.outerHeight()
 			}).show();
 		trigger.addClass('dropdown-open');
-- 
GitLab