<?php\r
\r
-class commonCore extends cubeCore {\r
+class commonCore extends cubeCore\r
+{\r
\r
public $grades;\r
public $user;\r
public $ws_grades;\r
public $demandes_type;\r
\r
- public function __construct() {\r
+ public function __construct()\r
+ {\r
parent::__construct();\r
$this->dbSync();\r
\r
cubeLang::set();\r
}\r
\r
- $this->grades = array(0 => __('Client'), 1 => __('Equipier'), 2 => __('Gérant'), 3 => __('Comptable'));\r
+ $this->grades = array(0 => __('Client'), "0.5" => __('Junior'), 1 => __('Equipier'), 2 => __('Gérant'), 3 => __('Comptable'));\r
$this->categories = array(0 => __('Non défini'), 1 => __('Gestion de projet'),\r
- 2 => __('Design Web'), 3 => __('Design Industriel'), 4 => __('Print'),\r
- 5 => __('Newsletter'), 6 => __('Développement PHP'), 7 => __('Développement Flash'),\r
- 8 => __('Fluidbook'), 9 => __('Formation'), 10 => __('Administratif'), 11 => __('Divers'),\r
- 12 => __('Intégration HTML'), 13 => __('Motion design'), 14 => __('Design graphique'),\r
- 15 => __('Bandeaux de pub'), 16 => __('Applications mobiles'), 17 => __('Prise de vue photo/vidéo'), 18 => __('Hébergement'));\r
+ 2 => __('Design Web'), 3 => __('Design Industriel'), 4 => __('Print'),\r
+ 5 => __('Newsletter'), 6 => __('Développement PHP'), 7 => __('Développement Flash'),\r
+ 8 => __('Fluidbook'), 9 => __('Formation'), 10 => __('Administratif'), 11 => __('Divers'),\r
+ 12 => __('Intégration HTML'), 13 => __('Motion design'), 14 => __('Design graphique'),\r
+ 15 => __('Bandeaux de pub'), 16 => __('Applications mobiles'), 17 => __('Prise de vue photo/vidéo'), 18 => __('Hébergement'));\r
$this->projets_status = array(0 => __('En cours'), 1 => __('Terminé'));\r
$this->devis_status = array(0 => __('Brouillon'), 1 => __('Envoyé'),\r
- 2 => __('Validé'), 3 => __('Refusé'));\r
+ 2 => __('Validé'), 3 => __('Refusé'));\r
$this->demandes_status = array(0 => __('Non traitée'), 1 => __('Confiée à un revendeur'), 2 => __('Traitée'));\r
$this->factures_status = array(0 => __('Brouillon'), 1 => __('Attente'),\r
- 2 => __('Payée'), 3 => __('Annulée'), 4 => __('Avoir'), 5 => __('Impayée'));\r
+ 2 => __('Payée'), 3 => __('Annulée'), 4 => __('Avoir'), 5 => __('Impayée'));\r
$this->books_status = array(-1 => __('Brouillon'), 0 => __('Prêt'), 1 => __('Téléchargé'), 2 => __('Facturé'));\r
$this->agences = array('Paris', 'Montpellier');\r
$this->client_type = array(0 => __('Non défini'), 1 => __('TPE'), 2 => __('Startup'), 3 => __('PME'), 4 => __('Agence'), 5 => __('Grande entreprise'));\r
$this->demandes_type = array(0 => __('Non défini'),\r
- 1 => __('Catalogue'),\r
- 2 => __('Magazine / Presse'),\r
- 3 => __('Rapport annuel'),\r
- 4 => __('Plaquette de société'),\r
- 5 => __('Brochure touristique'),\r
- 6 => __("Manuel d'utilisation"),\r
- 7 => __('Livre'));\r
+ 1 => __('Catalogue'),\r
+ 2 => __('Magazine / Presse'),\r
+ 3 => __('Rapport annuel'),\r
+ 4 => __('Plaquette de société'),\r
+ 5 => __('Brochure touristique'),\r
+ 6 => __("Manuel d'utilisation"),\r
+ 7 => __('Livre'));\r
$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'));\r
}\r
\r
*\r
* @return\r
*/\r
- protected function authentifie() {\r
+ protected function authentifie()\r
+ {\r
// On regarde si user_email et user_password ont été postées\r
// Si c'est le cas, on les copie dans la session\r
$_SESSION['errorLogin'] = false;\r
*\r
* @return\r
*/\r
- public function dbSync() {\r
+ public function dbSync()\r
+ {\r
$cache = ROOT . '/cache/DB_SYNC';\r
$todo = ROOT . '/cache/DB_TODO';\r
if (!file_exists($cache)) {\r
$db->utilisateurs->prenom('varchar', 64, false);\r
$db->utilisateurs->agence('varchar', 64, true);\r
$db->utilisateurs->entreprise('integer', 0, false);\r
- $db->utilisateurs->grade('integer', 1, false);\r
+ $db->utilisateurs->grade('float', 0, false);\r
$db->utilisateurs->adresse('varchar', 512, false);\r
$db->utilisateurs->code_postal('varchar', 20, false);\r
$db->utilisateurs->ville('varchar', 64, false);\r
$db->google_search_api->date('integer', 0, false);\r
$db->google_search_api->primary('pk_google_search_api', 'request');\r
\r
-\r
try {\r
$dbi = new CubeDbStruct($this->con);\r
$dbi->synchronize($db);\r
} catch (Exception $e) {\r
- return;\r
+\r
}\r
\r
- $this->views->createView('equipiers', 'SELECT * FROM utilisateurs WHERE grade>=1');\r
+ $this->views->createView('equipiers', 'SELECT * FROM utilisateurs WHERE grade>0');\r
$this->views->createView('gerants', 'SELECT * FROM utilisateurs WHERE grade=2');\r
$this->views->createView('impayes_entreprises', 'SELECT SUM(total_ht) AS impaye, u.entreprise AS entreprise '\r
. 'FROM utilisateurs u LEFT JOIN projets p ON u.utilisateur_id=p.client LEFT JOIN factures f ON f.projet=p.projet_id '\r
touch($cache);\r
}\r
\r
- public function sauvePreferencesUtilisateur() {\r
+ public function sauvePreferencesUtilisateur()\r
+ {\r
$dao = new commonDAOUtilisateur($this->con);\r
$dao->sauvePreferences($this->user);\r
}\r
\r
- public function refreshWSUsersTree() {\r
+ public function refreshWSUsersTree()\r
+ {\r
$t = new wsUsersTree($this->con);\r
$t->refreshWSUsersTree();\r
}\r
\r
- public function loadExtranetClasses() {\r
+ public function loadExtranetClasses()\r
+ {\r
global $__autoload;\r
require_once(dirname(__FILE__) . '/../extranet/Metier/_common.php');\r
require_once(dirname(__FILE__) . '/../extranet/Controlleur/_common.php');\r
require_once(dirname(__FILE__) . '/../extranet/DAO/_common.php');\r
}\r
\r
- public function loadWSClasses() {\r
+ public function loadWSClasses()\r
+ {\r
global $__autoload;\r
require_once(dirname(__FILE__) . '/../ws/Metier/_common.php');\r
require_once(dirname(__FILE__) . '/../ws/Controlleur/_common.php');\r
<?php
-class extranetUrl {
+class extranetUrl
+{
- public static function clients($args) {
+ public static function clients($args)
+ {
global $core;
cubePage::truePopup();
cubePage::autoComplete();
return $res;
}
- public static function listeClients($dashboard = null, $settings = null) {
+ public static function listeClients($dashboard = null, $settings = null)
+ {
global $core;
commonDroits::min(1);
$settings = is_null($settings) ? $core->user->getSettings('clients') : $settings;
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);
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);
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);
return $res;
}
- public static function listeContacts($entreprise_id) {
+ public static function listeContacts($entreprise_id)
+ {
global $core;
commonDroits::min(1);
$dao = new commonDAOEntreprise($core->con);
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);
return $res;
}
- public static function formNotes($utilisateur_id) {
+ public static function formNotes($utilisateur_id)
+ {
global $core;
commonDroits::min(1);
$dao = new commonDAOUtilisateur($core->con);
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[] = '<a href="#" class="popup" rel="formProjet/new">' . $core->typo->Ajouter('Créer un projet') . '</a>';
+ if ($core->user->grade >= 1) {
+ $shortcuts[] = '<a href="# class="popup" rel="formProjet/new">' . $core->typo->Ajouter('Créer un projet') . '</a>';
+ }
$filtres = array();
$filtres[] = new commonFiltre(__('Crée par'), 'equipier', $settings['filtres']);
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;
$res .= '<th>' . commonUrl::orderby(__('Année'), 'annee_fin', $settings, 'sort' . $change) . '</th>';
$res .= '<th>' . commonUrl::orderby(__('Chef'), 'chef', $settings, 'sort' . $change) . '</th>';
$res .= '<th>' . commonUrl::orderby(__('Status'), 'status', $settings, 'sort' . $change) . '</th>';
- $res .= '<th>' . commonUrl::orderby(__('Facturé'), 'rapport_facturation', $settings, 'sort' . $change) . '</th>';
- $res .= '<th>' . commonUrl::orderby(__('Payé'), 'rapport_paiement', $settings, 'sort' . $change) . '</th>';
- $res .= '<th>' . commonUrl::orderby('<abbr title="' . __('Budget') . '">B</abbr>', 'budget', $settings, 'sort' . $change) . '</th>';
+ if ($core->user->grade >= 1) {
+ $res .= '<th>' . commonUrl::orderby(__('Facturé'), 'rapport_facturation', $settings, 'sort' . $change) . '</th>';
+ $res .= '<th>' . commonUrl::orderby(__('Payé'), 'rapport_paiement', $settings, 'sort' . $change) . '</th>';
+ $res .= '<th>' . commonUrl::orderby('<abbr title="' . __('Budget') . '">B</abbr>', 'budget', $settings, 'sort' . $change) . '</th>';
+ }
$res .= '<th>' . commonUrl::orderby('<abbr title="' . __('Progression') . '">Pr</abbr>', 'progression', $settings, 'sort' . $change) . '</th>';
$res .= '<th class="min"></th></tr>';
$rapport_paiement = __('Trop');
}
- $res .= '<td>';
- if ($projet->status == 1 && !$rf) {
- $res .= '<a href="' . SITE_PATH . 'editefacture/new/' . $projet->projet_id . '" title="' . __('Créer la facture pour ce projet') . '">' . $rapport_facturation . '</a>';
- } else {
- $res .= $rapport_facturation;
- }
- $res .= '</td>';
- $res .= '<td>' . $rapport_paiement . '</td>';
+ if ($core->user->grade >= 1) {
+ $res .= '<td>';
+ if ($projet->status == 1 && !$rf) {
+ $res .= '<a href="' . SITE_PATH . 'editefacture/new/' . $projet->projet_id . '" title="' . __('Créer la facture pour ce projet') . '">' . $rapport_facturation . '</a>';
+ } else {
+ $res .= $rapport_facturation;
+ }
+ $res .= '</td>';
+ $res .= '<td>' . $rapport_paiement . '</td>';
- $res .= '<td>' . $projet->budget . '</td>';
+ $res .= '<td>' . $projet->budget . '</td>';
+ }
// $res .= '<td>' . $projet->jours_prevus . '</td>';
// $res .= '<td>' . $projet->jours_consommes . '</td>';
$res .= '<td>' . $projet->progression . '</td>';
return $res;
}
- public static function projet($args) {
+ public static function projet($args)
+ {
global $core;
- commonDroits::min(1);
+ commonDroits::min(0.5);
$shortcuts = array();
- $shortcuts[] = '<a href="#" class="popup" rel="formTacheNormale/new/' . $args[1] . '">' . $core->typo->Ajouter('Créer une tâche') . '</a>';
- $shortcuts[] = '<a href="#" class="popup" rel="formTacheSousTraitee/new/' . $args[1] . '">' . $core->typo->Ajouter('Créer une tâche sous-traitée') . '</a>';
+ if ($core->user->grade >= 1) {
+ $shortcuts[] = '<a href="#" class="popup" rel="formTacheNormale/new/' . $args[1] . '">' . $core->typo->Ajouter('Créer une tâche') . '</a>';
+ $shortcuts[] = '<a href="#" class="popup" rel="formTacheSousTraitee/new/' . $args[1] . '">' . $core->typo->Ajouter('Créer une tâche sous-traitée') . '</a>';
+ }
$res = commonPage::barre(null, null, null, $shortcuts);
$res .= commonPage::tMain();
return $res;
}
- public static function listeProjet($projet_id) {
+ public static function listeProjet($projet_id)
+ {
global $core;
- commonDroits::min(1);
+ commonDroits::min(0.5);
$res = '<table class="liste">';
$res .= '<tr><th>#</th>';
$res .= '<th>' . __('Année') . '</th>';
$res .= '<th>' . __('Chef de projet') . '</th>';
$res .= '<th>' . __('Status') . '</th>';
- $res .= '<th><abbr title="' . __('Budget') . '">B</abbr></th>';
+ if ($core->user->grade >= 1) {
+ $res .= '<th><abbr title="' . __('Budget') . '">B</abbr></th>';
+ }
$res .= '<th><abbr title="' . __('Jours prévus') . '">Pl</abbr></th>';
$res .= '<th><abbr title="' . __('Jours consommés') . '">Co</abbr></th>';
$res .= '<th><abbr title="' . __('Progression') . '">Pr</abbr></th>';
} else {
$res .= '<td>' . $core->projets_status[$projet->status] . '</td>';
}
- $res .= '<td>' . $projet->budget . '</td>';
+ if ($core->user->grade >= 1) {
+ $res .= '<td>' . $projet->budget . '</td>';
+ }
$res .= '<td>' . $projet->jours_prevus . '</td>';
$res .= '<td>' . $projet->jours_consommes . '</td>';
$res .= '<td>' . $projet->progression . '</td>';
} else {
$res .= '<td colspan="3"></td>';
}
- $res .= '<td>' . $tache->budget . '</td>';
+
+ if ($core->user->grade >= 1) {
+ $res .= '<td>' . $tache->budget . '</td>';
+ }
if ($tache instanceof extranetTacheNormale) {
$progression = !$tache->progression ? '-' : $tache->progression . '%';
}
}
- $res .= '<td class="action"><a href="#" class="ajax" rel="supprimeTache/' . $tache->tache_id . '" title="' . __('Supprimer cette tâche va également supprimer les timereports associés. Êtes vous certain de vouloir supprimer cette tâche ?') . '">' . cubeMedia::image(IMG . '/delete.png') . '</a></td>';
+ $res .= '<td class="action">';
+ if ($core->user->grade >= 1) {
+ $res .= '<a href="#" class="ajax" rel="supprimeTache/' . $tache->tache_id . '" title="' . __('Supprimer cette tâche va également supprimer les timereports associés. Êtes vous certain de vouloir supprimer cette tâche ?') . '">' . cubeMedia::image(IMG . '/delete.png') . '</a>';
+ }
+ $res .= '</td>';
$res .= '</tr>';
$i++;
return $res;
}
- public static function formProjet($projet_id = 'new') {
+ public static function formProjet($projet_id = 'new')
+ {
global $core;
commonDroits::min(1);
return $res;
}
- public static function formTache($tache) {
+ public static function formTache($tache)
+ {
global $core;
commonDroits::min(1);
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);
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);
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'])) {
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;
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);
return '';
}
- public static function devis($args) {
+ public static function devis($args)
+ {
global $core;
cubePage::truePopup();
cubePage::contextMenu();
return $res;
}
- public static function devis_client($args) {
+ public static function devis_client($args)
+ {
global $core;
$res = commonPage::barre();
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) {
}
}
- public static function contextDevis($id) {
+ public static function contextDevis($id)
+ {
global $core;
$res = '<div class="contextMenu" id="' . $id . '">';
$res .= '<ul>';
return $res;
}
- public static function listeDevisEquipier($dashboard = null, $settings = null) {
+ public static function listeDevisEquipier($dashboard = null, $settings = null)
+ {
global $core;
commonDroits::min(1);
$settings = is_null($settings) ? $core->user->getSettings('devis') : $settings;
return $res;
}
- public static function listeDevisClient($dashboard = null, $settings = null) {
+ public static function listeDevisClient($dashboard = null, $settings = null)
+ {
global $core;
cubePage::truePopup();
return $res;
}
- public static function voirdevis($args) {
+ public static function voirdevis($args)
+ {
global $core;
// Charge le devis
$dao = new extranetDAODevis($core->con);
cubeHTTP::relayNoCache(ROOT . '/docs/devis/' . $args[1] . '.pdf');
}
- public static function editedevis($args) {
+ public static function editedevis($args)
+ {
global $core;
commonDroits::min(1);
$res = commonPage::barre();
return $res;
}
- public static function formDevis($devis_id = 'new') {
+ public static function formDevis($devis_id = 'new')
+ {
global $core;
cubePage::autocomplete();
cubePage::emptyField();
return $res;
}
- public static function previewDevis($args) {
+ public static function previewDevis($args)
+ {
global $core;
$dao = new extranetDAODevis($core->con);
return $res;
}
- public static function factures($args) {
+ public static function factures($args)
+ {
global $core;
if ($core->user->grade == 0) {
return $res;
}
- public static function factures_client($args) {
+ public static function factures_client($args)
+ {
global $core;
$res = commonPage::barre();
$res .= commonPage::tMain();
return $res;
}
- public static function contextFacture($id) {
+ public static function contextFacture($id)
+ {
global $core;
$res = '<div class="contextMenu" id="' . $id . '">';
$res .= '<ul>';
return $res;
}
- public static function listeFactures($dashboard = null, $settings = null) {
+ public static function listeFactures($dashboard = null, $settings = null)
+ {
global $core;
if ($core->user->grade == 0) {
return self::listeFacturesClient($dashboard, $settings);
}
}
- public static function listeFacturesEquipier($dashboard = null, $settings = null) {
+ public static function listeFacturesEquipier($dashboard = null, $settings = null)
+ {
global $core;
cubePage::truePopup();
cubePage::contextMenu();
return $res;
}
- public static function listeFacturesClient($dashboard = null, $settings = null) {
+ public static function listeFacturesClient($dashboard = null, $settings = null)
+ {
global $core;
cubePage::truePopup();
$settings = $core->user->getSettings('factures');
return $res;
}
- public static function formFacturePaiement($facture_id) {
+ public static function formFacturePaiement($facture_id)
+ {
global $core;
$dao = new extranetDAOFacture($core->con);
$facture = $dao->selectById($facture_id);
return $res;
}
- public static function voirfacture($args) {
+ public static function voirfacture($args)
+ {
global $core;
// Charge la facture
$dao = new extranetDAOFacture($core->con);
cubeHTTP::relayNoCache(ROOT . '/docs/factures/' . $args[1] . '.pdf');
}
- public static function editefacture($args) {
+ public static function editefacture($args)
+ {
global $core;
commonDroits::min(1);
$res = commonPage::barre();
return $res;
}
- public static function formFacture($facture_id = 'new', $projet_id = null) {
+ public static function formFacture($facture_id = 'new', $projet_id = null)
+ {
global $core;
commonDroits::min(1);
cubePage::autoComplete();
return $res;
}
- public static function previewFacture($args) {
+ public static function previewFacture($args)
+ {
global $core;
commonDroits::min(1);
$dao = new extranetDAOFacture($core->con);
return $res;
}
- public static function formPrintFactures() {
+ public static function formPrintFactures()
+ {
global $core;
$last = $core->user->getLastPrint();
$res = '';
return $res;
}
- public static function chiffres($args) {
+ public static function chiffres($args)
+ {
global $core;
commonDroits::min(2);
// $res = commonPage::barre(null, null, null, array('<a href="http://www.google.com/calendar/" class="blank">' . $core->typo->Favoris(__('Gérer les charges sur Google Agenda')) . '</a>'));
return $res;
}
- public static function traduction($args) {
+ public static function traduction($args)
+ {
global $core;
commonDroits::min(1);
$res = commonPage::barre();
return $res;
}
- public static function cleanTimereport($args) {
+ public static function cleanTimereport($args)
+ {
global $core;
$r = $core->con->select('SELECT * FROM timereport');
}
}
- public static function rh($args) {
+ public static function rh($args)
+ {
global $core;
commonDroits::min(2);
$res = commonPage::barre();
return $res;
}
- public static function listeRh($dashboard = null, $settings = null) {
+ public static function listeRh($dashboard = null, $settings = null)
+ {
global $core;
commonDroits::min(2);
$settings = is_null($settings) ? $core->user->getSettings('equipiers') : $settings;