feat: map house manager roles and houses by crm ids instead of labels

This commit is contained in:
Björn Fromme
2026-08-18 09:08:01 +02:00
parent 25f5840085
commit 1fd0fbc21e
4 changed files with 70 additions and 4 deletions
+7 -3
View File
@@ -185,9 +185,12 @@ class ResponseParser
;
$attributes[] = $attribute;
if (1 === preg_match('/^Hausleitung ([A-Z0-9]+)$/', $attributeLabel, $matches) && true === $attribute->isSelected()) {
// Matched by id, like every other role: the "Hausleitung XXX" label is BusPro
// wording and must not decide who gets access to which house.
$houseManagerCode = $this->config['bpn_crm_house_manager_ids'][$attribute->getId()] ?? null;
if (null !== $houseManagerCode && true === $attribute->isSelected()) {
$isHouseManager = true;
$hotelCodes[] = $matches[1];
$hotelCodes[] = $houseManagerCode;
}
if ($this->config['bpn_crm_id_admin'] === $attribute->getId() && true === $attribute->isSelected()) {
$isAdmin = true;
@@ -294,13 +297,14 @@ class ResponseParser
private function resolveOptions(array $options): array
{
$optionsResolver = new OptionsResolver();
$optionsResolver->setRequired(['bpn_crm_id_admin', 'bpn_crm_id_manager', 'bpn_crm_id_teamer']);
$optionsResolver->setRequired(['bpn_crm_id_admin', 'bpn_crm_id_manager', 'bpn_crm_id_teamer', 'bpn_crm_house_manager_ids']);
$optionsResolver->setDefaults([
'bpn_default_hotel_code' => null,
]);
$optionsResolver->setAllowedTypes('bpn_crm_id_admin', 'int');
$optionsResolver->setAllowedTypes('bpn_crm_id_manager', 'int');
$optionsResolver->setAllowedTypes('bpn_crm_id_teamer', 'int');
$optionsResolver->setAllowedTypes('bpn_crm_house_manager_ids', 'array');
$optionsResolver->setAllowedTypes('bpn_default_hotel_code', ['string', 'null']);
return $optionsResolver->resolve($options);