- Timestamp:
- 03/21/16 14:51:29 (8 years ago)
- Location:
- trunk/LATMOS-Accounts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Maintenance.pm
r1365 r1735 8 8 use LATMOS::Accounts::Mail; 9 9 use FindBin qw($Bin); 10 use DateTime; 11 use Date::Calc; 12 use Date::Parse; 10 13 11 14 =head1 NAME … … 39 42 my $sth= $base->db->prepare(q{ 40 43 select name, 41 justify_hours(coalesce(endcircuit, expire) - now()) as delay, 42 endcircuit 44 coalesce(endcircuit, expire) as appliedexpire, 45 endcircuit, 46 expire 43 47 from "user" 44 48 where 45 49 coalesce(endcircuit, expire) < now() + ?::interval 46 and expire> now()50 and coalesce(endcircuit, expire) > now() 47 51 and coalesce(endcircuit, expire) is not null 48 52 and exported = True … … 53 57 my @users; 54 58 while (my $res = $sth->fetchrow_hashref) { 55 $res->{delay} =~ s/ day.? .*//; 59 my $now = DateTime->now; 60 my @expire = strptime($res->{appliedexpire}); 61 62 my ($days) = Date::Calc::Delta_Days( 63 $now->year, $now->month, $now->day, 64 1900 + $expire[5], $expire[4] +1, $expire[3], 65 ); 66 67 $res->{days} = $days; 68 56 69 $res->{obj} = $base->get_object('user', $res->{name}); 57 70 $res->{obj}->get_attributes('locked') and next; … … 97 110 my %mail = ( 98 111 From => $self->val('_default_', 'mailFrom', 'nomail@localhost'), 99 Subject => sprintf('Account %s Expire in %s days', $user->{name}, $user->{d elay}),112 Subject => sprintf('Account %s Expire in %s days', $user->{name}, $user->{days}), 100 113 'X-LATMOS-Reason' => 'Account expiration', 101 114 ); … … 124 137 my $mailcc = join(', ', @cc) || ''; 125 138 push(@summary, sprintf("%s : %s : %s\n", 126 $user->{obj}->queryformat('%{sn} %{givenName} : %{name} : %{department} : %{manager} : %{expireText} '),139 $user->{obj}->queryformat('%{sn} %{givenName} : %{name} : %{department} : %{manager} : %{expireText} : %{endcircuit}'), 127 140 $to || 'Not sent, no destination', 128 141 ($mailcc ? $mailcc : ''), … … 133 146 la_log(LA_NOTICE, "Expiration mail for %s (%s) sent to %s; cc %s", 134 147 $user->{obj}->id, 135 $user->{d elay},148 $user->{days}, 136 149 $mail{to}, ($mail{cc} || '')); 137 150 if ($options{to}) { -
trunk/LATMOS-Accounts/templates/mail/account_expire.mail
r1426 r1735 4 4 5 5 sauf erreur ou ommission de notre part votre compte [% obj.id %] expire 6 dans [% delay %] jours([% obj.get_c_field('expire') %]).6 dans [% IF days %][% days %] jours[% ELSE %]aujourd'hui[% END %] ([% obj.get_c_field('expire') %]). 7 7 En aucun cas vos fichiers ne seront détruits. 8 8 9 [% IF endcircuit %] 10 Il semble que vous n'avez pas fini votre circuit de sortie 11 12 Merci de terminer celui-ci pour voir votre compte prolongé. 13 [% ELSE %] 9 14 Si ce dernier devait être prolongé, merci de dire à votre responsable 10 15 de contacter svp@latmos.ipsl.fr afin de nous donner la nouvelle date. 11 12 13 Cas d'un nouvel arrivant: 14 15 Si vous êtes un nouvel arrivant, veuillez réaliser votre circuit d'entrée et 16 remettre la fiche à Brigitte Fromager (Guyancourt - bureau 2421) ou Irina 17 Tchoumakova (Jussieu - bureau 409). 18 Si vous rencontrez des difficultés, n'hésitez pas à vous adresser à votre 19 responsable, ou à Brigitte et Irina. 16 [% END %] 20 17 21 18 … … 36 33 37 34 Except error or omission on our part, your account login expires 38 in [% delay %] days([% obj.get_c_field('expire') %]).35 in [% IF days %][% days %] days[% ELSE %]today[% END %] ([% obj.get_c_field('expire') %]). 39 36 In no case your files will be destroyed. 40 37 38 [% IF endcircuit %] 39 It seems you haven't finish your entrance circuit 40 41 Thanks to finish it to have your account prolongated. 42 [% ELSE %] 41 43 If your account had to be extended, please ask your manager to contact 42 44 svp@latmos.ipsl.fr to give us a new expiration date. 43 44 45 If you are new in laboratory: 46 47 If you are a newcomer, please make your entrance circuit and pass on the sheet 48 to Brigitte Fromager (Guyancourt - office 2421) or Irina Tchoumakova (Jussieu - 49 office 409). 50 If you meet difficulties, don't hesitate to deal with your manager, or with 51 Brigitte and Irina. 45 [% END %] 52 46 53 47
Note: See TracChangeset
for help on using the changeset viewer.