From c754f04f425bf73be9b92ea20ab54325b4e46ce9 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 7 Apr 2014 14:23:16 -0500
Subject: [PATCH] oops: Fixup plugin configuration loading

The code introduced to convert the database values to PHP values introduced
a bug where the configuration would not be saved.
---
 include/class.plugin.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/class.plugin.php b/include/class.plugin.php
index f571ad75d..7e1a2b228 100644
--- a/include/class.plugin.php
+++ b/include/class.plugin.php
@@ -9,8 +9,12 @@ class PluginConfig extends Config {
         // Use parent constructor to place configurable information into the
         // central config table in a namespace of "plugin.<id>"
         parent::Config("plugin.$name");
-        foreach ($this->getOptions() as $name => $field)
-            $this->config[$name]['value'] = $field->to_php($this->get($name));
+        foreach ($this->getOptions() as $name => $field) {
+            if ($this->exists($name))
+                $this->config[$name]['value'] = $field->to_php($this->get($name));
+            elseif ($default = $field->get('default'))
+                $this->defaults[$name] = $default;
+        }
     }
 
     /* abstract */
-- 
GitLab