feat: import work hours from SaaS and exchange signed time sheet
This commit is contained in:
1 parent
7cf39850e6
commit
1a7c272414
73 files changed
+10488
-72
No files matched your search
@@ -174,6 +174,43 @@ class TeamerRepository extends ServiceEntityRepository
|
||||
return $qb;
|
||||
}
|
||||
|
||||
/**
|
||||
* The season teamers whose working time the SaaS import covers for one month.
|
||||
*
|
||||
* The season flag alone is not enough: it stays set all year, and fetching a teamer for a
|
||||
* month they were not placed in would create a sheet with nothing on it and then remind
|
||||
* them to sign it. "Placed in this month" is computed rather than stored - there is no flag
|
||||
* on SeasonAssignment - as an overlap of the assignment's own period with the month,
|
||||
* exactly as SeasonAssignmentRepository does it. An address is required because the API
|
||||
* looks an employee up by email.
|
||||
*
|
||||
* @return Teamer[]
|
||||
*/
|
||||
public function findSeasonTeamersForMonth(\DateTimeImmutable $firstDay, \DateTimeImmutable $lastDay): array
|
||||
{
|
||||
$qb = $this->createQueryBuilder('teamer');
|
||||
|
||||
return $qb
|
||||
->innerJoin('teamer.seasonAssignments', 'season_assignment')
|
||||
->andWhere($qb->expr()->eq('teamer.allSeason', ':allSeason'))
|
||||
->andWhere($qb->expr()->isNull('teamer.deletedAt'))
|
||||
->andWhere($qb->expr()->isNull('season_assignment.deletedAt'))
|
||||
->andWhere('season_assignment.dateFrom <= :lastDay')
|
||||
->andWhere('season_assignment.dateTo >= :firstDay')
|
||||
->andWhere($qb->expr()->isNotNull('teamer.communication.email'))
|
||||
->andWhere($qb->expr()->neq('teamer.communication.email', ':empty'))
|
||||
->setParameter('allSeason', true)
|
||||
->setParameter('firstDay', $firstDay)
|
||||
->setParameter('lastDay', $lastDay)
|
||||
->setParameter('empty', '')
|
||||
->groupBy('teamer.id')
|
||||
->orderBy('teamer.lastName', \SortDirection::Ascending)
|
||||
->addOrderBy('teamer.firstName', \SortDirection::Ascending)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $allSeasonOnly restricts the suggestions to all-season teamers, so a season
|
||||
* assignment cannot be created for someone who works short term
|
||||
|
||||
Reference in new issue
Block a user