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
$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
\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
$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
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
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
$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
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
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
protected $ws_grade;\r
protected $ws_settings;\r
protected $ws_rights;\r
+ protected $ws_signatures;\r
\r
public function getEmail()\r
{\r
\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
$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
$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
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
}\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
$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
{\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
$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
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
$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
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
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
$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
\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
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