]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 17 Jan 2011 14:34:36 +0000 (14:34 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 17 Jan 2011 14:34:36 +0000 (14:34 +0000)
inc/commons/class.common.ajax.php
inc/extranet/Controlleur/class.extranet.url.php
inc/extranet/DAO/class.extranet.dao.projet.php
inc/ws/Controlleur/class.ws.url.php

index 3ae84b6206028ad35689800f08862474c6add18a..61aa6f153e1a1bf6b0e48475a9f15d905ff6bfae 100644 (file)
@@ -149,6 +149,18 @@ class commonAjax {
                        $x->addAlert(__('Votre mot de passe a été modifié'));\r
                }\r
        }\r
+\r
+       public static function connectAs($args, &$x)\r
+       {\r
+               global $core;\r
+               $dao = new commonDAOUtilisateur($core->con);\r
+               $utilisateur = $dao->selectById($args[1]);\r
+\r
+               $_SESSION['user_email'] = $utilisateur->email;\r
+               $_SESSION['user_password'] = $utilisateur->password;\r
+\r
+               $x->addRedirection(SITE_PATH);\r
+       }\r
 }\r
 \r
 ?>
\ No newline at end of file
index 9cf503f84d8ca06f815ce8ba878c98bcf9d7474c..e800790520ba2e3b41c5e82bb65944459d19c53b 100644 (file)
@@ -208,13 +208,14 @@ class extranetUrl {
                $contacts = $dao->getContacts($entreprise_id);\r
 \r
                $res = '<table class="liste light">';\r
-               $res .= '<tr class="light"><th colspan="4"><a href="" class="popup" rel="formContact/new/' . $entreprise_id . '">' . $core->typo->Contact('Ajouter un contact') . '</a></th></tr>';\r
+               $res .= '<tr class="light"><th colspan="5"><a href="" class="popup" rel="formContact/new/' . $entreprise_id . '">' . $core->typo->Contact('Ajouter un contact') . '</a></th></tr>';\r
                $i = 0;\r
                foreach($contacts as $contact) {\r
                        $odd = cubeMath::isOdd($i)?' class="odd"':'';\r
                        $res .= '<tr' . $odd . '><td>' . trim($contact->prenom . ' ' . $contact->nom) . '</td>';\r
                        $res .= '<td><a href="mailto:' . trim($contact->prenom . ' ' . $contact->nom) . '<' . $contact->email . '>">' . $contact->email . '</a></td>';\r
                        $res .= '<td class="min"><a href="' . SITE_PATH . 'fichiers/' . $contact->utilisateur_id . '">FTP</a></td>';\r
+                       $res .= '<td class="min"><a class="ajax" href="#" rel="' . SITE_PATH . 'connectAS/' . $contact->utilisateur_id . '">Se connecter comme ...</a></td>';\r
                        $res .= '<td class="right"><a href="#" rel="formContact/' . $contact->utilisateur_id . '" class="popup">' . cubeMedia::image(IMG . '/edit.png') . '</a></td></tr>';\r
                        $i++;\r
                }\r
@@ -250,6 +251,7 @@ class extranetUrl {
                if ($client_id != 'new') {\r
                        $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';\r
                        $res .= '<tr><td></td><td><a href="' . SITE_PATH . 'fichiers/' . $client->utilisateur_id . '">' . __('FTP') . '</a></td></tr>';\r
+                       $res .= '<tr><td></td><td><a class="ajax" href="#" rel="' . SITE_PATH . 'connectAs/' . $client->utilisateur_id . '">' . __('Se connecter comme ...') . '</a></td></tr>';\r
                        $res .= '<tr><td>' . __("Paramètres de connexion à l'extranet") . '</td><td>' . __('Adresse') . ' : http://extranet.cubedesigners.com/<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';\r
                        $res .= '<tr><td colspan="2">' . cubeMedia::spacer(10, 10) . '</td></tr>';\r
                        // $res .= '<tr><td>' . __("Paramètres de connexion au FTP") . '</td><td>' . __('Serveur FTP') . ' : extranet.cubedesigners.com (ftp://extranet.cubedesigners.com)<br />' . __("Nom d'utilisateur") . ' : ' . $client->email . '<br />' . __('Mot de passe') . ' : ' . $client->password . '</td></tr>';\r
@@ -440,6 +442,8 @@ class extranetUrl {
                $dao = new extranetDAOProjet($core->con);\r
                $projet = $dao->selectById($projet_id);\r
 \r
+               $hasFacture = $dao->projectHasFacture($projet_id);\r
+\r
                $droits = extranetDroits::projet($projet, false);\r
 \r
                $projet->progression = !$projet->progression?'-':$projet->progression . '%';\r
@@ -465,7 +469,7 @@ class extranetUrl {
                $res .= '<td>' . $projet->progression . '</td>';\r
                if ($droits) {\r
                        $res .= '<td class="action"><a href="#" class="popup" rel="formProjet/' . $projet->projet_id . '">' . cubeMedia::image(IMG . '/edit.png') . '</a></td>';\r
-                       if (!count($projet->taches)) {\r
+                       if (!count($projet->taches) && !$hasFacture) {\r
                                $res .= '<td class="action"><a href="#" class="ajax" rel="supprimeProjet/' . $projet->projet_id . '" title="' . __('Êtes vous certain de vouloir supprimer ce projet ?') . '">' . cubeMedia::image(IMG . '/delete.png') . '</a></td>';\r
                        } else {\r
                                $res .= '<td></td>';\r
@@ -1852,7 +1856,7 @@ class extranetUrl {
                                        $body = 'Tous les fichiers de ' . $core->user->prenom . ' ' . $core->user->nom . ' : http://extranet.cubedesigners.com/fichiers/' . $core->user->utilisateur_id . "\n\n";\r
                                        $body .= 'Fichiers chargés : ' . "\n";\r
                                        foreach($_SESSION['files_uploaded'] as $f) {\r
-                                               $body .= ' - http://extranet.cubedesigners.com/telecharger/' . $f . "\n";\r
+                                               $body .= ' - http://' . $_SERVER['HTTP_HOST'] . '/telecharger/' . $f . "\n";\r
                                        }\r
                                } else {\r
                                        $dao = new commonDAOClient($core->con);\r
@@ -1867,7 +1871,7 @@ class extranetUrl {
                                                $body .= ' - http://extranet.cubedesigners.com/telecharger/' . $f . "\n";\r
                                        }\r
                                        $body .= "\n" . 'Rappel des identifiants de connexion à l\'extranet Cubedesigners : ' . "\n";\r
-                                       $body .= ' - Adresse : http://extranet.cubedesigners.com/' . "\n";\r
+                                       $body .= ' - Adresse : http://' . $_SERVER['HTTP_HOST'] . '/' . "\n";\r
                                        $body .= ' - Login : ' . $client->email . "\n";\r
                                        $body .= ' - Mot de passe : ' . $client->password . "\n";\r
                                }\r
index e6097433d886e550bb389e54a073c9b1ee9b5ec5..6328fd54dd656dcafd0257509d720b9139c18f76 100644 (file)
@@ -159,6 +159,12 @@ class extranetDAOProjet extends commonDAO {
                return $this->factory($r);\r
        }\r
 \r
+       public function hasFacture($projet_id)\r
+       {\r
+               $r = $this->con->select('SELECT * FROM factures WHERE projet=\'' . $core->con->escape($projet_id) . '\'');\r
+               return $r->count() > 0;\r
+       }\r
+\r
        public function getProjetsForTimereport($orderby, $sens, $limit, $utilisateur_id)\r
        {\r
                if (!is_null($this->q)) {\r
index d957549cb001450778463d7953ef8dd00c3e10f0..fac416cf489d741ca2a13efb31c78c621ac3668e 100644 (file)
@@ -431,6 +431,7 @@ html{height:100%}' . "\n";
                        $res .= '<td class="nowrap">';\r
                        $res .= '</td>';\r
                        $res .= '<td class="action"><a href="#" class="popup" rel="formClient/' . $client->entreprise_id . '">' . cubeMedia::image(IMG . '/edit.png') . '</a></td>';\r
+                       $res .= '<td class="action"><a href="#" class="popup" rel="formClient/' . $client->entreprise_id . '">' . cubeMedia::image(IMG . '/edit.png') . '</a></td>';\r
                        $res .= '</tr>';\r
                        $i++;\r
                }\r