* include user teams in user entity * prevent unauthorized access via API * improve teamlead permission handling in team timesheets * add team data to user entity * add security tests * highlight menu for invoice template copy * unified handling of invoice data across all templates * access to the current users data in invoice templates * permission improvement in invoice form * allow to skip record rows * allow to add new invoice locations without overwriting the global ones * allow to order user preferences * change permission for normal users with access to view_other_timesheets * properly validate invoice template field length * allow to replace multiple variables in cell values text * upgraded office invoice template * doctrine deprecation fix * upgrade phpoffice/phpword * fix future begin check for default rounding rules * dashboard widget counter: respect visibility and teams - fixes #1161 * fix future begin check for default rounding rules * added new events for pre and post invoice rendering * fix permission issue for users without team seeing all records * prevent error in spreadsheet renderer for empty invoices
306 lines
6.0 KiB
PHP
306 lines
6.0 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Kimai time-tracking app.
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
/**
|
|
* @ORM\Entity(repositoryClass="App\Repository\InvoiceTemplateRepository")
|
|
* @ORM\Table(name="kimai2_invoice_templates",
|
|
* uniqueConstraints={
|
|
* @ORM\UniqueConstraint(columns={"name"})
|
|
* }
|
|
* )
|
|
*/
|
|
class InvoiceTemplate
|
|
{
|
|
/**
|
|
* @var int
|
|
*
|
|
* @ORM\Column(name="id", type="integer")
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue(strategy="IDENTITY")
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="name", type="string", length=60, nullable=false)
|
|
* @Assert\NotBlank()
|
|
* @Assert\Length(min=1, max=60)
|
|
*/
|
|
private $name;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="title", type="string", length=255, nullable=false)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
private $title;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="company", type="string", length=255, nullable=false)
|
|
* @Assert\NotBlank()
|
|
*/
|
|
private $company;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="vat_id", type="string", length=50, nullable=true)
|
|
* @Assert\Length(max=50)
|
|
*/
|
|
private $vatId;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="address", type="text", nullable=true)
|
|
*/
|
|
private $address;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="contact", type="text", nullable=true)
|
|
*/
|
|
private $contact;
|
|
|
|
/**
|
|
* @var int
|
|
*
|
|
* @ORM\Column(name="due_days", type="integer", length=3, nullable=false)
|
|
* @Assert\Range(min = 0, max = 999)
|
|
*/
|
|
private $dueDays = 30;
|
|
|
|
/**
|
|
* @var float
|
|
*
|
|
* @ORM\Column(name="vat", type="float", nullable=false)
|
|
* @Assert\Range(min = 0.0, max = 99.99)
|
|
*/
|
|
private $vat = 0.00;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="calculator", type="string", length=20, nullable=false)
|
|
* @Assert\NotBlank()
|
|
* @Assert\Length(max=20)
|
|
*/
|
|
private $calculator = 'default';
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="number_generator", type="string", length=20, nullable=false)
|
|
* @Assert\NotBlank()
|
|
* @Assert\Length(max=20)
|
|
*/
|
|
private $numberGenerator = 'default';
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="renderer", type="string", length=20, nullable=false)
|
|
* @Assert\NotBlank()
|
|
* @Assert\Length(max=20)
|
|
*/
|
|
private $renderer = 'default';
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="payment_terms", type="text", nullable=true)
|
|
*/
|
|
private $paymentTerms;
|
|
|
|
/**
|
|
* @var string
|
|
*
|
|
* @ORM\Column(name="payment_details", type="text", nullable=true)
|
|
*/
|
|
private $paymentDetails;
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setName(string $name): InvoiceTemplate
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getName(): ?string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function getTitle(): ?string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setTitle(string $title): InvoiceTemplate
|
|
{
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAddress(): ?string
|
|
{
|
|
return $this->address;
|
|
}
|
|
|
|
public function setAddress(?string $address): InvoiceTemplate
|
|
{
|
|
$this->address = $address;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getNumberGenerator(): string
|
|
{
|
|
return $this->numberGenerator;
|
|
}
|
|
|
|
public function setNumberGenerator(string $numberGenerator): InvoiceTemplate
|
|
{
|
|
$this->numberGenerator = $numberGenerator;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDueDays(): int
|
|
{
|
|
return $this->dueDays;
|
|
}
|
|
|
|
public function setDueDays(int $dueDays): InvoiceTemplate
|
|
{
|
|
$this->dueDays = $dueDays;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getVat(): float
|
|
{
|
|
return $this->vat;
|
|
}
|
|
|
|
public function setVat(float $vat): InvoiceTemplate
|
|
{
|
|
$this->vat = $vat;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCompany(): ?string
|
|
{
|
|
return $this->company;
|
|
}
|
|
|
|
public function setCompany(string $company): InvoiceTemplate
|
|
{
|
|
$this->company = $company;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRenderer(): string
|
|
{
|
|
return $this->renderer;
|
|
}
|
|
|
|
public function setRenderer(string $renderer): InvoiceTemplate
|
|
{
|
|
$this->renderer = $renderer;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCalculator(): string
|
|
{
|
|
return $this->calculator;
|
|
}
|
|
|
|
public function setCalculator(string $calculator): InvoiceTemplate
|
|
{
|
|
$this->calculator = $calculator;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPaymentTerms(): ?string
|
|
{
|
|
return $this->paymentTerms;
|
|
}
|
|
|
|
public function setPaymentTerms(?string $paymentTerms): InvoiceTemplate
|
|
{
|
|
$this->paymentTerms = $paymentTerms;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getVatId(): ?string
|
|
{
|
|
return $this->vatId;
|
|
}
|
|
|
|
public function setVatId(?string $vatId): InvoiceTemplate
|
|
{
|
|
$this->vatId = $vatId;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getContact(): ?string
|
|
{
|
|
return $this->contact;
|
|
}
|
|
|
|
public function setContact(?string $contact): InvoiceTemplate
|
|
{
|
|
$this->contact = $contact;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPaymentDetails(): ?string
|
|
{
|
|
return $this->paymentDetails;
|
|
}
|
|
|
|
public function setPaymentDetails(?string $paymentDetails): InvoiceTemplate
|
|
{
|
|
$this->paymentDetails = $paymentDetails;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function __toString()
|
|
{
|
|
return $this->getName();
|
|
}
|
|
}
|