From 8ddda178ea3e3a5b55060666fbba30d8f9d6b151 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 27 May 2021 18:12:40 +0000 Subject: [PATCH] wait #4495 @0.75 --- inc/ws/Controlleur/class.ws.flash.php | 2 +- inc/ws/DAO/class.ws.dao.theme.php | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index e0fdf2516..cfe33c005 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -441,7 +441,7 @@ class wsFlash extends cubeFlashGateway $readOnly = array(1); $dao = new wsDAOTheme($core->con); - $themes = $dao->getAllThemes($core->user, 'ORDER BY FIELD (theme_id,' . $this->args['book_id'] . ',' . implode(',', $demos) . ') DESC, theme_id DESC', $demos); + $themes = $dao->getAllThemes($core->user, 'ORDER BY FIELD (theme_id,' . $this->args['book_id'] . ',' . implode(',', $demos) . ') DESC, theme_id DESC', $demos,$this->xml); foreach ($themes as $theme) { $t = $this->xml->addChild('theme'); $t->addAttribute('id', $theme->theme_id); diff --git a/inc/ws/DAO/class.ws.dao.theme.php b/inc/ws/DAO/class.ws.dao.theme.php index c54492abf..aeef4b92f 100644 --- a/inc/ws/DAO/class.ws.dao.theme.php +++ b/inc/ws/DAO/class.ws.dao.theme.php @@ -52,12 +52,17 @@ class wsDAOTheme extends commonDAO $sql = 'SELECT * FROM themes_vue'; } else { $or = ''; - if (wsDroits::revendeur() && !is_null($demos)) { - $or = ' OR theme_id IN(' . implode(',', $demos) . ')'; + if (wsDroits::revendeur()) { + if (!is_null($demos)) { + $or .= ' OR theme_id IN(' . implode(',', $demos) . ') '; + } + $or .= ') OR ( proprietaire IN(' . $user->ws_rights . ') '; } $sql = 'SELECT * FROM themes_vue WHERE theme_id IN (SELECT theme FROM books WHERE proprietaire IN(' . $user->ws_rights . ') ' . $or . ')'; } - $r = $this->con->select($sql . ' ' . $order); + $sql .= ' ' . $order; + + $r = $this->con->select($sql); return $this->factory($r); } @@ -159,11 +164,11 @@ class wsDAOTheme extends commonDAO } - $theme=$this->selectById($c->theme_id); + $theme = $this->selectById($c->theme_id); try { $api = new ws3API(); $api->createTheme($theme); - }catch (Exception $e){ + } catch (Exception $e) { print_r($e); exit; } -- 2.39.5