mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Support for separate variable: all_page_header && all_page_footer
This commit is contained in:
parent
971a723607
commit
edbadabab4
@ -156,11 +156,13 @@ trait PdfMakerUtilities
|
|||||||
|
|
||||||
public function processOptions()
|
public function processOptions()
|
||||||
{
|
{
|
||||||
if (isset($this->options['repeat_header_and_footer']) && $this->options['repeat_header_and_footer']) {
|
if (!isset($this->options['all_page_header']) && !isset($this->options['all_page_footer'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->insertPrintCSS();
|
$this->insertPrintCSS();
|
||||||
$this->wrapIntoTable();
|
$this->wrapIntoTable();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function insertPrintCSS()
|
public function insertPrintCSS()
|
||||||
{
|
{
|
||||||
@ -256,7 +258,12 @@ trait PdfMakerUtilities
|
|||||||
$this->document->getElementById('repeat-content')->appendChild($clone);
|
$this->document->getElementById('repeat-content')->appendChild($clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($header = $this->document->getElementById('header')) {
|
if (
|
||||||
|
$header = $this->document->getElementById('header') &&
|
||||||
|
isset($this->data['options']['all_page_header']) &&
|
||||||
|
$this->data['options']['all_page_header']
|
||||||
|
) {
|
||||||
|
|
||||||
$header = $this->document->getElementById('header');
|
$header = $this->document->getElementById('header');
|
||||||
$clone = $header->cloneNode(true);
|
$clone = $header->cloneNode(true);
|
||||||
|
|
||||||
@ -264,7 +271,11 @@ trait PdfMakerUtilities
|
|||||||
$this->document->getElementById('repeat-header')->appendChild($clone);
|
$this->document->getElementById('repeat-header')->appendChild($clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($footer = $this->document->getElementById('footer')) {
|
if (
|
||||||
|
$footer = $this->document->getElementById('footer') &&
|
||||||
|
isset($this->data['options']['all_page_footer']) &&
|
||||||
|
$this->data['options']['all_page_footer']
|
||||||
|
) {
|
||||||
$footer = $this->document->getElementById('footer');
|
$footer = $this->document->getElementById('footer');
|
||||||
$clone = $footer->cloneNode(true);
|
$clone = $footer->cloneNode(true);
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
exec('echo "" > storage/logs/laravel.log');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBusiness()
|
public function testBusiness()
|
||||||
@ -137,16 +139,13 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
], $this->state['variables']),
|
], $this->state['variables']),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
$maker
|
$maker
|
||||||
->design(Business::class)
|
->design(Business::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
//exec('echo "" > storage/logs/laravel.log');
|
exec('echo "" > storage/logs/laravel.log');
|
||||||
|
|
||||||
info($maker->getCompiledHTML());
|
info($maker->getCompiledHTML());
|
||||||
|
|
||||||
@ -250,7 +249,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'variables' => array_merge([], $this->state['variables']),
|
'variables' => array_merge([], $this->state['variables']),
|
||||||
];
|
];
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
@ -258,8 +256,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
->design(Clean::class)
|
->design(Clean::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
//exec('echo "" > storage/logs/laravel.log');
|
|
||||||
|
|
||||||
info($maker->getCompiledHTML(true));
|
info($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
@ -366,7 +362,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'variables' => array_merge([], $this->state['variables']),
|
'variables' => array_merge([], $this->state['variables']),
|
||||||
];
|
];
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
@ -374,6 +369,8 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
->design(Modern::class)
|
->design(Modern::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
|
info($maker->getCompiledHTML());
|
||||||
|
|
||||||
//exec('echo "" > storage/logs/laravel.log');
|
//exec('echo "" > storage/logs/laravel.log');
|
||||||
|
|
||||||
//info($maker->getCompiledHTML(true));
|
//info($maker->getCompiledHTML(true));
|
||||||
@ -381,7 +378,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testBold()
|
public function testBold()
|
||||||
{
|
{
|
||||||
$state = [
|
$state = [
|
||||||
@ -483,7 +479,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'variables' => array_merge([], $this->state['variables']),
|
'variables' => array_merge([], $this->state['variables']),
|
||||||
];
|
];
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
@ -491,11 +486,7 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
->design(Bold::class)
|
->design(Bold::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
//exec('echo "" > storage/logs/laravel.log');
|
info($maker->getCompiledHTML());
|
||||||
|
|
||||||
//info($maker->getCompiledHTML(true));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
@ -593,7 +584,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'variables' => array_merge([], $this->state['variables']),
|
'variables' => array_merge([], $this->state['variables']),
|
||||||
];
|
];
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
@ -601,11 +591,9 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
->design(Plain::class)
|
->design(Plain::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
// exec('echo "" > storage/logs/laravel.log');
|
exec('echo "" > storage/logs/laravel.log');
|
||||||
|
|
||||||
// info($maker->getCompiledHTML(true));
|
|
||||||
|
|
||||||
|
|
||||||
|
info($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
@ -707,7 +695,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'variables' => array_merge([], $this->state['variables']),
|
'variables' => array_merge([], $this->state['variables']),
|
||||||
];
|
];
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
@ -715,10 +702,7 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
->design(Hipster::class)
|
->design(Hipster::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
// exec('echo "" > storage/logs/laravel.log');
|
info($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
// info($maker->getCompiledHTML(true));
|
|
||||||
|
|
||||||
|
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
@ -824,7 +808,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'variables' => array_merge([], $this->state['variables']),
|
'variables' => array_merge([], $this->state['variables']),
|
||||||
];
|
];
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
@ -832,10 +815,7 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
->design(Elegant::class)
|
->design(Elegant::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
// exec('echo "" > storage/logs/laravel.log');
|
info($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
// info($maker->getCompiledHTML(true));
|
|
||||||
|
|
||||||
|
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
@ -941,7 +921,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'variables' => array_merge([], $this->state['variables']),
|
'variables' => array_merge([], $this->state['variables']),
|
||||||
];
|
];
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
@ -949,11 +928,8 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
->design(Creative::class)
|
->design(Creative::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
// exec('echo "" > storage/logs/laravel.log');
|
|
||||||
|
|
||||||
// info($maker->getCompiledHTML(true));
|
|
||||||
|
|
||||||
|
|
||||||
|
info($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
@ -1052,7 +1028,6 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
],
|
],
|
||||||
'variables' => array_merge([], $this->state['variables']),
|
'variables' => array_merge([], $this->state['variables']),
|
||||||
];
|
];
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($state);
|
$maker = new PdfMaker($state);
|
||||||
|
|
||||||
@ -1060,11 +1035,7 @@ class PdfMakerDesignsTest extends TestCase
|
|||||||
->design(Playful::class)
|
->design(Playful::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
// exec('echo "" > storage/logs/laravel.log');
|
info($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
// info($maker->getCompiledHTML(true));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testDesignLoadsCorrectly()
|
public function testDesignLoadsCorrectly()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($this->state);
|
$maker = new PdfMaker($this->state);
|
||||||
|
|
||||||
$maker->design(ExampleDesign::class);
|
$maker->design(ExampleDesign::class);
|
||||||
@ -29,8 +27,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testHtmlDesignLoadsCorrectly()
|
public function testHtmlDesignLoadsCorrectly()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($this->state);
|
$maker = new PdfMaker($this->state);
|
||||||
|
|
||||||
$maker
|
$maker
|
||||||
@ -42,8 +38,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testGetSectionUtility()
|
public function testGetSectionUtility()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$maker = new PdfMaker($this->state);
|
$maker = new PdfMaker($this->state);
|
||||||
|
|
||||||
$maker
|
$maker
|
||||||
@ -55,8 +49,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testTableAttributesAreInjected()
|
public function testTableAttributesAreInjected()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
$state = [
|
$state = [
|
||||||
'template' => [
|
'template' => [
|
||||||
'product-table' => [
|
'product-table' => [
|
||||||
@ -93,8 +85,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testVariablesAreReplaced()
|
public function testVariablesAreReplaced()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
|
|
||||||
$state = [
|
$state = [
|
||||||
'template' => [
|
'template' => [
|
||||||
@ -133,8 +123,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testElementContentIsGenerated()
|
public function testElementContentIsGenerated()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
|
|
||||||
$state = [
|
$state = [
|
||||||
'template' => [
|
'template' => [
|
||||||
@ -184,8 +172,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testConditionalRenderingOfElements()
|
public function testConditionalRenderingOfElements()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
|
|
||||||
$maker1 = new PdfMaker([
|
$maker1 = new PdfMaker([
|
||||||
'template' => [
|
'template' => [
|
||||||
@ -226,8 +212,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testOrderingElements()
|
public function testOrderingElements()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
|
|
||||||
$maker = new PdfMaker([
|
$maker = new PdfMaker([
|
||||||
'template' => [
|
'template' => [
|
||||||
@ -286,8 +270,6 @@ class PdfMakerTest extends TestCase
|
|||||||
|
|
||||||
public function testGeneratingPdf()
|
public function testGeneratingPdf()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('STUB broken tests');
|
|
||||||
|
|
||||||
|
|
||||||
$state = [
|
$state = [
|
||||||
'template' => [
|
'template' => [
|
||||||
@ -375,7 +357,7 @@ class PdfMakerTest extends TestCase
|
|||||||
'values' => [],
|
'values' => [],
|
||||||
],
|
],
|
||||||
'options' => [
|
'options' => [
|
||||||
'repeat_header_and_footer' => true,
|
'all_page_footer' => true,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -385,6 +367,10 @@ class PdfMakerTest extends TestCase
|
|||||||
->design(ExampleDesign::class)
|
->design(ExampleDesign::class)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
|
exec('echo "" > storage/logs/laravel.log');
|
||||||
|
|
||||||
info($maker->getCompiledHTML(true));
|
info($maker->getCompiledHTML(true));
|
||||||
|
|
||||||
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,13 @@
|
|||||||
|
|
||||||
<body class="m-10">
|
<body class="m-10">
|
||||||
<div id="header">My awesome header! $title</div>
|
<div id="header">My awesome header! $title</div>
|
||||||
|
<div>1231
|
||||||
|
<div>
|
||||||
|
123123123
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<component>/dsadas</component>
|
||||||
|
<span>Hello world</span>
|
||||||
<table id="product-table"></table>
|
<table id="product-table"></table>
|
||||||
<div id="footer">My awesome footer</div>
|
<div id="footer">My awesome footer</div>
|
||||||
</body>
|
</body>
|
Loading…
x
Reference in New Issue
Block a user