| @@ -188,8 +188,9 @@ | ||
| 188 | 188 | |
| 189 | 189 | // check sub-units |
| 190 | 190 | $use_sub_units = (int)$this->getParam('use_sub_units', 0); |
| 191 | 191 | if ($use_sub_units) { |
| 192 | + $sub_unit_matched = false; | |
| 192 | 193 | // parse again the rooms booked |
| 193 | 194 | foreach ($rooms_booked as $rb) { |
| 194 | 195 | // grab the sub-unit index for this room id |
| 195 | 196 | $room_sub_unit_filt = (int)$this->getParam('sub_unit_' . $rb['idroom'], 0); |
| @@ -196,13 +197,15 @@ | ||
| 196 | 197 | if (empty($room_sub_unit_filt)) { |
| 197 | 198 | // no sub-unit defined for this room ID |
| 198 | 199 | continue; |
| 199 | 200 | } |
| 200 | - if ($rb['roomindex'] != $room_sub_unit_filt) { | |
| 201 | - // the index of the room booked is not the one in the params | |
| 202 | - return false; | |
| 201 | + if ($rb['roomindex'] == $room_sub_unit_filt) { | |
| 202 | + // the index of the room booked matched the one in the params | |
| 203 | + $sub_unit_matched = true; | |
| 203 | 204 | } |
| 204 | 205 | } |
| 206 | + | |
| 207 | + return $one_found && $sub_unit_matched; | |
| 205 | 208 | } |
| 206 | 209 | |
| 207 | 210 | // return true if at least one room booked is in the parameters |
| 208 | 211 | return $one_found; |