Skip to content

Commit

Permalink
Merge branch 'staging' into save
Browse files Browse the repository at this point in the history
  • Loading branch information
Quy committed Jan 15, 2020
2 parents 5dd7cf7 + 49636e1 commit 09e3f59
Show file tree
Hide file tree
Showing 91 changed files with 284 additions and 172 deletions.
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
description="COM_ACTIONLOGS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
Expand Down
@@ -0,0 +1 @@
CREATE INDEX "#__users_email_lower" ON "#__users" (lower("email"));
Expand Up @@ -26,6 +26,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_ASSOCIATIONS_FILTER_SEARCH_LABEL"
description="COM_ASSOCIATIONS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_BANNERS_BANNERS_FILTER_SEARCH_LABEL"
description="COM_BANNERS_BANNERS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_BANNERS_CLIENTS_FILTER_SEARCH_LABEL"
description="COM_BANNERS_CLIENTS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_BANNERS_TRACKS_FILTER_SEARCH_LABEL"
description="COM_BANNERS_TRACKS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -13,6 +13,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_CACHE_FILTER_SEARCH_LABEL"
description="COM_CACHE_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -6,6 +6,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_CATEGORIES_FILTER_SEARCH_LABEL"
description="COM_CATEGORIES_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_CHECKIN_FILTER_SEARCH_LABEL"
description="COM_CHECKIN_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand All @@ -25,7 +26,7 @@
<option value="table DESC">COM_CHECKIN_DATABASE_TABLE_DESC</option>
<option value="count ASC">COM_CHECKIN_ITEMS_TO_CHECK_IN_ASC</option>
<option value="count DESC">COM_CHECKIN_ITEMS_TO_CHECK_IN_DESC</option>
</field>
</field>
<field
name="limit"
type="limitbox"
Expand Down
48 changes: 10 additions & 38 deletions administrator/components/com_contact/models/contacts.php
Expand Up @@ -214,46 +214,18 @@ protected function getListQuery()

