feat: API produktów - nowe pola new_to_date i additional_message (v0.332)
- ProductRepository::getProductForApi() eksportuje new_to_date, additional_message, additional_message_required, additional_message_text - ProductsApiController obsługuje te pola w PUT/PATCH - Zaktualizowana dokumentacja API.md i CHANGELOG Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -437,7 +437,7 @@ class ProductsApiController
|
||||
// String fields — direct mapping
|
||||
$stringFields = [
|
||||
'sku', 'ean', 'custom_label_0', 'custom_label_1', 'custom_label_2',
|
||||
'custom_label_3', 'custom_label_4', 'wp',
|
||||
'custom_label_3', 'custom_label_4', 'wp', 'new_to_date', 'additional_message_text',
|
||||
];
|
||||
foreach ($stringFields as $field) {
|
||||
if (isset($body[$field])) {
|
||||
@@ -447,6 +447,18 @@ class ProductsApiController
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($body['additional_message'])) {
|
||||
$d['additional_message'] = !empty($body['additional_message']) ? 'on' : '';
|
||||
} elseif ($existing !== null) {
|
||||
$d['additional_message'] = !empty($existing['additional_message']) ? 'on' : '';
|
||||
}
|
||||
|
||||
if (isset($body['additional_message_required'])) {
|
||||
$d['additional_message_required'] = !empty($body['additional_message_required']) ? 'on' : '';
|
||||
} elseif ($existing !== null) {
|
||||
$d['additional_message_required'] = !empty($existing['additional_message_required']) ? 'on' : '';
|
||||
}
|
||||
|
||||
// Foreign keys
|
||||
if (isset($body['set_id'])) {
|
||||
$d['set'] = $body['set_id'];
|
||||
|
||||
Reference in New Issue
Block a user