up handle overrides with edit questions

This commit is contained in:
Tykayn 2025-05-27 11:18:29 +02:00 committed by tykayn
parent de64feb549
commit 5d9bb8b5e6
28 changed files with 6390 additions and 62 deletions

View file

@ -29,6 +29,43 @@ class Motocultrice
) {
}
public function map_post_values($request_post) {
$has_ask_angela = false;
$remove_ask_angela = false;
$has_opening_hours = false;
$modified_request_post = [];
foreach ($request_post as $key => $value) {
if (strpos($key, 'custom__ask_angela') === 0 ) {
if($value == 'ask_angela'){
$has_ask_angela = true;
}else{
$remove_ask_angela = true;
}
}
if (strpos($key, 'custom__opening_hours') === 0 && $value != '') {
$has_opening_hours = true;
}
$modified_request_post[$key] = $value;
}
if($has_ask_angela) {
$modified_request_post['commerce_tag_value__harassment_prevention'] = 'ask_angela';
}
if($remove_ask_angela) {
unset($modified_request_post['commerce_tag_value__harassment_prevention']);
}
if($has_opening_hours) {
$modified_request_post['commerce_tag_value__opening_hours'] = $request_post['commerce_tag_value__opening_hours'];
}
return $modified_request_post;
}
public function labourer(string $zone): array
{