From 16860ce7f7341cbe1a6f214caaef3abc7e45c6f0 Mon Sep 17 00:00:00 2001 From: Gilles Crettenand Date: Thu, 28 May 2015 12:36:02 +0200 Subject: [PATCH] better random book filter --- mobile.netbiblio.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mobile.netbiblio.php b/mobile.netbiblio.php index e93e973..0d6f5f3 100644 --- a/mobile.netbiblio.php +++ b/mobile.netbiblio.php @@ -265,7 +265,14 @@ class NetBiblio extends WebService public function GetRandomBooks($number = 100) { $sql = "SELECT TOP $number NoticeId FROM Notices - WHERE Notices.[NoticeNr] NOT LIKE '%%~%%' + WHERE + ( + Notices.MediaType1Code='CDD' OR + Notices.MediaType1Code='CDA' OR + Notices.MediaType1Code='CDS' + ) + AND Notices.Visible=1 + AND Notices.[NoticeNr] NOT LIKE '%%~%%' ORDER BY NEWID();"; $ids = Connection::execute($sql)->to_array(); $ids = array_map(function($a) { return $a['NoticeId']; }, $ids);