rounding rules via admin screen, round begin when starting record (#1229)

This commit is contained in:
Kevin Papst
2019-11-10 13:57:05 +01:00
committed by GitHub
parent fa1c79e15c
commit c6c4098759
47 changed files with 1100 additions and 185 deletions

View File

@@ -9,6 +9,7 @@
namespace App\Controller;
use App\Entity\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController as BaseAbstractController;
use Symfony\Component\Translation\DataCollectorTranslator;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
@@ -36,6 +37,14 @@ abstract class AbstractController extends BaseAbstractController implements Serv
return $this->container->get('translator');
}
/**
* @return User|null
*/
protected function getUser()
{
return parent::getUser();
}
/**
* Adds a "successful" flash message to the stack.
*

View File

@@ -16,8 +16,10 @@ use App\Form\Model\SystemConfiguration as SystemConfigurationModel;
use App\Form\SystemConfigurationForm;
use App\Form\Type\EnhancedSelectboxType;
use App\Form\Type\LanguageType;
use App\Form\Type\RoundingModeType;
use App\Form\Type\SkinType;
use App\Form\Type\TrackingModeType;
use App\Form\Type\WeekDaysType;
use App\Repository\ConfigurationRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -215,6 +217,39 @@ class SystemConfigurationController extends AbstractController
new GreaterThanOrEqual(['value' => 1])
]),
]),
(new SystemConfigurationModel())
->setSection(SystemConfigurationModel::SECTION_ROUNDING)
->setConfiguration([
(new Configuration())
->setName('timesheet.rounding.default.mode')
->setType(RoundingModeType::class)
->setTranslationDomain('system-configuration'),
(new Configuration())
->setName('timesheet.rounding.default.begin')
->setType(IntegerType::class)
->setTranslationDomain('system-configuration')
->setConstraints([
new GreaterThanOrEqual(['value' => 0])
]),
(new Configuration())
->setName('timesheet.rounding.default.end')
->setType(IntegerType::class)
->setTranslationDomain('system-configuration')
->setConstraints([
new GreaterThanOrEqual(['value' => 0])
]),
(new Configuration())
->setName('timesheet.rounding.default.duration')
->setType(IntegerType::class)
->setTranslationDomain('system-configuration')
->setConstraints([
new GreaterThanOrEqual(['value' => 0])
]),
(new Configuration())
->setName('timesheet.rounding.default.days')
->setType(WeekDaysType::class)
->setTranslationDomain('system-configuration'),
]),
(new SystemConfigurationModel())
->setSection(SystemConfigurationModel::SECTION_FORM_CUSTOMER)
->setConfiguration([

View File

@@ -178,7 +178,6 @@ abstract class TimesheetAbstractController extends AbstractController
{
$entry = new Timesheet();
$entry->setUser($this->getUser());
$entry->setBegin($this->dateTime->createDateTime());
if ($request->query->get('project')) {
$project = $projectRepository->find($request->query->get('project'));