| @@ -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 | |