1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

QuotesController: Allow approving only quotes with STATUS_SENT

This commit is contained in:
Benjamin Beganović 2021-07-05 13:57:11 +02:00
parent f35ed86299
commit 1a5c40d02e

View File

@ -24,6 +24,7 @@ use App\Utils\TempFile;
use App\Utils\Traits\MakesHash;
use Illuminate\Contracts\View\Factory;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
@ -46,7 +47,7 @@ class QuoteController extends Controller
*
* @param ShowQuoteRequest $request
* @param Quote $quote
* @return Factory|View|\Symfony\Component\HttpFoundation\BinaryFileResponse
* @return Factory|View|BinaryFileResponse
*/
public function show(ShowQuoteRequest $request, Quote $quote)
{
@ -110,10 +111,12 @@ class QuoteController extends Controller
protected function approve(array $ids, $process = false)
{
$quotes = Quote::whereIn('id', $ids)
->whereClientId(auth()->user()->client->id)
->where('client_id', auth('contact')->user()->client->id)
->where('company_id', auth('contact')->user()->client->company_id)
->where('status_id', Quote::STATUS_SENT)
->get();
if (! $quotes || $quotes->count() == 0) {
if (!$quotes || $quotes->count() == 0) {
return redirect()->route('client.quotes.index');
}