feat: allow overlapping assignments via flag set on individual teamers
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Repository\TrainingRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -64,6 +65,10 @@ class SkillsController extends AbstractController
|
||||
'Bestandsteamer' => Teamer::STATUS_EXISTING,
|
||||
],
|
||||
])
|
||||
->add('allowOverlappingApplications', CheckboxType::class, [
|
||||
'label' => 'Überlappende Bewerbungen erlauben',
|
||||
'required' => false,
|
||||
])
|
||||
->getForm();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,9 @@ class Teamer implements TimestampableEntityInterface
|
||||
#[ORM\Column]
|
||||
private bool $viewed = false;
|
||||
|
||||
#[ORM\Column]
|
||||
private bool $allowOverlappingApplications = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
@@ -797,4 +800,16 @@ class Teamer implements TimestampableEntityInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isAllowOverlappingApplications(): bool
|
||||
{
|
||||
return $this->allowOverlappingApplications;
|
||||
}
|
||||
|
||||
public function setAllowOverlappingApplications(bool $allowOverlappingApplications): static
|
||||
{
|
||||
$this->allowOverlappingApplications = $allowOverlappingApplications;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,13 @@ class InvalidateApplicationsListener
|
||||
}
|
||||
|
||||
$disposition = $document->getDisposition();
|
||||
$assignment = $disposition->getAssignment();
|
||||
$teamer = $disposition->getTeamer();
|
||||
|
||||
if (true === $teamer->isAllowOverlappingApplications()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$assignment = $disposition->getAssignment();
|
||||
$period = $assignment->getEffectivePeriod();
|
||||
|
||||
// Find other applications by this teamer with overlapping date ranges
|
||||
|
||||
@@ -19,6 +19,10 @@ class ApplicationValidator extends ConstraintValidator
|
||||
|
||||
$teamer = $application->getTeamer();
|
||||
|
||||
if (true === $teamer->isAllowOverlappingApplications()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$assignment = $application->getAssignment();
|
||||
$destination = $assignment->getDestination();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user