1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4201 from turbo124/v5-stable

Fixes for custom designs
This commit is contained in:
David Bomba 2020-10-22 20:29:08 +11:00 committed by GitHub
commit 52a80c458e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 93 additions and 8 deletions

View File

@ -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();

View File

@ -55,7 +55,6 @@ class Kernel extends HttpKernel
'throttle:60,1',
'bindings',
'query_logging',
//\App\Http\Middleware\StartupCheck::class,
\App\Http\Middleware\Cors::class,
],
'contact' => [

View File

@ -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');
$template = new PdfMakerDesign(strtolower($design->name));
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);

View File

@ -59,6 +59,7 @@
"spatie/browsershot": "^3.37",
"staudenmeir/eloquent-has-many-deep": "^1.11",
"stripe/stripe-php": "^7.50",
"swooletw/laravel-swoole": "^2.6",
"turbo124/beacon": "^1",
"turbo124/laravel-gmail": "^5.0",
"webpatser/laravel-countries": "dev-master#75992ad"

83
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "152c174ecc48f87a2c7fd00335c6fc86",
"content-hash": "08ae0ebd522fae2599454303710f08b1",
"packages": [
{
"name": "asgrim/ofxparser",
@ -6497,6 +6497,85 @@
],
"time": "2019-11-12T09:31:26+00:00"
},
{
"name": "swooletw/laravel-swoole",
"version": "v2.6.68",
"source": {
"type": "git",
"url": "https://github.com/swooletw/laravel-swoole.git",
"reference": "4167206bfbaea752264c814cac5c2172e72a400a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swooletw/laravel-swoole/zipball/4167206bfbaea752264c814cac5c2172e72a400a",
"reference": "4167206bfbaea752264c814cac5c2172e72a400a",
"shasum": ""
},
"require": {
"illuminate/console": "~5.4|~6.0|~7.0|~8.0",
"illuminate/contracts": "~5.4|~6.0|~7.0|~8.0",
"illuminate/http": "~5.4|~6.0|~7.0|~8.0",
"illuminate/support": "~5.4|~6.0|~7.0|~8.0",
"php": "^7.2",
"predis/predis": "^1.1"
},
"require-dev": {
"codedungeon/phpunit-result-printer": "^0.14.0",
"laravel/lumen-framework": "~5.4|~6.0|~7.0|~8.0",
"mockery/mockery": "~1.0",
"php-coveralls/php-coveralls": "^2.1",
"php-mock/php-mock": "^2.0",
"phpunit/php-code-coverage": "^6.1",
"phpunit/phpunit": "^7.5",
"swoole/ide-helper": "@dev"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"SwooleTW\\Http\\LaravelServiceProvider"
],
"aliases": {
"Server": "SwooleTW\\Http\\Server\\Facades\\Server",
"Table": "SwooleTW\\Http\\Server\\Facades\\Table",
"Room": "SwooleTW\\Http\\Websocket\\Facades\\Room",
"Websocket": "SwooleTW\\Http\\Websocket\\Facades\\Websocket"
}
}
},
"autoload": {
"files": [
"src/Server/helpers.php"
],
"psr-4": {
"SwooleTW\\Http\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Albert Chen",
"email": "albert@unisharp.com"
},
{
"name": "Huang Yi",
"email": "coodeer@163.com"
}
],
"description": "High performance HTTP server based on Swoole. Speed up your Laravel and Lumen applications.",
"keywords": [
"http",
"laravel",
"lumen",
"performance",
"server",
"swoole"
],
"time": "2020-09-21T10:06:50+00:00"
},
{
"name": "symfony/console",
"version": "v5.1.7",
@ -6588,7 +6667,7 @@
"type": "tidelift"
}
],
"time": "2020-10-07T15:23:00+00:00"
"time": "2020-09-18T14:27:32+00:00"
},
{
"name": "symfony/css-selector",

View File

@ -181,6 +181,8 @@ return [
App\Providers\MultiDBProvider::class,
App\Providers\ClientPortalServiceProvider::class,
App\Providers\NinjaTranslationServiceProvider::class,
SwooleTW\Http\LaravelServiceProvider::class,
],
/*