diff --git a/services/nginx/app/objects/collected_order_invoices_o.php b/services/nginx/app/objects/collected_order_invoices_o.php index f163988e..5a5e2778 100644 --- a/services/nginx/app/objects/collected_order_invoices_o.php +++ b/services/nginx/app/objects/collected_order_invoices_o.php @@ -73,7 +73,7 @@ class collected_order_invoices_o extends db public function asArray(): array { - return [ + $tmp = [ 'id' => (int)$this->id, 'customer_number' => (int)$this->customer_number->value(), 'name' => (string)$this->name->value(), @@ -84,9 +84,15 @@ class collected_order_invoices_o extends db 'updated_at' => (string)$this->updated_at->value(), 'closed_at' => (string)$this->closed_at->value(), 'orders' => $this->getOrders(), - 'economic_invoice_draft_id' => self::isDraftExisting() ? self::getInvoiceDraftId() : null, - 'economic_invoice_booked_id' => self::isBooked() ? self::getInvoiceBookedId() : null, + 'economic_invoice_draft_id' => null, // This will be overwritten if the external id is set + 'economic_invoice_booked_id' => null, // This will be overwritten if the external id is set ]; + // If the external id is set, get the invoice draft id + if (!empty($this->external_id->value())) { + $tmp['economic_invoice_draft_id'] = self::isDraftExisting() ? self::getInvoiceDraftId() : null; + $tmp['economic_invoice_booked_id'] = self::isBooked() ? self::getInvoiceBookedId() : null; + } + return $tmp; } /** diff --git a/services/nginx/app/routes/productOptionsRoute.php b/services/nginx/app/routes/productOptionsRoute.php index 57a2f187..fcd5ee76 100644 --- a/services/nginx/app/routes/productOptionsRoute.php +++ b/services/nginx/app/routes/productOptionsRoute.php @@ -32,6 +32,9 @@ class productOptionsRoute 'id', 'product_id', 'option_id', + 'name', + 'created_at', + 'updated_at' ]) ->listObjectsWithPaginationIfSet( function ($option) use ($user) { @@ -40,6 +43,7 @@ class productOptionsRoute 'id' => (int)$option['id'], 'product_id' => (int)$option['product_id'], 'option_id' => (int)$option['option_id'], + 'name' => (string)$option['name'], 'created_at' => (string)$option['created_at'], 'updated_at' => (string)$option['updated_at'], ];