Index: trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Employment.pm
===================================================================
--- trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Employment.pm	(revision 1589)
+++ trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Employment.pm	(revision 1590)
@@ -290,5 +290,8 @@
 
     my %changes;
-    my @employmentDate = qw( endEmployment endStrictEmployment endCurrentEmployment endLastEmployment );
+    my @employmentDate = qw(
+        endEmployment   endStrictEmployment   endCurrentEmployment   endLastEmployment
+        startEmployment startStrictEmployment startCurrentEmployment startFirstEmployment
+    );
     foreach (@employmentDate) {
         my $old = $user->_get_attributes($_) || '';
Index: trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
===================================================================
--- trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm	(revision 1589)
+++ trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm	(revision 1590)
@@ -314,4 +314,97 @@
                 ro => 1,
                 label => l('End of any employment'),
+            },
+            _startEmployment => {
+                formtype => 'DATETIME',
+                managed => 1,
+                ro => 1,
+                hide => 1,
+                get => sub {
+                    my ($attr) = @_;
+                    my $self = $attr->object;
+                    $self->_computeStartEmployment($self->base->config('employment_delay'));
+                },
+                label => l('Start of employment'),
+            },
+            startEmployment => {
+                formtype => 'DATETIME',
+                ro => 1,
+                label => l('Start of employment'),
+            },
+            _startStrictEmployment => {
+                formtype => 'DATETIME',
+                managed => 1,
+                ro => 1,
+                hide => 1,
+                get => sub {
+                    my ($attr) = @_;
+                    my $self = $attr->object;
+                    $self->_computeStartEmployment();
+                },
+            },
+            startStrictEmployment => {
+                formtype => 'DATETIME',
+                ro => 1,
+            },
+            _startCurrentEmployment => {
+                formtype => 'DATETIME',
+                managed => 1,
+                ro => 1,
+                hide => 1,
+                get => sub {
+                    my ($attr) = @_;
+                    my $self = $attr->object;
+
+                    my $list_empl = $self->base->db->prepare_cached(q{
+                        SELECT * FROM employment WHERE "user" = ? and
+                            firstday <= now() and
+                            (lastday is null or lastday >= now() - '1 days'::interval) 
+                            order by firstday asc
+                    });
+                    $list_empl->execute($self->id);
+                    my $start;
+                    while (my $res = $list_empl->fetchrow_hashref) {
+                        $start = DateTime->from_epoch(epoch => str2time($res->{firstday}));
+                        $start->set_time_zone( DateTime::TimeZone->new( name => 'local' ) );
+                        last;
+                    }
+                    $list_empl->finish;
+
+                    return $start ? $start->iso8601 : undef
+                },
+            },
+            startCurrentEmployment => {
+                formtype => 'DATETIME',
+                ro => 1,
+            },
+            _startFirstEmployment => {
+                formtype => 'DATETIME',
+                managed => 1,
+                ro => 1,
+                hide => 1,
+                get => sub {
+                    my ($attr) = @_;
+                    my $self = $attr->object;
+
+                    my $list_empl = $self->base->db->prepare_cached(q{
+                        SELECT * FROM employment WHERE "user" = ?
+                        order by firstday asc
+                    });
+                    $list_empl->execute($self->id);
+                    my $res = $list_empl->fetchrow_hashref;
+                    $list_empl->finish;
+                    my $start;
+                    if ($res && $res->{firstday}) {
+                        $start = DateTime->from_epoch(epoch => str2time($res->{firstday}));
+                        $start->set_time_zone( DateTime::TimeZone->new( name => 'local' ) );
+                    }
+                    return $start ? $start->iso8601 : undef
+                },
+                label => l('Start of any employment'),
+            },
+            startFirstEmployment => {
+                formtype => 'DATETIME',
+                ro => 1,
+                label => l('Start of any employment'),
             },
             cn        => {
@@ -1201,10 +1294,55 @@
 
 
+sub _computeStartEmployment {
+    my ($self, $delay) = @_;
+
+    my $list_empl = $self->base->db->prepare_cached(q{
+        SELECT *, (lastday is null or lastday >= now()) as "current" FROM employment WHERE "user" = ?
+        order by firstday desc
+        });
+    $list_empl->execute($self->id);
+    my $start;
+    while (my $res = $list_empl->fetchrow_hashref) {
+        if ($start) {
+            my $prevend = DateTime->from_epoch(epoch => str2time($res->{lastday}));
+            my $tstart = $start->clone;
+            if ($delay) {
+                $tstart->subtract(days => $delay);
+            }
+            if ($tstart->ymd gt $prevend->ymd) {
+                last;
+            }
+        } else {
+            if (!$res->{current}) {
+                last;
+            }
+        }
+        $start = DateTime->from_epoch(epoch => str2time($res->{firstday}));
+        $start->set_time_zone( DateTime::TimeZone->new( name => 'local' ) );
+    }
+    $list_empl->finish;
+
+    if (!$start) {
+        my $listold = $self->base->db->prepare_cached(q{
+            SELECT min(firstday) as firstday FROM employment WHERE "user" = ? and
+            lastday IS NOT NULL and lastday <= now() - '1 days'::interval
+            });
+        $listold->execute($self->id);
+        my $res = $listold->fetchrow_hashref;
+        if ($res && $res->{firstday}) {
+            $start = DateTime->from_epoch(epoch => str2time($res->{firstday}));
+            $start->set_time_zone( DateTime::TimeZone->new( name => 'local' ) );
+        }
+        $listold->finish;
+    }
+    return $start ? $start->iso8601 : undef
+}
+
 sub _computeEndEmployment {
     my ($self, $delay) = @_;
 
     my $list_empl = $self->base->db->prepare_cached(q{
-        SELECT *, firstday <= now() as "started" FROM employment WHERE "user" = ? and
-        (lastday is null or lastday >= now() - '1 days'::interval) 
+        SELECT *, firstday <= now() as "current" FROM employment WHERE "user" = ? and
+        (lastday is null or lastday >= now() - '1 days'::interval)
         order by firstday asc
         });
@@ -1227,5 +1365,5 @@
             }
         } else {
-            if (!$res->{started}) {
+            if (!$res->{current}) {
                 last;
             }
