This commit is contained in:
seb
2026-10-15 20:14:54 +02:00
parent e462a3d250
commit 508e1b6d7a
18 changed files with 859 additions and 333 deletions

View File

@@ -15,6 +15,8 @@ function requireSelectedCompany(req) {
function quoteErrorStatus(error) {
if (error.message === 'No company selected') return 400;
if (error.message === 'No entity selected') return 400;
if (error.message === 'Entity required') return 400;
if (error.message === 'Not authorized') return 403;
if (error.message === 'Company not found') return 404;
if (error.message === 'Quote not found') return 404;
@@ -581,8 +583,10 @@ export function register(app, basePath = '') {
* summary: Create order from quote
* description: |
* Creates a sales order from an existing quote for the authenticated user's selected company.
* Copies lines, customer entity, and external number from the quote unless explicitly overridden.
* Copies lines and customer entity from the quote.
* Sets external reference (externalNumber) to the quote number unless explicitly overridden.
* If the order number is omitted, it is auto-allocated from the sequence.
* Fails with 400 (No entity selected) if neither the quote nor the request body specifies a customer entity.
* security:
* - cookieAuth: []
* parameters:
@@ -616,7 +620,7 @@ export function register(app, basePath = '') {
* externalNumber:
* type: string
* nullable: true
* description: External customer reference override. Defaults to quote's externalNumber.
* description: External customer reference override. Defaults to quote's number.
* lines:
* type: array
* description: Optional line items override. Defaults to quote's lines.
@@ -634,7 +638,7 @@ export function register(app, basePath = '') {
* order:
* $ref: '#/components/schemas/Order'
* 400:
* description: No company selected, invalid quote id, or invalid order data
* description: No company selected, no entity selected, invalid quote id, or invalid order data
* content:
* application/json:
* schema: