added new calendar meta to shipping note

This commit is contained in:
Luca Haid
2025-09-01 11:32:12 +02:00
parent b887830988
commit f2d5517b85
5 changed files with 109 additions and 15 deletions

View File

@@ -45,19 +45,21 @@ class WarehouseShippingNoteController extends TTCrud {
fn($p) => $p['status'] === 'new' ?: 'Status muss "Neu" sein',
fn($p) => $this->validateHours($p['hoursEntries'])
]);
$postData['positions'] = json_encode($postData['positions']);
$this->postData['positions'] = json_encode($this->postData['positions']);
if (isset($this->postData['metadata'])) $this->postData['metadata'] = json_encode($this->postData['metadata']);
return true;
}
protected function beforeUpdate($postData): bool {
if (!$this->user->can('WarehouseAdmin')) {
$this->validate($postData, [
fn($p) => !in_array(WarehouseShippingNoteModel::get($p['id'])->status,
['accepted', 'invoiced']) ?: 'Änderungen nicht mehr möglich',
fn($p) => $this->validateHours($p['hoursEntries'])
]);
$this->validate($postData, [
fn($p) => !in_array(WarehouseShippingNoteModel::get($p['id'])->status,
['accepted', 'invoiced']) ?: 'Änderungen nicht mehr möglich',
fn($p) => $this->validateHours($p['hoursEntries'])
]);
}
$postData['positions'] = json_encode($postData['positions']);
$this->postData['positions'] = json_encode($this->postData['positions']);
if (isset($this->postData['metadata'])) $this->postData['metadata'] = json_encode($this->postData['metadata']);
(new WarehouseHistoryController)->create($postData, $this->mod);
return true;
}
@@ -743,7 +745,9 @@ class WarehouseShippingNoteController extends TTCrud {
return [
'date' => date('Y-m-d H:i:s', strtotime($eventStart)),
'location' => $event['location']['location'] ?? '',
'category' => $event['category']['category'] ?? ''
'category' => $event['category']['category'] ?? '',
'ccategory' => $event['ccategory']['ccategory'] ?? '',
'event_type' => $event['event_type']['event_type'] ?? '',
];
}, $limitedEvents);

View File

@@ -4,6 +4,7 @@ class WarehouseShippingNoteModel extends TTCrudBaseModel {
public int $id;
public ?int $billingAddressId;
public ?string $type;
public ?string $metadata;
public string $deliveryAddressName;
public string $deliveryAddressLine;
public string $deliveryAddressPLZ;
@@ -20,6 +21,4 @@ class WarehouseShippingNoteModel extends TTCrudBaseModel {
public ?int $eShopOrderId;
public ?int $create;
public ?int $createBy;
}
}