PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | admin/helpers/src/task/model/task.php +8 -2 1.8.13 → 1.8.16 View file →
@@ -71,9 +71,9 @@
71 71 * @param int $start Query limit start.
72 72 * @param int $lim Query limit value.
73 73 * @param array $cols Optional list of columns to fetch.
74 74 *
75 - * @return array List of record objects.
75 + * @return array|int List of record objects, or integer if counting columns.
76 76 */
77 77 public function getItems(array $clauses = [], $start = 0, $lim = 0, array $cols = [])
78 78 {
79 79 $app = JFactory::getApplication();
@@ -223,9 +223,9 @@
223 223 * @param int $start Query limit start.
224 224 * @param int $lim Query limit value.
225 225 * @param bool $count True for counting rather than fetching.
226 226 *
227 - * @return array List of record objects.
227 + * @return array|int List of record objects, or integer if counting columns.
228 228 */
229 229 public function filterItems(array $filters, $start = 0, $lim = 0, bool $count = false)
230 230 {
231 231 $app = JFactory::getApplication();
@@ -300,8 +300,14 @@
300 300 $instructions = [
301 301 $dbo->qn('ta.id_operator') . ' = ' . $filters['operator'],
302 302 $dbo->qn('ta.id_operator') . ' IS NULL',
303 303 ];
304 + if (is_array($filters['id_rooms'] ?? null) && ($id_rooms = array_filter($filters['id_rooms']))) {
305 + // operators should be able to accept only the unassigned tasks that belong to their listings
306 + $instructions[1] .= ' AND ' . $dbo->qn('t.id_room') . ' IN (' . implode(', ', array_map('intval', $id_rooms)) . ')';
307 + // unset the "id_rooms" filter as it was already applied
308 + unset($filters['id_rooms']);
309 + }
304 310 $instruction = '(' . implode(' OR ', array_map(function($q) {
305 311 return '(' . $q . ')';
306 312 }, $instructions)) . ')';
307 313