From: vincent@cubedesigners.com Date: Thu, 24 May 2018 12:20:20 +0000 (+0000) Subject: wait #2061 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=a0a7fbc674dfc3697fcf6f72cc1fdb7b675d5b13;p=cubeextranet.git wait #2061 @1.5 --- diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index bc8398aba..bd8563063 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -1,6 +1,7 @@ dbSync(); @@ -29,30 +31,30 @@ class commonCore extends cubeCore { cubeLang::set(); } - $this->grades = array(0 => __('Client'), 1 => __('Equipier'), 2 => __('Gérant'), 3 => __('Comptable')); + $this->grades = array(0 => __('Client'), "0.5" => __('Junior'), 1 => __('Equipier'), 2 => __('Gérant'), 3 => __('Comptable')); $this->categories = array(0 => __('Non défini'), 1 => __('Gestion de projet'), - 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'), 17 => __('Prise de vue photo/vidéo'), 18 => __('Hébergement')); + 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'), 17 => __('Prise de vue photo/vidéo'), 18 => __('Hébergement')); $this->projets_status = array(0 => __('En cours'), 1 => __('Terminé')); $this->devis_status = array(0 => __('Brouillon'), 1 => __('Envoyé'), - 2 => __('Validé'), 3 => __('Refusé')); + 2 => __('Validé'), 3 => __('Refusé')); $this->demandes_status = array(0 => __('Non traitée'), 1 => __('Confiée à un revendeur'), 2 => __('Traitée')); $this->factures_status = array(0 => __('Brouillon'), 1 => __('Attente'), - 2 => __('Payée'), 3 => __('Annulée'), 4 => __('Avoir'), 5 => __('Impayée')); + 2 => __('Payée'), 3 => __('Annulée'), 4 => __('Avoir'), 5 => __('Impayée')); $this->books_status = array(-1 => __('Brouillon'), 0 => __('Prêt'), 1 => __('Téléchargé'), 2 => __('Facturé')); $this->agences = array('Paris', 'Montpellier'); $this->client_type = array(0 => __('Non défini'), 1 => __('TPE'), 2 => __('Startup'), 3 => __('PME'), 4 => __('Agence'), 5 => __('Grande entreprise')); $this->demandes_type = array(0 => __('Non défini'), - 1 => __('Catalogue'), - 2 => __('Magazine / Presse'), - 3 => __('Rapport annuel'), - 4 => __('Plaquette de société'), - 5 => __('Brochure touristique'), - 6 => __("Manuel d'utilisation"), - 7 => __('Livre')); + 1 => __('Catalogue'), + 2 => __('Magazine / Presse'), + 3 => __('Rapport annuel'), + 4 => __('Plaquette de société'), + 5 => __('Brochure touristique'), + 6 => __("Manuel d'utilisation"), + 7 => __('Livre')); $this->ws_grades = array(0 => __("Pas d'accès"), 1 => __('Client'), 2 => __('Client (droits de création)'), 3 => __('Revendeur'), 4 => __('Revendeur (droits de création)'), 5 => __('Administrateur')); } @@ -66,7 +68,8 @@ class commonCore extends cubeCore { * * @return */ - protected function authentifie() { + protected function authentifie() + { // On regarde si user_email et user_password ont été postées // Si c'est le cas, on les copie dans la session $_SESSION['errorLogin'] = false; @@ -105,7 +108,8 @@ class commonCore extends cubeCore { * * @return */ - public function dbSync() { + public function dbSync() + { $cache = ROOT . '/cache/DB_SYNC'; $todo = ROOT . '/cache/DB_TODO'; if (!file_exists($cache)) { @@ -130,7 +134,7 @@ class commonCore extends cubeCore { $db->utilisateurs->prenom('varchar', 64, false); $db->utilisateurs->agence('varchar', 64, true); $db->utilisateurs->entreprise('integer', 0, false); - $db->utilisateurs->grade('integer', 1, false); + $db->utilisateurs->grade('float', 0, false); $db->utilisateurs->adresse('varchar', 512, false); $db->utilisateurs->code_postal('varchar', 20, false); $db->utilisateurs->ville('varchar', 64, false); @@ -528,15 +532,14 @@ class commonCore extends cubeCore { $db->google_search_api->date('integer', 0, false); $db->google_search_api->primary('pk_google_search_api', 'request'); - try { $dbi = new CubeDbStruct($this->con); $dbi->synchronize($db); } catch (Exception $e) { - return; + } - $this->views->createView('equipiers', 'SELECT * FROM utilisateurs WHERE grade>=1'); + $this->views->createView('equipiers', 'SELECT * FROM utilisateurs WHERE grade>0'); $this->views->createView('gerants', 'SELECT * FROM utilisateurs WHERE grade=2'); $this->views->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 ' @@ -682,24 +685,28 @@ class commonCore extends cubeCore { touch($cache); } - public function sauvePreferencesUtilisateur() { + public function sauvePreferencesUtilisateur() + { $dao = new commonDAOUtilisateur($this->con); $dao->sauvePreferences($this->user); } - public function refreshWSUsersTree() { + public function refreshWSUsersTree() + { $t = new wsUsersTree($this->con); $t->refreshWSUsersTree(); } - public function loadExtranetClasses() { + public function loadExtranetClasses() + { global $__autoload; require_once(dirname(__FILE__) . '/../extranet/Metier/_common.php'); require_once(dirname(__FILE__) . '/../extranet/Controlleur/_common.php'); require_once(dirname(__FILE__) . '/../extranet/DAO/_common.php'); } - public function loadWSClasses() { + public function loadWSClasses() + { global $__autoload; require_once(dirname(__FILE__) . '/../ws/Metier/_common.php'); require_once(dirname(__FILE__) . '/../ws/Controlleur/_common.php'); diff --git a/inc/commons/class.common.droits.php b/inc/commons/class.common.droits.php index 0a39fe6d0..a35970618 100644 --- a/inc/commons/class.common.droits.php +++ b/inc/commons/class.common.droits.php @@ -31,7 +31,7 @@ class commonDroits { public static function dashboard($error = true) { if (MODE == 'extranet') { - $grade = 1; + $grade = 0.5; } elseif (MODE == 'ws') { $grade = 5; } @@ -79,6 +79,4 @@ class commonDroits { exit; } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/inc/extranet/Controlleur/class.extranet.droits.php b/inc/extranet/Controlleur/class.extranet.droits.php index 9cbe23028..33d1fd7a7 100644 --- a/inc/extranet/Controlleur/class.extranet.droits.php +++ b/inc/extranet/Controlleur/class.extranet.droits.php @@ -1,5 +1,7 @@ createur_id, $devis->client_id, $action, $error, true); } @@ -53,9 +55,11 @@ class extranetDroits { $nav[__('Dashboard')] = 'dashboard'; $nav[__('Projets')] = 'projets'; $nav[__('Timereport')] = 'timereport'; - $nav[__('Devis')] = 'devis'; - $nav[__('Factures')] = 'factures'; - $nav[__('Clients')] = 'clients'; + if ($core->user->grade >= 1) { + $nav[__('Devis')] = 'devis'; + $nav[__('Factures')] = 'factures'; + $nav[__('Clients')] = 'clients'; + } if ($core->user->grade >= 2) { $nav[__('Chiffres')] = 'chiffres'; $nav[__('RH')] = 'rh'; @@ -67,6 +71,4 @@ class extranetDroits { } return $nav; } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/inc/extranet/Controlleur/class.extranet.url.php b/inc/extranet/Controlleur/class.extranet.url.php index 67fb79093..119582fa9 100644 --- a/inc/extranet/Controlleur/class.extranet.url.php +++ b/inc/extranet/Controlleur/class.extranet.url.php @@ -1,8 +1,10 @@ user->getSettings('clients') : $settings; @@ -95,7 +98,8 @@ class extranetUrl { return $res; } - public static function clientDetailCa($entreprise_id) { + public static function clientDetailCa($entreprise_id) + { global $core; $dao = new commonDAOEntreprise($core->con); $annees = $dao->getCaDetails($entreprise_id); @@ -109,7 +113,8 @@ class extranetUrl { return $res; } - public static function clientDetailImpaye($entreprise_id) { + public static function clientDetailImpaye($entreprise_id) + { global $core; $dao = new extranetDAOFacture($core->con); $daoClient = new commonDAOEntreprise($core->con); @@ -141,7 +146,8 @@ class extranetUrl { return $res; } - public static function formClient($entreprise_id = 'new') { + public static function formClient($entreprise_id = 'new') + { global $core; commonDroits::min(1); $dao = new commonDAOEntreprise($core->con); @@ -198,7 +204,8 @@ class extranetUrl { return $res; } - public static function listeContacts($entreprise_id) { + public static function listeContacts($entreprise_id) + { global $core; commonDroits::min(1); $dao = new commonDAOEntreprise($core->con); @@ -220,7 +227,8 @@ class extranetUrl { return $res; } - public static function formContact($client_id = 'new', $entreprise_id = null) { + public static function formContact($client_id = 'new', $entreprise_id = null) + { global $core; commonDroits::min(1); @@ -256,7 +264,8 @@ class extranetUrl { return $res; } - public static function formNotes($utilisateur_id) { + public static function formNotes($utilisateur_id) + { global $core; commonDroits::min(1); $dao = new commonDAOUtilisateur($core->con); @@ -267,14 +276,17 @@ class extranetUrl { return $res; } - public static function projets($args) { + public static function projets($args) + { global $core; - commonDroits::min(1); + commonDroits::min(0.5); $settings = $core->user->getSettings('projets'); $shortcuts = array(); - $shortcuts[] = '' . $core->typo->Ajouter('Créer un projet') . ''; + if ($core->user->grade >= 1) { + $shortcuts[] = '' . $core->typo->Ajouter('Créer un projet') . ''; + } $filtres = array(); $filtres[] = new commonFiltre(__('Crée par'), 'equipier', $settings['filtres']); @@ -292,9 +304,10 @@ class extranetUrl { return $res; } - public static function listeProjets($dashboard = null, $settings = null) { + public static function listeProjets($dashboard = null, $settings = null) + { global $core; - commonDroits::min(1); + commonDroits::min(0.5); $settings = is_null($settings) ? $core->user->getSettings('projets') : $settings; $change = is_null($dashboard) ? 'Projet' : 'Dashboard/' . $dashboard; @@ -305,9 +318,11 @@ class extranetUrl { $res .= '' . commonUrl::orderby(__('Année'), 'annee_fin', $settings, 'sort' . $change) . ''; $res .= '' . commonUrl::orderby(__('Chef'), 'chef', $settings, 'sort' . $change) . ''; $res .= '' . commonUrl::orderby(__('Status'), 'status', $settings, 'sort' . $change) . ''; - $res .= '' . commonUrl::orderby(__('Facturé'), 'rapport_facturation', $settings, 'sort' . $change) . ''; - $res .= '' . commonUrl::orderby(__('Payé'), 'rapport_paiement', $settings, 'sort' . $change) . ''; - $res .= '' . commonUrl::orderby('B', 'budget', $settings, 'sort' . $change) . ''; + if ($core->user->grade >= 1) { + $res .= '' . commonUrl::orderby(__('Facturé'), 'rapport_facturation', $settings, 'sort' . $change) . ''; + $res .= '' . commonUrl::orderby(__('Payé'), 'rapport_paiement', $settings, 'sort' . $change) . ''; + $res .= '' . commonUrl::orderby('B', 'budget', $settings, 'sort' . $change) . ''; + } $res .= '' . commonUrl::orderby('Pr', 'progression', $settings, 'sort' . $change) . ''; $res .= ''; @@ -366,16 +381,18 @@ class extranetUrl { $rapport_paiement = __('Trop'); } - $res .= ''; - if ($projet->status == 1 && !$rf) { - $res .= '' . $rapport_facturation . ''; - } else { - $res .= $rapport_facturation; - } - $res .= ''; - $res .= '' . $rapport_paiement . ''; + if ($core->user->grade >= 1) { + $res .= ''; + if ($projet->status == 1 && !$rf) { + $res .= '' . $rapport_facturation . ''; + } else { + $res .= $rapport_facturation; + } + $res .= ''; + $res .= '' . $rapport_paiement . ''; - $res .= '' . $projet->budget . ''; + $res .= '' . $projet->budget . ''; + } // $res .= '' . $projet->jours_prevus . ''; // $res .= '' . $projet->jours_consommes . ''; $res .= '' . $projet->progression . ''; @@ -395,13 +412,16 @@ class extranetUrl { return $res; } - public static function projet($args) { + public static function projet($args) + { global $core; - commonDroits::min(1); + commonDroits::min(0.5); $shortcuts = array(); - $shortcuts[] = '' . $core->typo->Ajouter('Créer une tâche') . ''; - $shortcuts[] = '' . $core->typo->Ajouter('Créer une tâche sous-traitée') . ''; + if ($core->user->grade >= 1) { + $shortcuts[] = '' . $core->typo->Ajouter('Créer une tâche') . ''; + $shortcuts[] = '' . $core->typo->Ajouter('Créer une tâche sous-traitée') . ''; + } $res = commonPage::barre(null, null, null, $shortcuts); $res .= commonPage::tMain(); @@ -414,9 +434,10 @@ class extranetUrl { return $res; } - public static function listeProjet($projet_id) { + public static function listeProjet($projet_id) + { global $core; - commonDroits::min(1); + commonDroits::min(0.5); $res = ''; $res .= ''; @@ -425,7 +446,9 @@ class extranetUrl { $res .= ''; $res .= ''; $res .= ''; - $res .= ''; + if ($core->user->grade >= 1) { + $res .= ''; + } $res .= ''; $res .= ''; $res .= ''; @@ -455,7 +478,9 @@ class extranetUrl { } else { $res .= ''; } - $res .= ''; + if ($core->user->grade >= 1) { + $res .= ''; + } $res .= ''; $res .= ''; $res .= ''; @@ -487,7 +512,10 @@ class extranetUrl { } else { $res .= ''; } - $res .= ''; + + if ($core->user->grade >= 1) { + $res .= ''; + } if ($tache instanceof extranetTacheNormale) { $progression = !$tache->progression ? '-' : $tache->progression . '%'; @@ -510,7 +538,11 @@ class extranetUrl { } } - $res .= ''; + $res .= ''; $res .= ''; $i++; @@ -519,7 +551,8 @@ class extranetUrl { return $res; } - public static function formProjet($projet_id = 'new') { + public static function formProjet($projet_id = 'new') + { global $core; commonDroits::min(1); @@ -575,7 +608,8 @@ class extranetUrl { return $res; } - public static function formTache($tache) { + public static function formTache($tache) + { global $core; commonDroits::min(1); @@ -586,7 +620,8 @@ class extranetUrl { return $res; } - public static function formTacheNormale($tache_id, $projet_id = null) { + public static function formTacheNormale($tache_id, $projet_id = null) + { global $core; commonDroits::min(1); $dao = new extranetDAOTache($core->con); @@ -602,7 +637,8 @@ class extranetUrl { return $res; } - public static function formTacheSousTraitee($tache_id, $projet_id = null) { + public static function formTacheSousTraitee($tache_id, $projet_id = null) + { global $core; commonDroits::min(1); $dao = new extranetDAOTache($core->con); @@ -617,9 +653,10 @@ class extranetUrl { return $res; } - public static function timereport($args) { + public static function timereport($args) + { global $core; - commonDroits::min(1); + commonDroits::min(0.5); $settings = $core->user->getSettings('timereport'); $res = ''; if (!isset($_GET['light'])) { @@ -639,9 +676,10 @@ class extranetUrl { return $res; } - public static function listeTimereport($dashboard = null, $settings = null) { + public static function listeTimereport($dashboard = null, $settings = null) + { global $core; - commonDroits::min(1); + commonDroits::min(0.5); // Récupère la liste des projets $settings = is_null($settings) ? $core->user->getSettings('timereport') : $settings; $change = is_null($dashboard) ? 'Timereport' : 'Dashboard/' . $dashboard; @@ -734,7 +772,8 @@ class extranetUrl { return $res; } - public static function getClassOfDay($date) { + public static function getClassOfDay($date) + { $aujourdhui = cubeDate::round(null, 'd'); $highlight = ($date == $aujourdhui); $we = (date('N', $date) >= 6); @@ -747,7 +786,8 @@ class extranetUrl { return ''; } - public static function devis($args) { + public static function devis($args) + { global $core; cubePage::truePopup(); cubePage::contextMenu(); @@ -777,7 +817,8 @@ class extranetUrl { return $res; } - public static function devis_client($args) { + public static function devis_client($args) + { global $core; $res = commonPage::barre(); @@ -791,7 +832,8 @@ class extranetUrl { return $res; } - public static function listeDevis($dashboard = null, $settings = null) { + public static function listeDevis($dashboard = null, $settings = null) + { global $core; if ($core->user->grade == 0) { @@ -801,7 +843,8 @@ class extranetUrl { } } - public static function contextDevis($id) { + public static function contextDevis($id) + { global $core; $res = '
'; $res .= '
#' . __('Année') . '' . __('Chef de projet') . '' . __('Status') . 'BBPlCoPr' . $core->projets_status[$projet->status] . '' . $projet->budget . '' . $projet->budget . '' . $projet->jours_prevus . '' . $projet->jours_consommes . '' . $projet->progression . '' . $tache->budget . '' . $tache->budget . '' . cubeMedia::image(IMG . '/delete.png') . ''; + if ($core->user->grade >= 1) { + $res .= '' . cubeMedia::image(IMG . '/delete.png') . ''; + } + $res .= '
'; $res .= ''; diff --git a/inc/extranet/Controlleur/url/class.extranet.url.timereport.php b/inc/extranet/Controlleur/url/class.extranet.url.timereport.php index 946dad684..90c046f21 100644 --- a/inc/extranet/Controlleur/url/class.extranet.url.timereport.php +++ b/inc/extranet/Controlleur/url/class.extranet.url.timereport.php @@ -4,7 +4,7 @@ class extranetUrlTimereport { public static function timereport($args) { global $core; - commonDroits::min(1); + commonDroits::min(0.5); $settings = $core->user->getSettings('timereport'); $filtres = array(); $filtres[] = new commonFiltre(__('Participants'), 'equipier_participe', $settings['filtres']); @@ -22,7 +22,7 @@ class extranetUrlTimereport { public static function listeTimereport($dashboard = null, $settings = null) { global $core; - commonDroits::min(1); + commonDroits::min(0.5); // Récupère la liste des projets $settings = is_null($settings)?$core->user->getSettings('timereport'):$settings; $change = is_null($dashboard)?'Timereport':'Dashboard/' . $dashboard;
#