Changeset 1757
- Timestamp:
- 04/26/16 14:30:48 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r1754 r1757 241 241 my ($attr) = @_; 242 242 my $self = $attr->object; 243 $self->_computeEndEmployment($self->base->config('employment_delay') || 0, 1 );243 $self->_computeEndEmployment($self->base->config('employment_delay') || 0, 1, 1); 244 244 }, 245 245 label => l('Start of employment'), … … 359 359 my ($attr) = @_; 360 360 my $self = $attr->object; 361 $self->_computeStartEmployment($self->base->config('employment_delay') || 0, 1 );361 $self->_computeStartEmployment($self->base->config('employment_delay') || 0, 1, 1); 362 362 }, 363 363 label => l('Start of employment'), … … 1512 1512 1513 1513 sub _computeStartEmployment { 1514 my ($self, $delay, $any ) = @_;1514 my ($self, $delay, $any, $workday) = @_; 1515 1515 1516 1516 $delay ||= 0; … … 1552 1552 $start ||= $nstart if ($any); 1553 1553 1554 if ($start) { 1555 if ($workday) { 1556 my $day_of_week = $start->day_of_week; 1557 $start->add(days => 1558 $day_of_week == 6 ? 2 : 1559 $day_of_week == 7 ? 1 : 0 1560 ); 1561 } 1562 } 1563 1554 1564 return $start ? $start->iso8601 : undef 1555 1565 } 1556 1566 1557 1567 sub _computeEndEmployment { 1558 my ($self, $delay, $any ) = @_;1568 my ($self, $delay, $any, $workday) = @_; 1559 1569 1560 1570 $delay ||= 0; … … 1602 1612 $end ||= $pend if($any); 1603 1613 1614 if ($end) { 1615 if ($workday) { 1616 my $day_of_week = $end->day_of_week; 1617 $end->subtract(days => 1618 $day_of_week == 7 ? 2 : 1619 $day_of_week == 6 ? 1 : 0 1620 ); 1621 } 1622 } 1623 1604 1624 return $end ? $end->iso8601 : undef 1605 1625 }
Note: See TracChangeset
for help on using the changeset viewer.