added hourly and money budgets to activity, project and customer (#843)
This commit is contained in:
@@ -71,6 +71,7 @@ class Activity
|
||||
// keep the trait include exactly here, for placing the column at the correct position
|
||||
use RatesTrait;
|
||||
use ColorTrait;
|
||||
use BudgetTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
68
src/Entity/BudgetTrait.php
Normal file
68
src/Entity/BudgetTrait.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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;
|
||||
|
||||
trait BudgetTrait
|
||||
{
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="budget", type="float", precision=10, scale=2, nullable=false)
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
private $budget = 0.00;
|
||||
|
||||
/**
|
||||
* Time budget in seconds.
|
||||
*
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="time_budget", type="integer", precision=10, scale=2, nullable=false)
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
private $timeBudget = 0;
|
||||
|
||||
/**
|
||||
* @param float $budget
|
||||
* @return self
|
||||
*/
|
||||
public function setBudget(?float $budget)
|
||||
{
|
||||
$this->budget = $budget;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getBudget()
|
||||
{
|
||||
return $this->budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $seconds
|
||||
* @return self
|
||||
*/
|
||||
public function setTimeBudget(?int $seconds)
|
||||
{
|
||||
$this->timeBudget = $seconds;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimeBudget(): int
|
||||
{
|
||||
return $this->timeBudget;
|
||||
}
|
||||
}
|
||||
@@ -152,6 +152,7 @@ class Customer
|
||||
// keep the trait include exactly here, for placing the column at the correct position
|
||||
use RatesTrait;
|
||||
use ColorTrait;
|
||||
use BudgetTrait;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -70,14 +70,6 @@ class Project
|
||||
*/
|
||||
private $visible = true;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="budget", type="float", precision=10, scale=2, nullable=false)
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
private $budget = 0.00;
|
||||
|
||||
/**
|
||||
* @var Activity[]|ArrayCollection
|
||||
*
|
||||
@@ -88,6 +80,7 @@ class Project
|
||||
// keep the trait include exactly here, for placing the column at the correct position
|
||||
use RatesTrait;
|
||||
use ColorTrait;
|
||||
use BudgetTrait;
|
||||
|
||||
/**
|
||||
* @var Timesheet[]|ArrayCollection
|
||||
@@ -162,25 +155,6 @@ class Project
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $budget
|
||||
* @return Project
|
||||
*/
|
||||
public function setBudget($budget): Project
|
||||
{
|
||||
$this->budget = $budget;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getBudget()
|
||||
{
|
||||
return $this->budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<Timesheet>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user