diff --git a/libraries/src/Table/Nested.php b/libraries/src/Table/Nested.php index 99845f3d33850..068821fe576ac 100644 --- a/libraries/src/Table/Nested.php +++ b/libraries/src/Table/Nested.php @@ -874,10 +874,11 @@ public function publish($pks = null, $state = 1, $userId = 0) { $k = $this->_tbl_key; - $query = $this->_db->getQuery(true); - $table = $this->_db->quoteName($this->_tbl); - $published = $this->_db->quoteName($this->getColumnAlias('published')); - $key = $this->_db->quoteName($k); + $query = $this->_db->getQuery(true); + $table = $this->_db->quoteName($this->_tbl); + $published = $this->_db->quoteName($this->getColumnAlias('published')); + $checkedOut = $this->_db->quoteName($this->getColumnAlias('checked_out')); + $key = $this->_db->quoteName($k); // Sanitize input. $pks = ArrayHelper::toInteger($pks); @@ -919,7 +920,7 @@ public function publish($pks = null, $state = 1, $userId = 0) ->select('COUNT(' . $k . ')') ->from($this->_tbl) ->where('lft BETWEEN ' . (int) $node->lft . ' AND ' . (int) $node->rgt) - ->where('(checked_out <> 0 AND checked_out <> ' . (int) $userId . ')'); + ->where('(' . $checkedOut . ' <> 0 AND ' . $checkedOut . ' <> ' . (int) $userId . ')'); $this->_db->setQuery($query); // Check for checked out children.