Fixes for customised language options for Preview Controller

This commit is contained in:
David Bomba 2020-12-13 10:20:03 +11:00
parent 0f861554f0
commit 8abce54d7e
3 changed files with 16 additions and 8 deletions

View File

@ -101,8 +101,6 @@ class Handler extends ExceptionHandler
private function validException($exception)
{
info("the exception is ");
info($exception->getMessage());
if(strpos($exception->getMessage(), 'file_put_contents') === TRUE)
return FALSE;
@ -110,6 +108,10 @@ class Handler extends ExceptionHandler
if(strpos($exception->getMessage(), 'Permission denied') === TRUE)
return FALSE;
if(strpos($exception->getMessage(), 'flock()') === TRUE)
return FALSE;
return TRUE;
}

View File

@ -132,7 +132,7 @@ class EmailController extends BaseController
}
});
$entity_obj->service()->markSent()->save();
$entity_obj = $entity_obj->service()->markSent()->save();
$entity_obj->last_sent_date = now();
$entity_obj->save();
@ -172,8 +172,6 @@ class EmailController extends BaseController
$this->entity_transformer = RecurringInvoiceTransformer::class;
}
$entity_obj->service()->markSent()->save();
return $this->itemResponse($entity_obj);
}
}

View File

@ -20,11 +20,14 @@ use App\Models\InvoiceInvitation;
use App\Services\PdfMaker\Design;
use App\Services\PdfMaker\PdfMaker;
use App\Utils\HtmlEngine;
use App\Utils\Ninja;
use App\Utils\PhantomJS\Phantom;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesInvoiceHtml;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Lang;
class PreviewController extends BaseController
{
@ -96,15 +99,16 @@ class PreviewController extends BaseController
$entity_obj->load('client');
App::setLocale($entity_obj->client->primary_contact()->preferredLocale());
App::forgetInstance('translator');
Lang::replace(Ninja::transformTranslations($entity_obj->client->getMergedSettings()));
$html = new HtmlEngine($entity_obj->invitations()->first());
$design_namespace = 'App\Services\PdfMaker\Designs\\'.request()->design['name'];
$design_class = new $design_namespace();
// $designer = new Designer($entity_obj, $design_object, $entity_obj->client->getSetting('pdf_variables'), lcfirst($entity));
// $html = $this->generateEntityHtml($designer, $entity_obj);
$state = [
'template' => $design_class->elements([
'client' => $entity_obj->client,
@ -141,6 +145,10 @@ class PreviewController extends BaseController
private function blankEntity()
{
App::forgetInstance('translator');
Lang::replace(Ninja::transformTranslations(auth()->user()->company()->settings));
DB::beginTransaction();
$client = Client::factory()->create([