]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 10 Feb 2011 15:48:36 +0000 (15:48 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 10 Feb 2011 15:48:36 +0000 (15:48 +0000)
inc/commons/DAO/class.common.dao.entreprise.php
inc/commons/class.common.core.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/Controlleur/class.ws.users.tree.php

index e103155b955a475221cf6891ef4de92ec9ec65ca..ccbb8107b73226a4b0de4598e328420fa4f5aaa4 100644 (file)
@@ -11,8 +11,12 @@ class commonDAOEntreprise extends commonDAO {
                $entreprise->pays = $r->pays;\r
                $entreprise->tva_intra = $r->tva_intra;\r
                $entreprise->notes = $r->notes;\r
-               $entreprise->impaye = $r->impaye;\r
-               $entreprise->ca = $r->ca;\r
+               if (isset($r->impaye)) {\r
+                       $entreprise->impaye = $r->impaye;\r
+               }\r
+               if (isset($r->ca)) {\r
+                       $entreprise->ca = $r->ca;\r
+               }\r
                $entreprise->adresse_facturation = $r->adresse_facturation;\r
                $entreprise->ws_admin = $r->ws_admin;\r
                $entreprise->ws_grade = $r->ws_grade;\r
@@ -60,7 +64,7 @@ class commonDAOEntreprise extends commonDAO {
                return $res;\r
        }\r
 \r
-       public function getListe($orderby = null, $sens = null, $limit = null, $limitedToUserRights = false)\r
+       public function getListe($orderby = null, $sens = null, $limit = null, $limitedToUserRights = false, $table = 'entreprises_vue')\r
        {\r
                $where = '(';\r
                if (!is_null($this->q)) {\r
@@ -81,7 +85,7 @@ class commonDAOEntreprise extends commonDAO {
                $sens = is_null($sens)?'DESC':$sens;\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
+               $sql = 'SELECT * FROM ' . $table . ' WHERE ' . $where . ' ORDER BY ' . $orderby . ' ' . $sens . ' ' . $limit;\r
 \r
                $r = $this->con->select($sql);\r
                $ids = array();\r
index f9a5783407da052e5e948cfe8f7463d62de43c3f..31af511be89afd826ea56ebb44f1dd0a37be6996 100644 (file)
@@ -389,6 +389,12 @@ class commonCore extends cubeCore {
                $db->ws_users_tree->administrateur_id('integer', 0, false);\r
                // Clé\r
                $db->ws_users_tree->primary('pk_utilisateur_id', 'utilisateur_id');\r
+               // Table des entreprises\r
+               $db->ws_entreprises_tree->entreprise_id('integer', 0, false);\r
+               $db->ws_entreprises_tree->facturable_entreprise_id('integer', 0, false);\r
+               $db->ws_entreprises_tree->administrateur_id('integer', 0, false);\r
+               // Clés\r
+               $db->ws_entreprises_tree->primary('pk_entreprise_id', 'entreprise_id');\r
                // Table des demandes de devis\r
                $db->demandes->demande_id('integer', 0, false);\r
                $db->demandes->type('integer', 0, false);\r
@@ -430,7 +436,7 @@ class commonCore extends cubeCore {
                         . 'LEFT JOIN ws_users_tree ri ON ri.entreprise_id=e.entreprise_id '\r
                         . 'LEFT JOIN entreprises r ON ri.facturable_entreprise_id=r.entreprise_id '\r
                         . 'LEFT JOIN utilisateurs a ON ri.administrateur_id=a.utilisateur_id '\r
-                        . '');\r
+                        . 'GROUP BY e.entreprise_id');\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
@@ -439,7 +445,7 @@ class commonCore extends cubeCore {
                $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
                         . '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) '\r
-                        . 'GROUP BY u.utilisateur_id','TEMPTABLE');\r
+                        . 'GROUP BY u.utilisateur_id', 'TEMPTABLE');\r
                $this->views->createView('taches_vue', 'SELECT taches.tache_id,taches.nom,taches.categorie,taches.type,taches.budget,taches.projet,taches.taux_journalier, '\r
                         . '(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 '\r
                         . 'FROM taches LEFT JOIN timereport ON taches.tache_id=timereport.tache_id '\r
index cd1c52d4cb031b277f2280d37bdddd93388fa42e..2ada646c82b748aad220e7fd08e9bc37b1bba18f 100644 (file)
@@ -705,7 +705,7 @@ html{height:100%}' . "\n";
                $i = 0;\r
                foreach($liste as $id => $client) {\r
                        if (!is_array($client->contacts)) {\r
-                               continue;\r
+                               $client->contacts=array();\r
                        }\r
                        $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
                        $res .= '<tr' . $odd . '>';\r
index 453ba7f543e14fe0c6ffc68998b95a1696527c5e..925cc7995373a092d9930e3212bc39f06fdf007e 100644 (file)
@@ -19,6 +19,7 @@ class wsUsersTree {
        public function refreshWSUsersTree()\r
        {\r
                $this->con->execute('TRUNCATE TABLE ws_users_tree');\r
+               $this->con->execute('TRUNCATE TABLE ws_entreprises_tree');\r
 \r
                $this->users = array();\r
                $this->admins = array();\r
@@ -44,16 +45,20 @@ class wsUsersTree {
                $this->facturables = $this->getFacturables();\r
                // Fabrication de l'arbre\r
                $c = $this->con->openCursor('ws_users_tree');\r
+               $ce=$this->con->openCursor('ws_entreprises_tree');\r
 \r
                foreach($this->users as $utilisateur_id => $admin) {\r
                        $facturable_id = $administrateur_id = 0;\r
                        $this->getFacturableOf($utilisateur_id, $facturable_id, $administrateur_id, 1);\r
                        $c->utilisateur_id = $utilisateur_id;\r
-                       $c->entreprise_id = $this->entreprises[$utilisateur_id];\r
+                       $ce->entreprise_id=$c->entreprise_id = $this->entreprises[$utilisateur_id];\r
                        $c->facturable_id = $facturable_id;\r
-                       $c->facturable_entreprise_id = $this->entreprises[$facturable_id] ;\r
-                       $c->administrateur_id = $administrateur_id;\r
+                       $ce->facturable_entreprise_id=$c->facturable_entreprise_id = $this->entreprises[$facturable_id] ;\r
+                       $ce->administrateur_id=$c->administrateur_id = $administrateur_id;\r
                        $c->insert();\r
+                       $ce->insert();\r
+\r
+\r
                }\r
                // Fabrication de la liste des droits à partir de l'arbre\r
                for($i = 1;$i <= 4;$i++) {\r