mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 14:54:34 -04:00
Fixes for converting a quote to invoice (#3727)
This commit is contained in:
parent
8ab0238f3f
commit
afbb605af5
@ -528,6 +528,21 @@ class QuoteController extends BaseController
|
|||||||
return response()->json(['message' => 'Email Sent!'], 200);
|
return response()->json(['message' => 'Email Sent!'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($action == 'convert') {
|
||||||
|
|
||||||
|
$this->entity_type = Invoice::class;
|
||||||
|
$this->entity_transformer = InvoiceTransformer::class;
|
||||||
|
|
||||||
|
$invoices = $quotes->map(function ($quote, $key) use ($action) {
|
||||||
|
if (auth()->user()->can('edit', $quote)) {
|
||||||
|
$invoice = $quote->service()->convertToInvoice();
|
||||||
|
return $invoice->id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return $this->listResponse(Invoice::withTrashed()->whereIn('id', $invoices)->company());
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send the other actions to the switch
|
* Send the other actions to the switch
|
||||||
*/
|
*/
|
||||||
@ -642,14 +657,6 @@ class QuoteController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->itemResponse($quote->service()->approve()->save());
|
return $this->itemResponse($quote->service()->approve()->save());
|
||||||
break;
|
|
||||||
case 'convert':
|
|
||||||
|
|
||||||
$this->entity_type = Invoice::class;
|
|
||||||
$this->entity_transformer = InvoiceTransformer::class;
|
|
||||||
|
|
||||||
return $this->itemResponse($quote->service()->convertToInvoice());
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'history':
|
case 'history':
|
||||||
# code...
|
# code...
|
||||||
|
@ -134,12 +134,11 @@ class QuoteService
|
|||||||
$invoice->number = null;
|
$invoice->number = null;
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
|
|
||||||
$invoice->service()
|
return $invoice->service()
|
||||||
->markSent()
|
->markSent()
|
||||||
->createInvitations()
|
->createInvitations()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
return $invoice;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user