mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:57:35 -05:00 
			
		
		
		
	QuotesController: Allow approving only quotes with STATUS_SENT
This commit is contained in:
		
							parent
							
								
									f35ed86299
								
							
						
					
					
						commit
						1a5c40d02e
					
				@ -24,6 +24,7 @@ use App\Utils\TempFile;
 | 
				
			|||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
use Illuminate\Contracts\View\Factory;
 | 
					use Illuminate\Contracts\View\Factory;
 | 
				
			||||||
use Illuminate\View\View;
 | 
					use Illuminate\View\View;
 | 
				
			||||||
 | 
					use Symfony\Component\HttpFoundation\BinaryFileResponse;
 | 
				
			||||||
use ZipStream\Option\Archive;
 | 
					use ZipStream\Option\Archive;
 | 
				
			||||||
use ZipStream\ZipStream;
 | 
					use ZipStream\ZipStream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -46,7 +47,7 @@ class QuoteController extends Controller
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param ShowQuoteRequest $request
 | 
					     * @param ShowQuoteRequest $request
 | 
				
			||||||
     * @param Quote $quote
 | 
					     * @param Quote $quote
 | 
				
			||||||
     * @return Factory|View|\Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
					     * @return Factory|View|BinaryFileResponse
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function show(ShowQuoteRequest $request, Quote $quote)
 | 
					    public function show(ShowQuoteRequest $request, Quote $quote)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -110,10 +111,12 @@ class QuoteController extends Controller
 | 
				
			|||||||
    protected function approve(array $ids, $process = false)
 | 
					    protected function approve(array $ids, $process = false)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $quotes = Quote::whereIn('id', $ids)
 | 
					        $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();
 | 
					            ->get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (! $quotes || $quotes->count() == 0) {
 | 
					        if (!$quotes || $quotes->count() == 0) {
 | 
				
			||||||
            return redirect()->route('client.quotes.index');
 | 
					            return redirect()->route('client.quotes.index');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user