MCP Occurrence-Felder beim Schreiben übernehmen

This commit is contained in:
gitea_admin committed 2026-09-20 19:45:55 +02:00
1 parent 6750d4778f
commit 25ef8ef7b0
2 files changed
+12 -6

No files matched your search

+1
View File
@@ -215,6 +215,7 @@ function market_management_mcp_get_market(PDO $pdo, int $marketId, bool $include
function market_management_mcp_update_occurrence(PDO $pdo, int $occurrenceId, array $input): array function market_management_mcp_update_occurrence(PDO $pdo, int $occurrenceId, array $input): array
{ {
unset($input['occurrence_id']);
$simpleCostFields = []; $simpleCostFields = [];
foreach (['gross_cost', 'cost_items_text', 'tax_status', 'tax_rate'] as $field) { foreach (['gross_cost', 'cost_items_text', 'tax_status', 'tax_rate'] as $field) {
if (array_key_exists($field, $input)) { if (array_key_exists($field, $input)) {
+11 -6
View File
@@ -775,16 +775,21 @@ function market_management_create_occurrence(PDO $pdo, array $input): array
} }
market_management_set_occurrence_contact($pdo, [ market_management_set_occurrence_contact($pdo, [
'occurrence_id' => (int) $occurrence['id'], 'occurrence_id' => (int) $occurrence['id'],
'contact_person_name' => null, 'contact_person_name' => $input['contact_person_name'] ?? null,
'contact_email' => null, 'contact_email' => $input['contact_email'] ?? null,
'contact_phone' => null, 'contact_phone' => $input['contact_phone'] ?? null,
]); ]);
$grossCost = market_management_optional_number($input, 'gross_cost') ?? '0.00';
$taxStatus = trim((string) ($input['tax_status'] ?? 'taxable'));
$taxRate = market_management_optional_number($input, 'tax_rate')
?? ($taxStatus === 'tax_free' ? '0.00' : '8.10');
market_management_create_cost_item($pdo, [ market_management_create_cost_item($pdo, [
'occurrence_id' => (int) $occurrence['id'], 'occurrence_id' => (int) $occurrence['id'],
'cost_type_id' => market_management_get_cost_type_id($pdo, 'stand_fee'), 'cost_type_id' => market_management_get_cost_type_id($pdo, 'stand_fee'),
'gross_amount' => 0, 'description' => market_management_optional_string($input, 'cost_items_text'),
'tax_status' => 'taxable', 'gross_amount' => $grossCost,
'tax_rate' => 8.10, 'tax_status' => $taxStatus,
'tax_rate' => $taxRate,
]); ]);
if ($startedTransaction) { if ($startedTransaction) {
$pdo->commit(); $pdo->commit();