added internal rates (#1591)
This commit is contained in:
@@ -38,7 +38,6 @@ class Activity implements EntityWithMetaFields
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var Project|null
|
||||
*
|
||||
@@ -46,25 +45,20 @@ class Activity implements EntityWithMetaFields
|
||||
* @ORM\JoinColumn(onDelete="CASCADE")
|
||||
*/
|
||||
private $project;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* Do not increase length to more than 190 chars, otherwise "Index column size too large." will be triggered.
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=150, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* @Assert\Length(min=2, max=150)
|
||||
* @Assert\Length(min=2, max=150, allowEmptyString=false)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="comment", type="text", nullable=true)
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*
|
||||
|
||||
@@ -37,7 +37,8 @@ class Configuration
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=100, nullable=false)
|
||||
* @Assert\Length(min=2, max=100)
|
||||
* @Assert\NotNull()
|
||||
* @Assert\Length(min=2, max=100, allowEmptyString=false)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
||||
@@ -36,18 +36,14 @@ class Customer implements EntityWithMetaFields
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* Do not increase length to more than 190 chars, otherwise "Index column size too large." will be triggered.
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=150, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* @Assert\Length(min=2, max=150)
|
||||
* @Assert\Length(min=2, max=150, allowEmptyString=false)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -55,14 +51,12 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=50)
|
||||
*/
|
||||
private $number;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="comment", type="text", nullable=true)
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*
|
||||
@@ -70,7 +64,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
private $visible = true;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -78,7 +71,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=255)
|
||||
*/
|
||||
private $company;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -86,7 +78,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=50)
|
||||
*/
|
||||
private $vatId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -94,14 +85,12 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=255)
|
||||
*/
|
||||
private $contact;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="address", type="text", nullable=true)
|
||||
*/
|
||||
private $address;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -110,7 +99,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=2)
|
||||
*/
|
||||
private $country;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -119,7 +107,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=3)
|
||||
*/
|
||||
private $currency = self::DEFAULT_CURRENCY;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -127,7 +114,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=255)
|
||||
*/
|
||||
private $phone;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -135,7 +121,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=255)
|
||||
*/
|
||||
private $fax;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -143,7 +128,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=255)
|
||||
*/
|
||||
private $mobile;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -153,7 +137,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=254)
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -161,7 +144,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @Assert\Length(max=255)
|
||||
*/
|
||||
private $homepage;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -183,7 +165,6 @@ class Customer implements EntityWithMetaFields
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\CustomerMeta", mappedBy="customer", cascade={"persist"})
|
||||
*/
|
||||
private $meta;
|
||||
|
||||
/**
|
||||
* @var Team[]|ArrayCollection
|
||||
*
|
||||
|
||||
@@ -36,7 +36,7 @@ class InvoiceTemplate
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=60, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* @Assert\Length(min=1, max=60)
|
||||
* @Assert\Length(min=1, max=60, allowEmptyString=false)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ trait MetaTableTypeTrait
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=50, nullable=false)
|
||||
* @Assert\Length(min=2, max=50)
|
||||
* @Assert\NotNull()
|
||||
* @Assert\Length(min=2, max=50, allowEmptyString=false)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
||||
@@ -48,11 +48,9 @@ class Project implements EntityWithMetaFields
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* Do not increase length to more than 190 chars, otherwise "Index column size too large." will be triggered.
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=150, nullable=false)
|
||||
* @Assert\NotNull()
|
||||
* @Assert\Length(min=2, max=150)
|
||||
* @Assert\Length(min=2, max=150, allowEmptyString=false)
|
||||
*/
|
||||
private $name;
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Swagger\Annotations as SWG;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
trait Rate
|
||||
@@ -27,6 +28,7 @@ trait Rate
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\User")
|
||||
* @ORM\JoinColumn(onDelete="CASCADE", nullable=true)
|
||||
* @SWG\Property(ref="#/definitions/User")
|
||||
*/
|
||||
private $user;
|
||||
/**
|
||||
@@ -36,6 +38,12 @@ trait Rate
|
||||
* @Assert\GreaterThanOrEqual(0)
|
||||
*/
|
||||
private $rate = 0.00;
|
||||
/**
|
||||
* @var float|null
|
||||
*
|
||||
* @ORM\Column(name="internal_rate", type="float", nullable=true)
|
||||
*/
|
||||
private $internalRate;
|
||||
/**
|
||||
* @var bool
|
||||
*
|
||||
@@ -78,6 +86,18 @@ trait Rate
|
||||
return $this->rate;
|
||||
}
|
||||
|
||||
public function setInternalRate(?float $rate): self
|
||||
{
|
||||
$this->internalRate = $rate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInternalRate(): ?float
|
||||
{
|
||||
return $this->internalRate;
|
||||
}
|
||||
|
||||
public function isFixed(): bool
|
||||
{
|
||||
return $this->isFixed;
|
||||
|
||||
@@ -9,12 +9,17 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
interface RateInterface
|
||||
{
|
||||
public function getUser(): ?User;
|
||||
|
||||
public function getRate(): float;
|
||||
|
||||
public function getInternalRate(): ?float;
|
||||
|
||||
public function isFixed(): bool;
|
||||
|
||||
public function getScore(): int;
|
||||
|
||||
@@ -39,7 +39,7 @@ class Tag
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=100, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* @Assert\Length(min=2, max=100)
|
||||
* @Assert\Length(min=2, max=100, allowEmptyString=false)
|
||||
* @Assert\Regex(pattern="/,/",match=false,message="Tag name cannot contain comma")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
@@ -39,7 +39,7 @@ class Team
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=100, nullable=false)
|
||||
* @Assert\NotBlank()
|
||||
* @Assert\Length(min=2, max=100)
|
||||
* @Assert\Length(min=2, max=100, allowEmptyString=false)
|
||||
*/
|
||||
private $name;
|
||||
/**
|
||||
|
||||
@@ -131,7 +131,14 @@ class Timesheet implements EntityWithMetaFields, ExportItemInterface
|
||||
private $rate = 0.00;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
* @var float|null
|
||||
*
|
||||
* @ORM\Column(name="internal_rate", type="float", nullable=true)
|
||||
*/
|
||||
private $internalRate;
|
||||
|
||||
/**
|
||||
* @var float|null
|
||||
*
|
||||
* @ORM\Column(name="fixed_rate", type="float", nullable=true)
|
||||
* @Assert\GreaterThanOrEqual(0)
|
||||
@@ -363,6 +370,18 @@ class Timesheet implements EntityWithMetaFields, ExportItemInterface
|
||||
return $this->rate;
|
||||
}
|
||||
|
||||
public function setInternalRate(?float $rate): Timesheet
|
||||
{
|
||||
$this->internalRate = $rate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInternalRate(): ?float
|
||||
{
|
||||
return $this->internalRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
* @return Timesheet
|
||||
|
||||
@@ -27,6 +27,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
class UserPreference
|
||||
{
|
||||
public const HOURLY_RATE = 'hourly_rate';
|
||||
public const INTERNAL_RATE = 'internal_rate';
|
||||
public const SKIN = 'skin';
|
||||
public const LOCALE = 'language';
|
||||
public const TIMEZONE = 'timezone';
|
||||
@@ -51,7 +52,8 @@ class UserPreference
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=50, nullable=false)
|
||||
* @Assert\Length(min=2, max=50)
|
||||
* @Assert\NotNull()
|
||||
* @Assert\Length(min=2, max=50, allowEmptyString=false)
|
||||
*/
|
||||
private $name;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user