diff --git a/src/forms/PaymentFormFactory.php b/src/forms/PaymentFormFactory.php index 15fece7..d229add 100644 --- a/src/forms/PaymentFormFactory.php +++ b/src/forms/PaymentFormFactory.php @@ -89,15 +89,21 @@ public function create($paymentId, IRow $user = null) $defaults = $payment->toArray(); $items = []; foreach ($payment->related('payment_items')->fetchAll() as $item) { - $items[] = [ + $item = [ 'amount' => $item->amount, 'count' => $item->count, 'name' => $item->name, 'vat' => $item->vat, 'type' => $item->type, - 'postal_fee_id' => $item->postal_fee_id, - 'product_id' => $item->product_id, ]; + // TODO: temporary solution until whole form is refactored and fields handled by dataproviders + if (array_key_exists('postal_fee_idx', $item)) { + $item['postal_fee_idx'] = $item->postal_fee_id; + } + if (array_key_exists('product_idx', $item)) { + $item['product_idx'] = $item->product_id; + } + $items[] = $item; } $defaults['payment_items'] = Json::encode($items);