diff --git a/src/manage_packing_list_items.php b/src/manage_packing_list_items.php index 18af655..9d48bc0 100644 --- a/src/manage_packing_list_items.php +++ b/src/manage_packing_list_items.php @@ -75,7 +75,15 @@ $sql_all_articles = "SELECT a.id, a.name, a.weight_grams, a.quantity_owned, a.pr LEFT JOIN manufacturers m ON a.manufacturer_id = m.id LEFT JOIN storage_locations sl ON a.storage_location_id = sl.id LEFT JOIN users o ON a.owner_id = o.id - WHERE (a.user_id IN ($placeholders) + WHERE a.user_id IN ($placeholders)"; +$all_params = $household_member_ids; +$all_types = $types; +if ($current_user_household_id) { + $sql_all_articles .= " OR a.household_id = ?"; + $all_params[] = $current_user_household_id; + $all_types .= 'i'; +} +$stmt_all_articles = $conn->prepare($sql_all_articles); $stmt_all_articles->bind_param($all_types, ...$all_params); $stmt_all_articles->execute(); $all_articles_raw = $stmt_all_articles->get_result()->fetch_all(MYSQLI_ASSOC);