if ($assoc)
{
$query->select('COUNT(' . $db->quoteName('asso2.id') . ') > 1 as ' . $db->quoteName('association'))
->join(
'LEFT',
$db->quoteName('#__associations', 'asso') . ' ON ' . $db->quoteName('asso.id') . ' = ' . $db->quoteName('a.id')
. ' AND ' . $db->quoteName('asso.context') . ' = ' . $db->quote('com_contact.item')
)
->join(
'LEFT',
$db->quoteName('#__associations', 'asso2') . ' ON ' . $db->quoteName('asso2.key') . ' = ' . $db->quoteName('asso.key')
)
->group(
$db->quoteName(
array(
'a.id',
'a.name',
'a.alias',
'a.checked_out',
'a.checked_out_time',
'a.catid',
'a.user_id',
'a.published',
'a.access',
'a.created',
'a.created_by',
'a.ordering',
'a.featured',
'a.language',
'a.publish_up',
'a.publish_down',
'ul.name' ,
'ul.email',
'l.title' ,
'l.image' ,
'uc.name' ,
'ag.title' ,
'c.title',
'c.level'
)
$subQuery = $db->getQuery(true)
->select('COUNT(' . $db->quoteName('asso1.id') . ') > 1')
->from($db->quoteName('#__associations', 'asso1'))
->join('INNER', $db->quoteName('#__associations', 'asso2') . ' ON ' . $db->quoteName('asso1.key') . ' = ' . $db->quoteName('asso2.key'))
->where(
array(
$db->quoteName('asso1.id') . ' = ' . $db->quoteName('a.id'),
$db->quoteName('asso1.context') . ' = ' . $db->quote('com_contact.item'),
)
);

$query->select('(' . $subQuery . ') AS ' . $db->quoteName('association'));
}

// Filter by access level.
Expand Down
Expand Up @@ -6,6 +6,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_CONTACT_FILTER_SEARCH_LABEL"
description="COM_CONTACT_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
79 changes: 48 additions & 31 deletions administrator/components/com_content/models/articles.php
Expand Up @@ -186,7 +186,7 @@ protected function getListQuery()
$query->select(
$this->getState(
'list.select',
'DISTINCT a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid' .
'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid' .
', a.state, a.access, a.created, a.created_by, a.created_by_alias, a.modified, a.ordering, a.featured, a.language, a.hits' .
', a.publish_up, a.publish_down, a.note'
)
Expand Down Expand Up @@ -219,11 +219,8 @@ protected function getListQuery()
->join('LEFT', '#__users AS ua ON ua.id = a.created_by');

// Join on voting table
$assogroup = 'a.id, l.title, l.image, uc.name, ag.title, c.title, ua.name, c.created_user_id, c.level, parent.id';

if (JPluginHelper::isEnabled('content', 'vote'))
{
$assogroup .= ', v.rating_sum, v.rating_count';
$query->select('COALESCE(NULLIF(ROUND(v.rating_sum / v.rating_count, 0), 0), 0) AS rating,
COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count')
->join('LEFT', '#__content_rating AS v ON a.id = v.content_id');
Expand All @@ -232,10 +229,18 @@ protected function getListQuery()
// Join over the associations.
if (JLanguageAssociations::isEnabled())
{
$query->select('CASE WHEN COUNT(asso2.id)>1 THEN 1 ELSE 0 END as association')
->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_content.item'))
->join('LEFT', '#__associations AS asso2 ON ' . $db->quoteName('asso2.key') . ' = ' . $db->quoteName('asso.key'))
->group($assogroup);
$subQuery = $db->getQuery(true)
->select('COUNT(' . $db->quoteName('asso1.id') . ') > 1')
->from($db->quoteName('#__associations', 'asso1'))
->join('INNER', $db->quoteName('#__associations', 'asso2') . ' ON ' . $db->quoteName('asso1.key') . ' = ' . $db->quoteName('asso2.key'))
->where(
array(
$db->quoteName('asso1.id') . ' = ' . $db->quoteName('a.id'),
$db->quoteName('asso1.context') . ' = ' . $db->quote('com_content.item'),
)
);

$query->select('(' . $subQuery . ') AS ' . $db->quoteName('association'));
}

// Filter by access level.
Expand Down Expand Up @@ -353,36 +358,48 @@ protected function getListQuery()
$query->where('a.language = ' . $db->quote($language));
}

// Filter by a single or group of tags.
$hasTag = false;
$tagId = $this->getState('filter.tag');
$tag = $this->getState('filter.tag');

if (is_numeric($tagId))
// Run simplified query when filtering by one tag.
if (\is_array($tag) && \count($tag) === 1)
{
$hasTag = true;

$query->where($db->quoteName('tagmap.tag_id') . ' = ' . (int) $tagId);
$tag = $tag[0];
}
elseif (is_array($tagId))
{
$tagId = ArrayHelper::toInteger($tagId);
$tagId = implode(',', $tagId);

if (!empty($tagId))
{
$hasTag = true;

$query->where($db->quoteName('tagmap.tag_id') . ' IN (' . $tagId . ')');
}
}

if ($hasTag)
if ($tag && \is_array($tag))
{
$query->join('LEFT', $db->quoteName('#__contentitem_tag_map', 'tagmap')
. ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
. ' AND ' . $db->quoteName('tagmap.type_alias') . ' = ' . $db->quote('com_content.article')
$tag = ArrayHelper::toInteger($tag);

$subQuery = $db->getQuery(true)
->select('DISTINCT ' . $db->quoteName('content_item_id'))
->from($db->quoteName('#__contentitem_tag_map'))
->where(
array(
$db->quoteName('tag_id') . ' IN (' . implode(',', $tag) . ')',
$db->quoteName('type_alias') . ' = ' . $db->quote('com_content.article'),
)
);

$query->join(
'INNER',
'(' . $subQuery . ') AS ' . $db->quoteName('tagmap')
. ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
);
}
elseif ($tag = (int) $tag)
{
$query->join(
'INNER',
$db->quoteName('#__contentitem_tag_map', 'tagmap')
. ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
)
->where(
array(
$db->quoteName('tagmap.tag_id') . ' = ' . $tag,
$db->quoteName('tagmap.type_alias') . ' = ' . $db->quote('com_content.article'),
)
);
}

// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_CONTENT_FILTER_SEARCH_LABEL"
description="COM_CONTENT_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_CONTENT_FILTER_SEARCH_LABEL"
description="COM_CONTENT_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -11,6 +11,7 @@
<field
name="search"
type="text"
inputmode="search"
label=""
description="COM_FIELDS_FIELDS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -11,6 +11,7 @@
<field
name="search"
type="text"
inputmode="search"
description="COM_FIELDS_GROUPS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
class="js-stools-search-string"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_FINDER_SEARCH_FILTER_SEARCH_LABEL"
description="COM_FINDER_SEARCH_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_FINDER_INDEX_SEARCH_LABEL"
description="COM_FINDER_INDEX_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_FINDER_SEARCH_SEARCH_QUERY_LABEL"
description="COM_FINDER_SEARCH_SEARCH_QUERY_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -6,6 +6,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_DISCOVER_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_DISCOVER_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_LANGUAGES_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_LANGUAGES_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -6,6 +6,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_MANAGE_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_MANAGE_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -6,6 +6,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_UPDATE_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_UPDATE_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -6,6 +6,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_UPDATESITES_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_UPDATESITES_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -13,6 +13,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_LANGUAGES_INSTALLED_FILTER_SEARCH_LABEL"
description="COM_LANGUAGES_INSTALLED_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -4,6 +4,7 @@
<field
name="search"
type="text"
inputmode="search"
label="JSEARCH_FILTER"
description="COM_LANGUAGES_SEARCH_IN_TITLE"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -12,6 +12,7 @@
<field
name="search"
type="text"
inputmode="search"
label="JSEARCH_FILTER"
description="COM_LANGUAGES_SEARCH_IN_TITLE"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -27,6 +27,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_MENUS_ITEMS_SEARCH_FILTER_LABEL"
description="COM_MENUS_ITEMS_SEARCH_FILTER"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -28,6 +28,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_MENUS_ITEMS_SEARCH_FILTER_LABEL"
description="COM_MENUS_ITEMS_SEARCH_FILTER"
hint="JSEARCH_FILTER"
Expand Down
Expand Up @@ -14,6 +14,7 @@
<field
name="search"
type="text"
inputmode="search"
label="COM_MENUS_MENUS_FILTER_SEARCH_LABEL"
description="COM_MENUS_MENUS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
Expand Down

0 comments on commit 09e3f59

Please sign in to comment.