mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 11:24:34 -04:00
Minor fixes
This commit is contained in:
parent
c5d94a7c2e
commit
46a459b5a0
@ -374,11 +374,20 @@ class PreviewController extends BaseController
|
|||||||
// 'projects' => Project::query()->company()->with('tasks','client')->where('client_id', $client_id)->orderBy('id','desc')->take(2)->get(),
|
// 'projects' => Project::query()->company()->with('tasks','client')->where('client_id', $client_id)->orderBy('id','desc')->take(2)->get(),
|
||||||
// ];
|
// ];
|
||||||
|
|
||||||
|
|
||||||
$ts = (new TemplateService());
|
$ts = (new TemplateService());
|
||||||
$ts->setCompany($company)
|
try {
|
||||||
->setTemplate($design_object)
|
$ts->setCompany($company)
|
||||||
->mock();
|
->setTemplate($design_object)
|
||||||
|
->mock();
|
||||||
|
}
|
||||||
|
catch(\Twig\Error\SyntaxError $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
// return response()->json(['message' => 'Twig syntax is invalid.', 'errors' => new \stdClass], 422);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$html = $ts->getHtml();
|
$html = $ts->getHtml();
|
||||||
|
|
||||||
if (request()->query('html') == 'true') {
|
if (request()->query('html') == 'true') {
|
||||||
|
@ -21,10 +21,9 @@ use Illuminate\Http\Request;
|
|||||||
*/
|
*/
|
||||||
class UserVerified
|
class UserVerified
|
||||||
{
|
{
|
||||||
public $user;
|
public function __construct(public ?User $user)
|
||||||
|
|
||||||
public function __construct(?User $user)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->user = property_exists($user, 'id') ? $user : auth()->user();
|
$this->user = property_exists($user, 'id') ? $user : auth()->user();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ use App\Utils\Traits\MakesDates;
|
|||||||
use Twig\Extra\Intl\IntlExtension;
|
use Twig\Extra\Intl\IntlExtension;
|
||||||
use App\Transformers\TaskTransformer;
|
use App\Transformers\TaskTransformer;
|
||||||
use App\Transformers\QuoteTransformer;
|
use App\Transformers\QuoteTransformer;
|
||||||
|
use App\Services\Template\TemplateMock;
|
||||||
use App\Transformers\CreditTransformer;
|
use App\Transformers\CreditTransformer;
|
||||||
use App\Transformers\InvoiceTransformer;
|
use App\Transformers\InvoiceTransformer;
|
||||||
use App\Transformers\PaymentTransformer;
|
use App\Transformers\PaymentTransformer;
|
||||||
@ -146,11 +147,18 @@ class TemplateService
|
|||||||
|
|
||||||
$template = $content->ownerDocument->saveHTML($content);
|
$template = $content->ownerDocument->saveHTML($content);
|
||||||
|
|
||||||
$template = $this->twig->createTemplate(html_entity_decode($template));
|
try {
|
||||||
|
$template = $this->twig->createTemplate(html_entity_decode($template));
|
||||||
|
}
|
||||||
|
catch(\Twig\Error\SyntaxError $e) {
|
||||||
|
nlog($e->getMessage());
|
||||||
|
throw ($e);
|
||||||
|
}
|
||||||
|
|
||||||
$template = $template->render($this->data);
|
$template = $template->render($this->data);
|
||||||
|
|
||||||
$f = $this->document->createDocumentFragment();
|
$f = $this->document->createDocumentFragment();
|
||||||
nlog($template);
|
|
||||||
$f->appendXML(html_entity_decode($template));
|
$f->appendXML(html_entity_decode($template));
|
||||||
$replacements[] = $f;
|
$replacements[] = $f;
|
||||||
|
|
||||||
|
12
composer.lock
generated
12
composer.lock
generated
@ -13813,16 +13813,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "turbo124/beacon",
|
"name": "turbo124/beacon",
|
||||||
"version": "v1.5.1",
|
"version": "v1.5.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/turbo124/beacon.git",
|
"url": "https://github.com/turbo124/beacon.git",
|
||||||
"reference": "a737499198a3aff2d194d4f2a4c834257187d9b8"
|
"reference": "4f08b91d3f9326e42f664e667d84100dc8afe752"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/turbo124/beacon/zipball/a737499198a3aff2d194d4f2a4c834257187d9b8",
|
"url": "https://api.github.com/repos/turbo124/beacon/zipball/4f08b91d3f9326e42f664e667d84100dc8afe752",
|
||||||
"reference": "a737499198a3aff2d194d4f2a4c834257187d9b8",
|
"reference": "4f08b91d3f9326e42f664e667d84100dc8afe752",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -13869,9 +13869,9 @@
|
|||||||
"turbo124"
|
"turbo124"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/turbo124/beacon/tree/v1.5.1"
|
"source": "https://github.com/turbo124/beacon/tree/v1.5.2"
|
||||||
},
|
},
|
||||||
"time": "2023-09-24T07:20:04+00:00"
|
"time": "2023-10-01T07:13:02+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "twig/intl-extra",
|
"name": "twig/intl-extra",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user