mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Purchase order decorators
This commit is contained in:
parent
36a7290679
commit
73bb2c96db
@ -111,7 +111,7 @@ class InvitationController extends Controller
|
|||||||
|
|
||||||
// $file = CreateRawPdf::dispatchNow($invitation, $invitation->company->db);
|
// $file = CreateRawPdf::dispatchNow($invitation, $invitation->company->db);
|
||||||
|
|
||||||
$file = (new CreatePurchaseOrderPdf($invitation))->handle();
|
$file = (new CreatePurchaseOrderPdf($invitation))->rawPdf();
|
||||||
|
|
||||||
$headers = ['Content-Type' => 'application/pdf'];
|
$headers = ['Content-Type' => 'application/pdf'];
|
||||||
|
|
||||||
|
45
app/Jobs/Vendor/CreatePurchaseOrderPdf.php
vendored
45
app/Jobs/Vendor/CreatePurchaseOrderPdf.php
vendored
@ -88,6 +88,32 @@ class CreatePurchaseOrderPdf implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
$pdf = $this->rawPdf();
|
||||||
|
|
||||||
|
if ($pdf) {
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
if(!Storage::disk($this->disk)->exists($path))
|
||||||
|
Storage::disk($this->disk)->makeDirectory($path, 0775);
|
||||||
|
|
||||||
|
Storage::disk($this->disk)->put($file_path, $pdf, 'public');
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(\Exception $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw new FilePermissionsFailure($e->getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rawPdf()
|
||||||
{
|
{
|
||||||
|
|
||||||
MultiDB::setDb($this->company->db);
|
MultiDB::setDb($this->company->db);
|
||||||
@ -191,25 +217,8 @@ class CreatePurchaseOrderPdf implements ShouldQueue
|
|||||||
info($maker->getCompiledHTML());
|
info($maker->getCompiledHTML());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pdf) {
|
return $pdf;
|
||||||
|
|
||||||
try{
|
|
||||||
|
|
||||||
if(!Storage::disk($this->disk)->exists($path))
|
|
||||||
Storage::disk($this->disk)->makeDirectory($path, 0775);
|
|
||||||
|
|
||||||
Storage::disk($this->disk)->put($file_path, $pdf, 'public');
|
|
||||||
|
|
||||||
}
|
|
||||||
catch(\Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
throw new FilePermissionsFailure($e->getMessage());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $file_path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function failed($e)
|
public function failed($e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user