feat: proper determination of agency initiated bookings
For booking that are agency initiated (groups) different rules apply concerning mutability and requirement of personal data and whether the first participant is the applicant or not. This commit adds logic to evaluate the agency id assigned to the booking data to decide.
This commit is contained in:
@@ -7,6 +7,7 @@ namespace App\Form\Model;
|
||||
use App\BusProNet\Constants;
|
||||
use App\BusProNet\Model\Booking;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\XmlLoader\AgencyLoader;
|
||||
use App\Validator\Constraints as AppAssert;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
@@ -49,6 +50,8 @@ class BookingDto
|
||||
|
||||
public ?int $agencyId = null;
|
||||
|
||||
public ?string $agencyCode = null;
|
||||
|
||||
/**
|
||||
* Booking status code for API submission.
|
||||
* Values: 'F' (Final/Frei), 'A' (Anfrage/Inquiry).
|
||||
@@ -310,4 +313,16 @@ class BookingDto
|
||||
|
||||
return $oldSnapshot !== $newSnapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this booking is initiated by the internal agency.
|
||||
*
|
||||
* Internal agency bookings have a different relationship between applicant
|
||||
* and first participant: the applicant is a staff member, not the first
|
||||
* participant. This affects personal data editability rules.
|
||||
*/
|
||||
public function isInternalAgencyBooking(): bool
|
||||
{
|
||||
return AgencyLoader::INTERNAL_AGENCY_CODE === $this->agencyCode;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user