Fix computing delays

tags/smeserver-expire-accounts-0.1.7-1 0.0.1_el5
Daniel Berteaud 9 years ago
parent 40cfe05301
commit 15fa733e73
  1. 4
      root/sbin/e-smith/expire-accounts
  2. 4
      root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/expireaccounts.pm

@ -99,7 +99,7 @@ foreach my $user ($a->users){
push @lock, $user->key; push @lock, $user->key;
} }
else{ else{
my $remaining = ($exp - $now)->in_units('days'); my $remaining = $exp->delta_days($now)->in_units('days');
print $user->key . ": Account will expire on $lock_date ($remaining days)\n" if $debug; print $user->key . ": Account will expire on $lock_date ($remaining days)\n" if $debug;
$rem->{$user->key} = $remaining if $remaining < $warn_delay; $rem->{$user->key} = $remaining if $remaining < $warn_delay;
} }
@ -156,7 +156,7 @@ foreach my $user (keys %$rem){
month => $2, month => $2,
day => $3, day => $3,
); );
if ( ($last_notif - $now)->in_units('days') < $days_between_warn ){ if ( $last_notif->delta_days($now)->in_units('days') < $days_between_warn ){
next; next;
} }
} }

@ -103,7 +103,7 @@ sub print_user_table {
day => $3 day => $3
); );
}; };
$days_left = ($lock_on - $now)->in_units('days') if ($lock_on); $days_left = $lock_on->delta_days($now)->in_units('days') if ($lock_on);
} }
my $addr = ($delivery eq 'local') ? '' : $fwd; my $addr = ($delivery eq 'local') ? '' : $fwd;
print $q->Tr( print $q->Tr(
@ -146,7 +146,7 @@ sub print_user_table {
}; };
if ($locked_date){ if ($locked_date){
my $delete_on = $locked_date->add(days => $delete_in); my $delete_on = $locked_date->add(days => $delete_in);
$days_left = ($delete_on - $now)->in_units('days'); $days_left = $delete_on->delta_days($now)->in_units('days');
} }
} }
my $addr = ($delivery eq 'local') ? '' : $fwd; my $addr = ($delivery eq 'local') ? '' : $fwd;

Loading…
Cancel
Save