Skip to content
Snippets Groups Projects
Unverified Commit 35d5ac53 authored by Dan Garner's avatar Dan Garner Committed by GitHub
Browse files

Library: fix filtering issue with media used as background images on layouts (#2840)

fixes xibosignageltd/xibo-private#879
parent 9b5c8161
No related branches found
No related tags found
No related merge requests found
......@@ -791,9 +791,14 @@ class MediaFactory extends BaseFactory
ON widget.widgetId = lkwidgetmedia.widgetId
WHERE region.layoutId = :layoutId ';
// include Media only for non dynamic Playlists #2392
// include Media only for non-dynamic Playlists #2392
if ($sanitizedFilter->getInt('excludeDynamicPlaylistMedia') === 1) {
$body .= ' AND lkplaylistplaylist.childId IN (SELECT playlistId FROM playlist WHERE playlist.playlistId = lkplaylistplaylist.childId AND playlist.isDynamic = 0) ';
$body .= ' AND lkplaylistplaylist.childId IN (
SELECT playlistId
FROM playlist
WHERE playlist.playlistId = lkplaylistplaylist.childId
AND playlist.isDynamic = 0
) ';
}
if ($sanitizedFilter->getInt('widgetId') !== null) {
......@@ -801,14 +806,18 @@ class MediaFactory extends BaseFactory
$params['widgetId'] = $sanitizedFilter->getInt('widgetId');
}
if ($sanitizedFilter->getInt('includeLayoutBackgroundImage') === 1) {
$body .= ' UNION ALL
SELECT `layout`.backgroundImageId AS mediaId
FROM `layout`
WHERE `layout`.layoutId = :layoutId
';
}
$body .= ' )
AND media.type <> \'module\'
';
if ($sanitizedFilter->getInt('includeLayoutBackgroundImage') === 1) {
$body .= ' OR media.mediaId IN ( SELECT `layout`.backgroundImageId FROM `layout` WHERE `layout`.layoutId = :layoutId ) ';
}
$params['layoutId'] = $sanitizedFilter->getInt('layoutId');
}
......
......@@ -340,7 +340,7 @@ class ModuleTemplateFactory extends BaseFactory
$template->templateId = $row['templateId'];
$template->dataType = $row['dataType'];
$template->isEnabled = $row['enabled'] == 1;
$template->ownerId = intval($row['ownerId']);
$template->ownerId = intval($row['ownerId'] ?? 0);
$template->groupsWithPermissions = $row['groupsWithPermissions'];
$templates[] = $template;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment