try:
ref_employe = ref.Authentification.objects.get(courriel=user.email).id
employe = rh.Employe.objects.get(id=ref_employe.id)
+ employe.courriel = ref.Employe.objects.get(id=employe.id).courriel
except:
#raise Exception(u"L'employé avec le courriel %s n'a pas été trouvé dans le référentiel." % user.email)
employe = rh.Employe.objects.none()
return employe
+
+def get_employe_from_id(id):
+ """
+ Retourne un employé AUF (rh.Employe) à partir de son id.
+ """
+ try:
+ employe = rh.Employe.objects.get(id=id)
+ employe.courriel = ref.Employe.objects.get(id=employe.id).courriel
+ except:
+ employe = rh.Employe.objects.none()
+ return employe
def safe_create_groupe(name):
"""
--- /dev/null
+.clear { clear:both; }
+.gauche { float:left; }
+.gauche25 { float:left; width:25%; }
+.gauche33 { float:left; width:33%; }
+.gauche40 { float:left; width:40%; }
+.gauche50 { float:left; width:50%; }
+.gauche60 { float:left; width:60%; }
+.droite { float:right; }
+.droite25 { float:right; width:25%; }
+.droite33 { float:right; width:33%; }
+.droite40 { float:right; width:40%; }
+.droite50 { float:right; width:50%; }
+.droite60 { float:right; width:60%; }
if not nom_affichage:
nom_affichage = u'%s %s' % (self.nom.upper(), self.prenom)
return nom_affichage
+
+ def civilite(self):
+ civilite = u''
+ if self.genre.upper() == u'M':
+ civilite = u'M.'
+ elif self.genre.upper() == u'F':
+ civilite = u'Mme'
+ return civilite
class EmployePiece(models.Model):
"""Documents relatifs à un employé.
"""
# Identification
employe = models.ForeignKey('Employe', db_column='employe',
- related_name='+',
+ related_name='dossiers',
verbose_name="Employé")
poste = models.ForeignKey('Poste', db_column='poste', related_name='+')
statut = models.ForeignKey('Statut', related_name='+', default=3,
__doc__ = Dossier_.__doc__
-
-class Dossier(Dossier_):
- __doc__ = Dossier_.__doc__
-
-
class DossierPiece(models.Model):
"""Documents relatifs au Dossier (à l'occupation de ce poste par employé).
Ex.: Lettre de motivation.
-{% extends 'base.html' %}
+{% extends 'sgrh.html' %}
{% block title %}RH - {{ employe }}{% endblock %}
{% block sous_titre %}Espace personnel{% endblock %}
{% block main %}
-<h1>{{ employe }}</h1>
+<h1>{{ employe.civilite }} {{ employe }}</h1>
-Infos personnelles.
+<div id="identification">
+<p>{{ employe.dossier.poste }}</p>
+</div>
+
+<div id="infos" class="gauche50">
+ <h2>Informations professionnelles AUF</h2>
+ <table>
+ <tbody>
+ <tr>
+ <th>Date d'entrée :</th>
+ <td>{{ employe.date_entree }}</td>
+ </tr>
+ </tbody>
+ </table>
+
+</div>
+<div id="infos_perso" class="gauche50">
+ <h2>Informations personnelles</h2>
+ <table>
+ <tbody>
+ {% comment %}
+ <tr>
+ <th>Nom d'affichage :</th>
+ <td>{{ employe.nom_affichage }}</td>
+ </tr>
+ {% endcomment %}
+ <tr>
+ <th>Date de naissance :</th>
+ <td>{{ employe.date_naissance }}</td>
+ </tr>
+ <tr>
+ <th>Nationalité :</th>
+ <td>{{ employe.nationalite }}</td>
+ </tr>
+ <tr>
+ <th>Situation familiale :</th>
+ <td>{{ employe.situation_familiale }}</td>
+ </tr>
+ </tbody>
+ </table>
+
+</div>
+
+<div id="coord" class="clear gauche50">
+ <h2>Coordonnées professionnelles AUF</h2>
+ {{ employe.courriel }}
+</div>
+<div id="coord_perso" class="gauche50">
+ <h2>Coordonnées personnelles</h2>
+ <table>
+ <tbody>
+ <tr>
+ <th>Téléphone domicile :</th>
+ <td>{{ employe.tel_domicile }}</td>
+ </tr>
+ <tr>
+ <th>Téléphone cellulaire :</th>
+ <td>{{ employe.tel_cellulaire }}</td>
+ </tr>
+ <tr>
+ <th>Adresse complète :</th>
+ <td>
+ {{ employe.adresse }}<br />
+ {% if employe.ville or employe.province %}
+ {{ employe.ville }}
+ {% if employe.ville and employe.province %}, {% endif %}
+ {{ employe.province }}
+ <br />
+ {% endif %}
+ {% if employe.code_postal %}
+ {{ employe.code_postal }}<br />
+ {% endif %}
+ {{ employe.pays.nom }}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+<div id="dossiers" class="clear">
+<h2>Dossiers</h2>
+
+<ul>
+{% for d in employe.dossiers.all %}
+ <li>{{ d }}</li>
+{% endfor %}
+</ul>
+</div>
{% endblock %}
from django.shortcuts import redirect, render_to_response, get_object_or_404
from django.template import RequestContext
-#from datamaster_modeles import models as ref
-from project.rh import models as rh
+from datamaster_modeles import models as ref
from project.decorators import user_is_this_employe
+from project.lib import get_employe_from_id
+from rh import models as rh
# homes
@user_is_this_employe
def perso(request, id):
"""Espace personnel de l'employé."""
- try:
- employe = rh.Employe.objects.get(pk=id)
- except:
- employe = rh.Employe.none()
+ employe = get_employe_from_id(id)
+
c = {
'user':request.user,
'employe':employe,
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'auf.django.skin.context_processors.auf',
- 'project.context_processors.utilisateur',
+ #'project.context_processors.utilisateur',
'project.context_processors.this_employe',
'project.context_processors.user_is_admin',
'dae.context_processors.user_in_dae_groupes',
{% else %}
<li class="username">{{ user }}</li>
{% endif %}
- <li><a href="{% url admin:index %}">Administration</a></li>
+ {% if user_is_admin or user_in_dae_groupes or user_in_recrutement_groupes %}
+ <li><a href="{% url admin:index %}">Administration</a></li>
+ {% endif %}
<li><a href="{% url django.contrib.auth.views.logout %}?next=/">Déconnexion</a></li>
{% else %}
<li><a href="{% url django.contrib.auth.views.login %}?next={{request.path}}">Connexion</a></li>
--- /dev/null
+{% extends "base.html" %}
+
+{% block extrahead %}
+ <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/sgrh.css" media="all"/>
+{% endblock %}