From 350bd6d2c9c32eeed80b23e60ccabc90fce41f0e Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 28 May 2015 13:32:03 -0500 Subject: [PATCH] oops: Fix crashes on installation --- include/class.orm.php | 9 +++++---- include/class.ticket.php | 8 +++++--- setup/css/wizard.css | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/class.orm.php b/include/class.orm.php index ef3e2cea4..7c715f43a 100644 --- a/include/class.orm.php +++ b/include/class.orm.php @@ -42,6 +42,8 @@ class ModelMeta implements ArrayAccess { 'defer' => array(), 'select_related' => array(), 'view' => false, + 'joins' => array(), + 'foreign_keys' => array(), ); static $model_cache; @@ -68,7 +70,7 @@ class ModelMeta implements ArrayAccess { sprintf(__('%s: Model does not define meta.pk'), $model)); // Ensure other supported fields are set and are arrays - foreach (array('pk', 'ordering', 'defer') as $f) { + foreach (array('pk', 'ordering', 'defer', 'select_related') as $f) { if (!isset($meta[$f])) $meta[$f] = array(); elseif (!is_array($meta[$f])) @@ -76,8 +78,6 @@ class ModelMeta implements ArrayAccess { } // Break down foreign-key metadata - if (!isset($meta['joins'])) - $meta['joins'] = array(); foreach ($meta['joins'] as $field => &$j) { $this->processJoin($j); if ($j['local']) @@ -327,7 +327,7 @@ class VerySimpleModel { else throw new InvalidArgumentException( sprintf(__('Expecting NULL or instance of %s. Got a %s instead'), - $j['fkey'][0], get_class($value))); + $j['fkey'][0], is_object($value) ? get_class($value) : gettype($value))); // Capture the foreign key id value $field = $j['local']; @@ -2058,6 +2058,7 @@ class MySqlCompiler extends SqlCompiler { function compileCount($queryset) { $model = $queryset->model; + $model::_inspect(); $table = $model::$meta['table']; list($where, $having) = $this->getWhereHavingClause($queryset); $joins = $this->getJoins($queryset); diff --git a/include/class.ticket.php b/include/class.ticket.php index c8f0d1afd..a9b2b0078 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -73,7 +73,7 @@ class TicketModel extends VerySimpleModel { 'null' => true, ), 'thread' => array( - 'reverse' => 'Thread.ticket', + 'reverse' => 'TicketThread.ticket', 'list' => false, 'null' => true, ), @@ -220,6 +220,7 @@ implements RestrictedAccess, Threadable { ); var $lastMsgId; + var $last_message; var $owner; // TicketOwner var $_user; // EndUser @@ -3075,9 +3076,10 @@ implements RestrictedAccess, Threadable { $ticket = parent::create(array( 'created' => SqlFunction::NOW(), 'lastupdate' => SqlFunction::NOW(), + 'number' => $number, 'user' => $user, - 'dept' => $deptId, - 'topicId' => $topicId, + 'dept_id' => $deptId, + 'topic_id' => $topicId, 'ip_address' => $ipaddress, 'source' => $source, )); diff --git a/setup/css/wizard.css b/setup/css/wizard.css index a742c75cb..9d4e8b6ae 100644 --- a/setup/css/wizard.css +++ b/setup/css/wizard.css @@ -11,7 +11,7 @@ a { color: #2a67ac; display: inline-block; } .hidden { display: none;} .error { color:#f00;} -#header { height: 72px; margin-bottom: 20px; width: 100%; } +#header { min-height: 72px; margin-bottom: 20px; width: 100%; } #header #logo { width: 280px; height: 72px; display: block; float: left; } #header .info { font-size: 11pt; font-weight: bold; border-bottom: 1px solid #2a67ac; color: #444; text-align: right; float: right; } #header ul { margin: 0; padding: 0; text-align: right; } -- GitLab