From 592c252c04e067c8d8e0a1c6979e9bdb24d0930b Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 14 Sep 2010 12:37:48 +0000 Subject: [PATCH] --- .../Controlleur/class.extranet.core.php | 35 +++++++------------ inc/ws/Controlleur/class.ws.url.php | 7 ++-- inc/ws/DAO/class.ws.dao.book.php | 11 +++--- inc/ws/Metier/class.ws.book.php | 4 +-- 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/inc/extranet/Controlleur/class.extranet.core.php b/inc/extranet/Controlleur/class.extranet.core.php index 9b2a8d8e9..af5c2bb77 100644 --- a/inc/extranet/Controlleur/class.extranet.core.php +++ b/inc/extranet/Controlleur/class.extranet.core.php @@ -26,7 +26,7 @@ class extranetCore extends cubeCore { 2 => __('Design Web'), 3 => __('Design Industriel'), 4 => __('Print'), 5 => __('Newsletter'), 6 => __('Développement PHP'), 7 => __('Développement Flash'), 8 => __('Fluidbook'), 9 => __('Formation'), 10 => __('Administratif'), 11 => __('Divers'), - 12 => __('Intégration HTML'), 13 => __('Motion design'), 14 => __('Design graphique'), 15 => __('Bandeaux de pub'),16=>__('Applications mobiles')); + 12 => __('Intégration HTML'), 13 => __('Motion design'), 14 => __('Design graphique'), 15 => __('Bandeaux de pub'), 16 => __('Applications mobiles')); $this->projets_status = array(0 => __('En cours'), 1 => __('Terminé')); $this->devis_status = array(0 => __('Brouillon'), 1 => __('Envoyé'), 2 => __('Validé'), 3 => __('Refusé')); @@ -146,7 +146,7 @@ class extranetCore extends cubeCore { $db->entreprises->code_postal('varchar', 20, false); $db->entreprises->ville('varchar', 64, false); $db->entreprises->pays('varchar', 2, false); - $db->entreprises->adresse_facturation('varchar',512,false); + $db->entreprises->adresse_facturation('varchar', 512, false); $db->entreprises->tva_intra('varchar', 14, false); $db->entreprises->date_creation('integer', 0, false); $db->entreprises->notes('text', 0, false); @@ -286,12 +286,12 @@ class extranetCore extends cubeCore { $db->themes->reference('fk_themes_signature', 'signature', 'signatures', 'signature_id'); $db->themes->reference('fk_themes_proprietaires', 'proprietaire', 'utilisateurs', 'utilisateur_id'); // Table des droits des themes - //$db->themes_droits->theme_id('integer', 0, false); - //$db->themes_droits->utilisateur_id('integer', 0, false); + // $db->themes_droits->theme_id('integer', 0, false); + // $db->themes_droits->utilisateur_id('integer', 0, false); // Clés - // $db->themes_droits->primary('pk_themes_droits', 'theme_id', 'utilisateur_id'); - //$db->themes_droits->reference('fk_themes_droits_theme_id', 'theme_id', 'themes', 'theme_id'); - //$db->themes_droits->reference('fk_themes_droits_utilisateur_id', 'utilisateur_id', 'utilisateurs', 'utilisateur_id'); + // $db->themes_droits->primary('pk_themes_droits', 'theme_id', 'utilisateur_id'); + // $db->themes_droits->reference('fk_themes_droits_theme_id', 'theme_id', 'themes', 'theme_id'); + // $db->themes_droits->reference('fk_themes_droits_utilisateur_id', 'utilisateur_id', 'utilisateurs', 'utilisateur_id'); // Table des langues $db->langues->lang_id('varchar', 20, false); $db->langues->nom('varchar', 256, false); @@ -346,7 +346,7 @@ class extranetCore extends cubeCore { $db->books->extras('text', 0, false); $db->books->traductions('text', 0, false); $db->books->date('integer', 0, false); - $db->books->numerotation('text',0,false); + $db->books->numerotation('text', 0, false); // Clés $db->books->primary('pk_books', 'book_id'); $db->books->index('index_books_nom', 'BTREE', 'nom'); @@ -375,17 +375,9 @@ class extranetCore extends cubeCore { $this->createView('equipiers', 'SELECT * FROM utilisateurs WHERE grade>=1'); $this->createView('gerants', 'SELECT * FROM utilisateurs WHERE grade=2'); - $this->createView('ws_top_revendeurs', 'SELECT * FROM utilisateurs WHERE ws_grade=3 AND ws_admin IN(SELECT utilisateur_id FROM equipiers)'); + // $this->createView('ws_top_revendeurs', 'SELECT * FROM utilisateurs WHERE ws_grade=3 AND ws_admin IN(SELECT utilisateur_id FROM equipiers)'); $this->createView('ws_revendeurs', 'SELECT * FROM utilisateurs WHERE ws_grade=3'); $this->createView('ws_facturables', 'SELECT * FROM utilisateurs WHERE ws_grade BETWEEN 0 AND 3 AND ws_admin IN(SELECT utilisateur_id FROM equipiers)'); - $this->createView('ws_utilisateurs', 'SELECT *,utilisateur_id AS facturable_id FROM ws_facturables' - . ' UNION ' - . 'SELECT u.*,f.utilisateur_id AS facturable_id FROM utilisateurs u, ws_facturables f WHERE u.ws_admin=f.utilisateur_id AND u.ws_grade!=-1 ' - . ' UNION ' - . 'SELECT u.*,f.utilisateur_id AS facturable_id FROM utilisateurs u,ws_facturables f,ws_revendeurs r ' - . 'WHERE u.ws_admin=r.utilisateur_id AND r.ws_admin=f.utilisateur_id ' - . ' UNION ' - . ' SELECT *,utilisateur_id AS facturable_id FROM utilisateurs WHERE ws_grade=4'); $this->createView('impayes_entreprises', 'SELECT SUM(total_ht) AS impaye, u.entreprise AS entreprise ' . 'FROM utilisateurs u LEFT JOIN projets p ON u.utilisateur_id=p.client LEFT JOIN factures f ON f.projet=p.projet_id ' . 'WHERE f.status=1 GROUP BY u.entreprise'); @@ -397,13 +389,12 @@ class extranetCore extends cubeCore { . 'GROUP BY e.entreprise_id'); $this->createView('entreprises_vue', 'SELECT e.*,i.impaye AS impaye' . ' FROM entreprises_inter e LEFT JOIN impayes_entreprises i ON e.entreprise_id=i.entreprise'); + $this->createView('clients_entreprise', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation ' + . 'FROM entreprises e LEFT JOIN utilisateurs u ON u.entreprise=e.entreprise_id AND u.grade=0'); $this->createView('clients', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation, i.impaye, ' . 'SUM(f.total_ht) AS ca ' . 'FROM entreprises e LEFT JOIN impayes_entreprises i ON e.entreprise_id=i.entreprise LEFT JOIN utilisateurs u ON u.entreprise=e.entreprise_id AND u.grade=0 LEFT JOIN projets p ON p.client=u.utilisateur_id LEFT JOIN factures f ON f.projet=p.projet_id AND f.status IN(1,2) ' . 'GROUP BY u.utilisateur_id'); - $this->createView('ws_clients', 'SELECT u.*,e.nom AS rs, e1.nom as facturable ' - . 'FROM ws_utilisateurs u, entreprises e, entreprises e1,ws_utilisateurs u1 ' - . 'WHERE u.entreprise=e.entreprise_id AND u1.entreprise=e1.entreprise_id AND u.facturable_id=u1.utilisateur_id'); $this->createView('taches_vue', 'SELECT taches.tache_id,taches.nom,taches.categorie,taches.type,taches.budget,taches.projet,taches.taux_journalier, ' . '(SUM(timereport.heures)/' . JOURNEE . ') AS jours_consommes, ((SUM(timereport.heures)/' . JOURNEE . ')/(taches.budget/taches.taux_journalier))*100 AS progression,(taches.budget/taches.taux_journalier) AS jours_prevus ' . 'FROM taches LEFT JOIN timereport ON taches.tache_id=timereport.tache_id ' @@ -457,8 +448,8 @@ class extranetCore extends cubeCore { . 'FROM projets_vue p, taches_vue t ' . 'WHERE t.projet=p.projet_id ' . 'GROUP BY t.categorie,p.annee_fin'); - $this->createView('books_vue', 'SELECT b.*,b.proprietaire AS proprietaire_id,c.rs AS proprietaire_nom,c.ws_admin,c.facturable_id,c.facturable ' - . 'FROM books b, ws_clients c WHERE b.proprietaire=c.utilisateur_id'); + $this->createView('books_vue', 'SELECT b.*,b.proprietaire AS proprietaire_id,c.rs AS proprietaire_nom,c.ws_admin ' + . 'FROM books b, clients_entreprise c WHERE b.proprietaire=c.utilisateur_id'); $this->createView('themes_vue', 'SELECT t.*,COUNT(b.book_id) AS nb_books,GROUP_CONCAT(DISTINCT b.book_id ORDER BY b.book_id ASC) AS books ' . 'FROM themes t ' . 'LEFT JOIN books b ON t.theme_id=b.theme ' diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index f436f159b..d6e88e228 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -56,8 +56,8 @@ class wsUrl { $res .= '' . $book->nom . ''; $res .= '' . mb_strtoupper($book->lang) . ''; $res .= '' . $book->proprietaire . ''; - $f = $book->facturable; - $res .= '' . $f . ''; + // $f = $book->facturable; + $res .= '' ./* $f .*/ ''; $res .= '' . $core->books_status[$book->status] . ''; $res .= '' . cubeMedia::cssRollover($core->typo->Voir('voir', '', false)) . ''; $res .= '' . cubeMedia::cssRollover($core->typo->Editer('éditer', '', false)) . ''; @@ -128,7 +128,7 @@ html{height:100%}' . "\n"; $dao = new wsDAOBook($core->con); header('Content-type: text/plain'); ob_clean(); - echo $dao->compile(2963, 3,false); + echo $dao->compile(2963, 3, false); exit; } @@ -142,7 +142,6 @@ html{height:100%}' . "\n"; $book = new wsBookParametres(new wsBook()); $res .= self::formatHelp($book->getHelp()); - header('Content-type: text/plain; charset=UTF-8'); ob_clean(); echo $res; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index b98f39a39..125c21428 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -9,8 +9,8 @@ class wsDAOBook extends extranetDAO { $book->theme = $r->theme; $book->proprietaire = $r->proprietaire_nom; $book->proprietaire_id = $r->proprietaire_id; - $book->facturable = $r->facturable; - $book->facturable_id = $r->facturable_id; + //$book->facturable = $r->facturable; + //$book->facturable_id = $r->facturable_id; $book->hash = $r->hash; $book->compteur_visites = $r->compteur_visites; $book->status = $r->status; @@ -37,8 +37,8 @@ class wsDAOBook extends extranetDAO { $book->theme = 1; $book->proprietaire = ''; $book->proprietaire_id = 0; - $book->facturable = ''; - $book->facturable_id = 0; + //$book->facturable = ''; + //$book->facturable_id = 0; $book->hash = ''; $book->compteur_visites = 20; $book->status = 0; @@ -121,6 +121,7 @@ class wsDAOBook extends extranetDAO { $c->theme = $r->theme; $book_id = $c->book_id = $this->getNextId(); $c->insert(); + return $this->selectById($book_id); } @@ -149,7 +150,7 @@ class wsDAOBook extends extranetDAO { public function count() { - $r = $this->con->select('SELECT COUNT(*) AS nb FROM books_vue WHERE ' . $this->makeWhereFromFiltres()); + $r = $this->con->select('SELECT COUNT(*) AS nb FROM books WHERE ' . $this->makeWhereFromFiltres()); return $r->nb; } diff --git a/inc/ws/Metier/class.ws.book.php b/inc/ws/Metier/class.ws.book.php index bb8f03a5a..851f341df 100644 --- a/inc/ws/Metier/class.ws.book.php +++ b/inc/ws/Metier/class.ws.book.php @@ -10,8 +10,8 @@ class wsBook extends cubeMetier { protected $proprietaire; protected $proprietaire_id; - protected $facturable; - protected $facturable_id; + //protected $facturable; + //protected $facturable_id; protected $hash; protected $compteur_visites; -- 2.39.5