feat: assignments with disabled formalities
addresses #869dnvm8c
This commit is contained in:
@@ -75,7 +75,11 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
public function __construct(Application $application)
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
$this->status = static::STATUS_NEW;
|
||||
// A skip-formalities assignment has no contract step to wait for, so the placement starts
|
||||
// out where a signed and checked contract would otherwise have put it.
|
||||
$this->status = true === $application->getAssignment()?->isSkipFormalities()
|
||||
? static::STATUS_CONFIRMED
|
||||
: static::STATUS_NEW;
|
||||
$this->assignment = $application->getAssignment();
|
||||
$this->teamer = $application->getTeamer();
|
||||
$this->pickup = $application->getPickup();
|
||||
@@ -218,12 +222,25 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the owning assignment switches off the contract, invoice and feedback process.
|
||||
* Kept here so call sites do not have to repeat the null check on the assignment.
|
||||
*/
|
||||
public function isSkipFormalities(): bool
|
||||
{
|
||||
return true === $this->getAssignment()?->isSkipFormalities();
|
||||
}
|
||||
|
||||
/**
|
||||
* The period is passed in rather than hardcoded so that this, the reminder mail and the
|
||||
* admin overdue list all work from the same %contract_upload_deadline_days%.
|
||||
*/
|
||||
public function isContractDue(int $deadlineDays): bool
|
||||
{
|
||||
if (true === $this->isSkipFormalities()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null !== $this->getDocumentByType(Upload::TYPE_CONTRACT)) {
|
||||
return false;
|
||||
}
|
||||
@@ -251,6 +268,10 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
|
||||
public function isContractRejected(): bool
|
||||
{
|
||||
if (true === $this->isSkipFormalities()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null === $contractDocument = $this->getDocumentByType(Upload::TYPE_CONTRACT)) {
|
||||
return false;
|
||||
}
|
||||
@@ -267,6 +288,10 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
*/
|
||||
public function isInvoiceDue(int $deadlineDays): bool
|
||||
{
|
||||
if (true === $this->isSkipFormalities()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null !== $this->getDocumentByType(Upload::TYPE_INVOICE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user