mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:07:33 -05:00 
			
		
		
		
	Merge pull request #4195 from Striffly/fix/invoice-preview
Fix invoice preview with custom designs
This commit is contained in:
		
						commit
						1e3617b27a
					
				@ -196,8 +196,6 @@ class PreviewController extends BaseController
 | 
			
		||||
            ->design($design)
 | 
			
		||||
            ->build();
 | 
			
		||||
 | 
			
		||||
        info($maker->getCompiledHTML(true));
 | 
			
		||||
 | 
			
		||||
        $file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());
 | 
			
		||||
 | 
			
		||||
        DB::rollBack();
 | 
			
		||||
 | 
			
		||||
@ -19,6 +19,7 @@ use App\Libraries\MultiDB;
 | 
			
		||||
use App\Models\ClientContact;
 | 
			
		||||
use App\Models\Company;
 | 
			
		||||
use App\Models\Design;
 | 
			
		||||
use App\Services\PdfMaker\Design as PdfDesignModel;
 | 
			
		||||
use App\Models\Invoice;
 | 
			
		||||
use App\Services\PdfMaker\Design as PdfMakerDesign;
 | 
			
		||||
use App\Services\PdfMaker\PdfMaker as PdfMakerService;
 | 
			
		||||
@ -87,7 +88,14 @@ class CreateInvoicePdf implements ShouldQueue
 | 
			
		||||
        $design = Design::find($invoice_design_id);
 | 
			
		||||
        $html = new HtmlEngine(null, $this->invitation, 'invoice');
 | 
			
		||||
 | 
			
		||||
        if ($design->is_custom) {
 | 
			
		||||
          $options = [
 | 
			
		||||
            'custom_partials' => json_decode(json_encode($design->design), true)
 | 
			
		||||
          ];
 | 
			
		||||
          $template = new PdfMakerDesign(PdfDesignModel::CUSTOM, $options);
 | 
			
		||||
        } else {
 | 
			
		||||
          $template = new PdfMakerDesign(strtolower($design->name));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $state = [
 | 
			
		||||
            'template' => $template->elements([
 | 
			
		||||
@ -109,8 +117,6 @@ class CreateInvoicePdf implements ShouldQueue
 | 
			
		||||
            ->design($template)
 | 
			
		||||
            ->build();
 | 
			
		||||
 | 
			
		||||
        info($maker->getCompiledHTML());
 | 
			
		||||
 | 
			
		||||
        //todo - move this to the client creation stage so we don't keep hitting this unnecessarily
 | 
			
		||||
        Storage::makeDirectory($path, 0775);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user