Fix fulfilled wishes showing

This commit is contained in:
grandeljay 2022-12-05 11:19:21 +01:00
parent fa3a19382c
commit b0430aa896

View file

@ -64,8 +64,15 @@ class Wishlist
$WHERE = isset($sql['WHERE']) ? $sql['WHERE'] : '`wishlist` = ' . $this->id; $WHERE = isset($sql['WHERE']) ? $sql['WHERE'] : '`wishlist` = ' . $this->id;
$ORDER_BY = isset($sql['ORDER_BY']) ? $sql['ORDER_BY'] : '`priority` DESC, `url` ASC, `title` ASC'; $ORDER_BY = isset($sql['ORDER_BY']) ? $sql['ORDER_BY'] : '`priority` DESC, `url` ASC, `title` ASC';
/** Determine if user owns the requested wish list */ /** Default to showing available wishes */
$wish_status = ' AND (`status` IS NULL)'; $wish_status = ' AND (
`wishes`.`status` IS NULL
OR (
`wishes`.`status` != "' . Wish::STATUS_UNAVAILABLE . '"
AND `wishes`.`status` != "' . Wish::STATUS_FULFILLED . '"
AND `wishes`.`status` < unix_timestamp(CURRENT_TIMESTAMP - INTERVAL ' . Wish::STATUS_TEMPORARY_MINUTES . ' MINUTE)
)
)';
if ($_SESSION['user']->isLoggedIn()) { if ($_SESSION['user']->isLoggedIn()) {
$wishlist_ids = array_map( $wishlist_ids = array_map(
@ -75,8 +82,9 @@ class Wishlist
$_SESSION['user']->getWishlists() $_SESSION['user']->getWishlists()
); );
/** Show all wishes (except fulfilled) */
if (in_array($this->id, $wishlist_ids, true)) { if (in_array($this->id, $wishlist_ids, true)) {
$wish_status = ''; $wish_status = ' AND (`wishes`.`status` IS NULL OR `wishes`.`status` != "' . Wish::STATUS_FULFILLED . '")';
} }
} }