mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merg PDFs
This commit is contained in:
parent
e377861606
commit
9d09424e5e
@ -169,7 +169,7 @@ abstract class QueryFilters
|
|||||||
public function clientFilter()
|
public function clientFilter()
|
||||||
{
|
{
|
||||||
if (auth()->guard('contact')->user()) {
|
if (auth()->guard('contact')->user()) {
|
||||||
return $this->builder->whereClientId(auth()->guard('contact')->user()->client->id);
|
return $this->builder->where('client_id', auth()->guard('contact')->user()->client->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +179,15 @@ abstract class QueryFilters
|
|||||||
|
|
||||||
$created_at = date('Y-m-d H:i:s', $value);
|
$created_at = date('Y-m-d H:i:s', $value);
|
||||||
|
|
||||||
|
if(is_string($created_at)){
|
||||||
|
|
||||||
|
$created_at = strtotime(str_replace("/","-",$created_at));
|
||||||
|
|
||||||
|
if(!$created_at)
|
||||||
|
return $this->builder;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return $this->builder->where('created_at', '>=', $created_at);
|
return $this->builder->where('created_at', '>=', $created_at);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
app/Services/PdfMaker/PdfMerge.php
Normal file
40
app/Services/PdfMaker/PdfMerge.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Services\PdfMaker;
|
||||||
|
|
||||||
|
use \setasign\Fpdi\Fpdi;
|
||||||
|
|
||||||
|
class PdfMerge
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct(private array $file_paths) {}
|
||||||
|
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
|
||||||
|
$pdf = new FPDI();
|
||||||
|
|
||||||
|
foreach ($this->file_paths as $file) {
|
||||||
|
$pageCount = $pdf->setSourceFile($file);
|
||||||
|
for ($i = 0; $i < $pageCount; $i++) {
|
||||||
|
$tpl = $pdf->importPage($i + 1, '/MediaBox');
|
||||||
|
$pdf->addPage();
|
||||||
|
$pdf->useTemplate($tpl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pdf->Output('S');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user