]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 19 Jan 2011 14:48:46 +0000 (14:48 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 19 Jan 2011 14:48:46 +0000 (14:48 +0000)
13 files changed:
inc/commons/DAO/class.common.dao.client.php
inc/commons/DAO/class.common.dao.entreprise.php
inc/commons/DAO/class.common.dao.utilisateur.php
inc/commons/Metier/class.common.entreprise.php
inc/commons/Metier/class.common.utilisateur.php
inc/commons/class.common.core.php
inc/commons/class.common.droits.php
inc/commons/class.common.page.php
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.droits.php
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.theme.php

index a0f948ba321b73e6bb4918bab4ddf4f365545257..98e147d169b8a94a30244e16aebe961f652470dd 100644 (file)
@@ -38,6 +38,7 @@ class commonDAOClient extends commonDAOUtilisateur {
        public function getListe($orderby = null, $sens = null, $limit = null, $where = null, $limitedToUserRights = false)\r
        {\r
                $sql = $this->getQueryList('clients', $orderby, $sens, $limit, $where,$limitedToUserRights);\r
+               fb($sql);\r
                $r = $this->con->select($sql);\r
                return $this->factory($r);\r
        }\r
index 481b455eafdbf5940f9f8c30e2e70afe5c5e28cf..9066a3d2318424e564d5514ace0fc75ddd0fe208 100644 (file)
@@ -16,6 +16,7 @@ class commonDAOEntreprise extends commonDAO {
                $entreprise->adresse_facturation = $r->adresse_facturation;\r
                $entreprise->ws_admin = $r->ws_admin;\r
                $entreprise->ws_grade = $r->ws_grade;\r
+               $entreprise->ws_signatures = $r->ws_signatures;\r
 \r
                return $entreprise;\r
        }\r
@@ -61,16 +62,18 @@ class commonDAOEntreprise extends commonDAO {
 \r
        public function getListe($orderby = null, $sens = null, $limit = null, $limitedToUserRights = false)\r
        {\r
+               $where = '(';\r
                if (!is_null($this->q)) {\r
                        $daoClients = new commonDAOClient($this->con);\r
-                       $where = '';\r
+\r
                        $where .= 'entreprise_id=\'' . $this->con->escape($this->q) . '\' OR ';\r
                        $where .= 'nom LIKE \'%' . $this->con->escape($this->q) . '%\' OR ';\r
                        $where .= 'entreprise_id IN (SELECT entreprise FROM utilisateurs WHERE(' . $daoClients->whereSearchByName($this->q, false) . ') AND grade=0) ';\r
                        $limit = null;\r
                } else {\r
-                       $where = $this->makeWhereFromFiltres();\r
+                       $where .= $this->makeWhereFromFiltres();\r
                }\r
+               $where .= ') ';\r
 \r
                $where .= $this->limitToUserRights($limitedToUserRights);\r
 \r
@@ -79,6 +82,9 @@ class commonDAOEntreprise extends commonDAO {
                $limit = is_null($limit)?'':$this->con->limit($limit[0], $limit[1]);\r
 \r
                $sql = 'SELECT * FROM entreprises_vue WHERE ' . $where . ' ORDER BY ' . $orderby . ' ' . $sens . ' ' . $limit;\r
+\r
+               fb($sql);\r
+\r
                $r = $this->con->select($sql);\r
                $ids = array();\r
                while ($r->fetch()) {\r
@@ -136,6 +142,13 @@ class commonDAOEntreprise extends commonDAO {
                if (isset($data['ws_grade'])) {\r
                        $c->ws_grade = $data['ws_grade'];\r
                }\r
+               if (isset($data['ws_signatures'])) {\r
+                       $signatures = $data['ws_signatures'];\r
+                       if (!in_array(1, $signatures)) {\r
+                               $signatures[] = 1;\r
+                       }\r
+                       $c->ws_signatures = implode(',', $signatures);\r
+               }\r
 \r
                if ($data['entreprise_id'] == 'new' || $data['entreprise_id'] == '') {\r
                        $c->date_creation = TIME;\r
index 2f6688d1973116f7081f88a1f499adff69df88c4..38c943f59e4d9ed9cebf2b690e43d785e94c9a76 100644 (file)
@@ -54,7 +54,9 @@ class commonDAOUtilisateur extends commonDAO {
                if (isset($r->ws_rights)) {\r
                        $utilisateur->ws_rights = $r->ws_rights;\r
                }\r
-\r
+               if (isset($r->ws_signatures)) {\r
+                       $utilisateur->ws_signatures = $r->ws_signatures;\r
+               }\r
                return $utilisateur;\r
        }\r
 \r
@@ -131,8 +133,6 @@ class commonDAOUtilisateur extends commonDAO {
                $wherec = $where;\r
                $where = '(';\r
                if (!is_null($this->q)) {\r
-\r
-\r
                        if ($this->search_id) {\r
                                $where .= 'utilisateur_id=\'' . $this->con->escape($this->q) . '\' OR ';\r
                        }\r
@@ -163,6 +163,7 @@ class commonDAOUtilisateur extends commonDAO {
        public function getListe($orderby = null, $sens = null, $limit = null, $where = null, $limitedToUserRights = false)\r
        {\r
                $sql = $this->getQueryList('utilisateurs_entreprise', $orderby, $sens, $limit, $where, $limitedToUserRights);\r
+               fb($sql);\r
                $r = $this->con->select($sql);\r
                return $this->factory($r);\r
        }\r
index 1f4f220ee8d043a122699d3179723deb7aaccf09..d102aaf38ebb8d2f568a8cc82e461de0164f1d17 100644 (file)
@@ -13,6 +13,7 @@ class commonEntreprise extends cubeMetier {
        protected $adresse_facturation;\r
        protected $ws_admin;\r
        protected $ws_grade;\r
+       protected $ws_signatures;\r
        // Composés\r
        protected $ca;\r
        protected $impaye;\r
index ec731e90bedbe9319f8e7ad00f1f11f803e5ad1e..518fcbf2da67daacd4357f5739208df2dfcb55dc 100644 (file)
@@ -27,6 +27,7 @@ class commonUtilisateur extends cubeMetier {
        protected $ws_grade;\r
        protected $ws_settings;\r
        protected $ws_rights;\r
+       protected $ws_signatures;\r
 \r
        public function getEmail()\r
        {\r
@@ -40,7 +41,7 @@ class commonUtilisateur extends cubeMetier {
 \r
        public function getSettings($liste)\r
        {\r
-               $cles = array('clients' => 'entreprise_id', 'equipiers' => 'utilisateur_id', 'devis' => 'devis_id', 'projets' => 'projet_id', 'factures' => 'facture_id', 'timereport' => 'projet_id', 'fichiers' => 'nom', 'books' => 'book_id');\r
+               $cles = array('clients' => 'entreprise_id', 'equipiers' => 'utilisateur_id', 'devis' => 'devis_id', 'projets' => 'projet_id', 'factures' => 'facture_id', 'timereport' => 'projet_id', 'fichiers' => 'nom', 'publications' => 'book_id');\r
                if (!isset($this->settings['search'][$liste]) || !is_array($this->settings['search'][$liste])) {\r
                        $this->settings['search'][$liste] = array();\r
                }\r
index aed22372344c002598213d003638822d02eccbf0..87655d801f8d021af66d33fbb1624220d38dbf76 100644 (file)
@@ -162,6 +162,7 @@ class commonCore extends cubeCore {
                $db->entreprises->date_creation('integer', 0, false);\r
                $db->entreprises->notes('text', 0, false);\r
                $db->entreprises->site('varchar', 256, false);\r
+               $db->entreprises->ws_signatures('text', 0, false);\r
                // Clés\r
                $db->entreprises->primary('pk_entreprises', 'entreprise_id');\r
                $db->entreprises->index('index_entreprises_nom', 'BTREE', 'nom');\r
@@ -417,7 +418,7 @@ class commonCore extends cubeCore {
                $this->views->createView('clients_entreprise', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation '\r
                         . 'FROM entreprises e LEFT JOIN utilisateurs u ON u.entreprise=e.entreprise_id AND u.grade=0');\r
                $this->views->createView('utilisateurs_entreprise', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation, '\r
-                        . 'e.ws_grade, e.ws_admin '\r
+                        . 'e.ws_grade, e.ws_admin, e.ws_signatures AS ws_signatures '\r
                         . 'FROM entreprises e LEFT JOIN utilisateurs u ON u.entreprise=e.entreprise_id');\r
                $this->views->createView('clients', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation, i.impaye, '\r
                         . 'SUM(f.total_ht) AS ca '\r
index 62a1269b6794b3d62185a79117e7c7dc202d82b5..4a81a4eacfccbbb617fb47319ce955ff87d7f6e9 100644 (file)
@@ -35,8 +35,16 @@ class commonDroits {
        public static function recherche($page)\r
        {\r
                global $core;\r
-               $droits = array('projets' => 1, 'factures' => 1, 'devis' => 1, 'clients' => 1, 'timereport' => 1, 'fichiers' => 0, 'books' => 0);\r
-               return (isset($droits[$page]) && $droits[$page] <= $core->user->grade);\r
+               if (MODE == 'extranet') {\r
+                       $droits = array('projets' => 1, 'factures' => 1, 'devis' => 1, 'clients' => 1, 'timereport' => 1, 'fichiers' => 0);\r
+               } elseif (MODE == 'ws') {\r
+                       $droits = array('clients' => 3, 'fichiers' => 0, 'publications' => 3);\r
+               }\r
+               if (MODE == 'extranet') {\r
+                       return (isset($droits[$page]) && $droits[$page] <= $core->user->grade);\r
+               } else {\r
+                       return (isset($droits[$page]) && $droits[$page] <= $core->user->ws_grade);\r
+               }\r
        }\r
 \r
        public static function telecharger($utilisateur_id)\r
index 1ea161cbf9d582fbe4757ea9a6ae8881047da4cc..41000c8dbe7cfabb886ce2692ac49edc320052b5 100644 (file)
@@ -75,7 +75,7 @@ class commonPage {
                        }\r
                }\r
 \r
-               $supp = array('stats' => 'publication');\r
+               $supp = array('stats' => 'publications');\r
 \r
                $res = '<div id="nav">';\r
                foreach($onglets as $titre => $url) {\r
index d8ebbce80a15ae5cefa4378f5d4697d2eff08243..21cd6316a8c48b99a7cc90210fbd6c6b123747af 100644 (file)
@@ -123,7 +123,7 @@ class wsAjax extends cubeAjax {
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
 \r
-       public static function searchBooks($args, &$x)\r
+       public static function searchPublications($args, &$x)\r
        {\r
                $x->addContent('listeBooks', wsUrl::listeBooks());\r
        }\r
index b3c885a24f8df53fea077ee1d1121723723d47a8..b3743c7d2576caf697f2fb2fe11fe85a4f8c9ca4 100644 (file)
@@ -67,11 +67,19 @@ class wsDroits {
        {\r
                global $core;\r
 \r
+               $mySignatures = explode(',', $core->user->ws_signatures);\r
+               $mySignatures[] = 1;\r
+\r
+               $admin = wsDroits::admin(false);\r
+\r
                $dao = new wsDAOSignature($core->con);\r
 \r
                $signatures = $dao->selectAll();\r
                $res = array();\r
                foreach($signatures as $signature) {\r
+                       if (!$admin && !in_array($signature->signature_id, $mySignatures)) {\r
+                               continue;\r
+                       }\r
                        $res[$signature->nom] = $signature->signature_id;\r
                }\r
                return $res;\r
index 0a15911d8cabd514fd21676eddfb92c7c373463e..342f462b991c3c5b4b1a2748f1e41531a292fd85 100644 (file)
@@ -7,6 +7,12 @@ class wsFlash extends cubeFlashGateway {
                $args = cubePage::getArgs($args);\r
                $n = self::CNAME;\r
                $gateway = new $n($core->con, $args);\r
+\r
+               $droits = wsDroits::getDroits();\r
+               $gateway->addAttribute('creation', $droits->creation?'1':'0');\r
+               $gateway->addAttribute('revendeur', $droits->revendeur?'1':'0');\r
+               $gateway->addAttribute('admin', $droits->admin?'1':'0');\r
+               $gateway->addAttribute('grade', $core->user->ws_grade);\r
        }\r
 \r
        public function saveConversionSettings()\r
@@ -547,7 +553,7 @@ class wsFlash extends cubeFlashGateway {
                if (isset($this->args['book_id'])) {\r
                        $dao = new wsDAOBook($core->con);\r
                        $book = $dao->selectById($this->args['book_id']);\r
-                       $book->traductions=wsLang::checkTranslations($book->traductions);\r
+                       $book->traductions = wsLang::checkTranslations($book->traductions);\r
                        fb($book->traductions);\r
                        if ($book->traductions != array()) {\r
                                $bookLang = $this->xml->addChild('book_lang', json_encode($book->traductions));\r
@@ -584,6 +590,11 @@ class wsFlash extends cubeFlashGateway {
                $dao->setComposition($this->args['book_id'], json_decode($this->args['pages']));\r
        }\r
 \r
+       public function getTexts()\r
+       {\r
+               $this->xml->addChild('texts', json_encode($GLOBALS['__l10n']));\r
+       }\r
+\r
        public function compile()\r
        {\r
                global $core;\r
index e1e1984e67e464d028f6005a9a8d46cbe567c20d..6645a7be70ce7561adebda0e7ea9751c9f942248 100644 (file)
@@ -56,15 +56,15 @@ class wsUrl {
                if ($droits->admin) {\r
                        $res .= '<th>' . commonUrl::orderby(__('Facturation'), 'facturable', $settings, 'sort' . $change) . '</th>';\r
                }\r
-               $res .= '<th>' . commonUrl::orderby(__('Status'), 'status', $settings, 'sort' . $change) . '</th>';\r
-\r
-               $res .= '<th class="min"></th><th class="min"></th><th class="min"></th><th class="min"></th><th class="min"></th></tr>';\r
+               if ($droits->revendeur) {\r
+                       $res .= '<th>' . commonUrl::orderby(__('Status'), 'status', $settings, 'sort' . $change) . '</th>';\r
+               }\r
+               $res .= str_repeat('<th class="min"></th>', $droits->creation?5:4);\r
+               $res .= '</tr>';\r
                $i = 0;\r
 \r
                $btVoir = cubeMedia::cssRollover($core->typo->Voir('voir', '', false));\r
-               if ($droits->creation) {\r
-                       $btEdit = cubeMedia::cssRollover($core->typo->Editer('éditer', '', false));\r
-               }\r
+               $btEdit = cubeMedia::cssRollover($core->typo->Editer('éditer', '', false));\r
                $btStats = cubeMedia::cssRollover($core->typo->Stats('stats', '', false));\r
                $btDownload = cubeMedia::cssRollover($core->typo->BookTelecharger('télécharger', '', false));\r
                if ($droits->creation) {\r
@@ -87,11 +87,11 @@ class wsUrl {
                        if ($droits->admin) {\r
                                $res .= '<td>' . $book->facturable . '</td>';\r
                        }\r
-                       $res .= '<td>' . $core->books_status[$book->status] . '</td>';\r
-                       $res .= '<td class="bouton"><a class="popupFS" rev="viewer_' . $book->book_id . '" href="' . SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash . '/">' . $btVoir . '</a></td>';\r
-                       if ($droits->creation) {\r
-                               $res .= '<td class="bouton"><a class="popupFS" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
+                       if ($droits->revendeur) {\r
+                               $res .= '<td>' . $core->books_status[$book->status] . '</td>';\r
                        }\r
+                       $res .= '<td class="bouton"><a class="popupFS" rev="viewer_' . $book->book_id . '" href="' . SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash . '/">' . $btVoir . '</a></td>';\r
+                       $res .= '<td class="bouton"><a class="popupFS" rev="editor_' . $book->book_id . '" href="' . SITE_PATH . 'editor/' . $book->book_id . '">' . $btEdit . '</a></td>';\r
                        $res .= '<td class="bouton"><a href="' . SITE_PATH . 'stats/' . $book->book_id . '">' . $btStats . '</a></td>';\r
                        $res .= '<td class="bouton"><a href="' . SITE_PATH . 'supprimebook/' . $book->book_id . '">' . $btDownload . '</a></td>';\r
                        if ($droits->creation) {\r
@@ -534,6 +534,16 @@ html{height:100%}' . "\n";
                                $res .= '<tr class="odd"><td>' . __('Entité facturable') . '</td><td>' . $d->facturable->prenom . ' ' . $d->facturable->nom . ' (' . $d->facturable->rs . ')</td></tr>';\r
                                $res .= '<tr class="odd"><td>' . __('Administrateur responsable') . '</td><td>' . $d->administrateur->prenom . ' ' . $d->administrateur->nom . ' (' . $d->administrateur->rs . ')</td></tr>';\r
                        }\r
+\r
+                       $daoSignature = new wsDAOSignature($core->con);\r
+                       $signaturesList = $daoSignature->selectAll();\r
+\r
+                       $signatures = array();\r
+                       foreach($signaturesList as $s) {\r
+                               $signatures[$s->nom] = $s->signature_id;\r
+                       }\r
+\r
+                       $res .= '<tr class="odd"><td>' . __('Signatures Fluidbook') . '</td><td>' . cubeForm::checkMultiple('ws_signatures', $signatures, 5, explode(',', $client->ws_signatures)) . '</td></tr>';\r
                }\r
                if ($entreprise_id == 'new') {\r
                        $daoContact = new commonDAOClient($core->con);\r
index be19a1a61522b96fa59be0eafc48989a4a08cc2d..f8931c0181dd0d8678409ac980df8b651dd6f6e4 100644 (file)
@@ -43,14 +43,11 @@ class wsDAOTheme extends commonDAO {
 \r
        public function getAllThemes($user, $order = '')\r
        {\r
-               if ($user->ws_grade >= 3) {\r
+               if (wsDroits::admin(false)) {\r
                        $sql = 'SELECT * FROM themes_vue';\r
-               } else if ($user->ws_grade == 2) {\r
-                       $sql = 'SELECT * FROM themes_vue WHERE theme_id IN (SELECT theme_id FROM themes_droits WHERE utilisateur_id=\'' . $user->utilisateur_id . '\')';\r
                } else {\r
-                       return array();\r
+                       $sql = 'SELECT * FROM themes_vue WHERE theme_id IN (SELECT theme_id FROM books WHERE proprietaire IN(' . $user->ws_rights . ') OR proprietaire IN (' . $user->ws_rights . '))';\r
                }\r
-\r
                $r = $this->con->select($sql . ' ' . $order);\r
                return $this->factory($r);\r
        }\r
@@ -86,7 +83,7 @@ class wsDAOTheme extends commonDAO {
                return $r->theme_id + 1;\r
        }\r
 \r
-       public function delete($theme_id, $onlyFiles=false)\r
+       public function delete($theme_id, $onlyFiles = false)\r
        {\r
                if (is_null($theme_id) || $theme_id == '') {\r
                        return;\r