From f186db050c079b649e3bc174d4aeb326abed4b9e Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Fri, 18 Mar 2016 09:54:44 +0800 Subject: [PATCH] MDL-53538 mod_data: Show no records message instead of error. When there are no records in the database module and a user does an advanced search. Show a message that there are no entries in the database. --- mod/data/lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mod/data/lib.php b/mod/data/lib.php index a85601cece5..88827767a6a 100644 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -3654,6 +3654,11 @@ function data_get_all_recordids($dataid, $selectdata = '', $params = null) { * @return array $recordids An array of record ids. */ function data_get_advance_search_ids($recordids, $searcharray, $dataid) { + // Check to see if we have any record IDs. + if (empty($recordids)) { + // Send back an empty search. + return array(); + } $searchcriteria = array_keys($searcharray); // Loop through and reduce the IDs one search criteria at a time. foreach ($searchcriteria as $key) {