mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Update entity type:
- Default entity type is 'product' - Added type check - Fixed double slash in design path
This commit is contained in:
parent
a531019e3e
commit
8381d37431
@ -32,21 +32,26 @@ class Bold extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//bold.html')
|
||||
base_path('resources/views/pdf-designs/bold.html')
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -32,21 +32,26 @@ class Business extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//business.html')
|
||||
base_path('resources/views/pdf-designs/business.html')
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -32,7 +32,7 @@ class Clean extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html()
|
||||
@ -42,11 +42,16 @@ class Clean extends BaseDesign
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -32,21 +32,26 @@ class Creative extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//creative.html')
|
||||
base_path('resources/views/pdf-designs/creative.html')
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -32,7 +32,7 @@ class Elegant extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html()
|
||||
@ -42,11 +42,16 @@ class Elegant extends BaseDesign
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -32,7 +32,7 @@ class Hipster extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html()
|
||||
@ -42,11 +42,16 @@ class Hipster extends BaseDesign
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -32,7 +32,7 @@ class Modern extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html()
|
||||
@ -42,11 +42,16 @@ class Modern extends BaseDesign
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -32,7 +32,7 @@ class Plain extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html(): ?string
|
||||
@ -42,11 +42,16 @@ class Plain extends BaseDesign
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -32,7 +32,7 @@ class Playful extends BaseDesign
|
||||
/** Global state of the design, @var array */
|
||||
public $context;
|
||||
|
||||
/** Type of entity => invoice||quote */
|
||||
/** Type of entity => product||task */
|
||||
public $type;
|
||||
|
||||
public function html()
|
||||
@ -42,11 +42,16 @@ class Playful extends BaseDesign
|
||||
);
|
||||
}
|
||||
|
||||
public function elements(array $context, string $type = 'invoice'): array
|
||||
public function elements(array $context, string $type = 'product'): array
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type !== 'product' || $type !== 'task') {
|
||||
throw new \Exception("Type '{$type}' is not allowed. Allowed values are 'product' or 'task'.");
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
|
||||
return [
|
||||
|
@ -35,7 +35,7 @@ class ExampleIntegrationTest extends TestCase
|
||||
'variables' => $engine->generateLabelsAndValues(),
|
||||
];
|
||||
|
||||
$maker = new PdfMaker($state, 'invoice');
|
||||
$maker = new PdfMaker($state, 'product');
|
||||
|
||||
$maker
|
||||
->design(Plain::class)
|
||||
|
Loading…
Reference in New Issue
Block a user