mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles
This commit is contained in:
commit
a72acbe008
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
.composer/*
|
.composer/*
|
||||||
|
composer
|
||||||
composer.phar
|
composer.phar
|
||||||
composer.lock
|
composer.lock
|
||||||
docs/build/
|
docs/build/
|
||||||
|
@ -11,10 +11,15 @@ and this project adheres to
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
* [workflow]: Fixed: the notification is sent when the user is added to the first step.
|
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
|
|
||||||
|
### 2.0.0-beta2
|
||||||
|
|
||||||
|
* [workflow]: Fixed: the notification is sent when the user is added to the first step.
|
||||||
|
* [budget] Feature: allow to desactivate some charges and resources, adding an `active` key in the configuration
|
||||||
|
* [person] Feature: on Evaluation, allow to configure an URL from the admin
|
||||||
|
|
||||||
### 2022-06
|
### 2022-06
|
||||||
|
|
||||||
* [workflow]: added pagination to workflow list page
|
* [workflow]: added pagination to workflow list page
|
||||||
|
@ -29,44 +29,58 @@ class ConfigRepository
|
|||||||
$this->charges = $charges;
|
$this->charges = $charges;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChargesKeys(): array
|
public function getChargesKeys(bool $onlyActive = false): array
|
||||||
{
|
{
|
||||||
return array_map(static function ($element) { return $element['key']; }, $this->charges);
|
return array_map(static function ($element) { return $element['key']; }, $this->getCharges($onlyActive));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array where keys are the resource'key and label the ressource label
|
* @return array where keys are the resource'key and label the ressource label
|
||||||
*/
|
*/
|
||||||
public function getChargesLabels()
|
public function getChargesLabels(bool $onlyActive = false)
|
||||||
{
|
{
|
||||||
$charges = [];
|
$charges = [];
|
||||||
|
|
||||||
foreach ($this->charges as $definition) {
|
foreach ($this->getCharges($onlyActive) as $definition) {
|
||||||
$charges[$definition['key']] = $this->normalizeLabel($definition['labels']);
|
$charges[$definition['key']] = $this->normalizeLabel($definition['labels']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $charges;
|
return $charges;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResourcesKeys(): array
|
public function getResourcesKeys(bool $onlyActive = false): array
|
||||||
{
|
{
|
||||||
return array_map(static function ($element) { return $element['key']; }, $this->resources);
|
return array_map(static function ($element) { return $element['key']; }, $this->getResources($onlyActive));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array where keys are the resource'key and label the ressource label
|
* @return array where keys are the resource'key and label the ressource label
|
||||||
*/
|
*/
|
||||||
public function getResourcesLabels()
|
public function getResourcesLabels(bool $onlyActive = false)
|
||||||
{
|
{
|
||||||
$resources = [];
|
$resources = [];
|
||||||
|
|
||||||
foreach ($this->resources as $definition) {
|
foreach ($this->getResources($onlyActive) as $definition) {
|
||||||
$resources[$definition['key']] = $this->normalizeLabel($definition['labels']);
|
$resources[$definition['key']] = $this->normalizeLabel($definition['labels']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $resources;
|
return $resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getCharges(bool $onlyActive = false): array
|
||||||
|
{
|
||||||
|
return $onlyActive ?
|
||||||
|
array_filter($this->charges, function ($el) { return $el['active']; })
|
||||||
|
: $this->charges;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getResources(bool $onlyActive = false): array
|
||||||
|
{
|
||||||
|
return $onlyActive ?
|
||||||
|
array_filter($this->resources, function ($el) { return $el['active']; })
|
||||||
|
: $this->resources;
|
||||||
|
}
|
||||||
|
|
||||||
private function normalizeLabel($labels)
|
private function normalizeLabel($labels)
|
||||||
{
|
{
|
||||||
$normalizedLabels = [];
|
$normalizedLabels = [];
|
||||||
|
@ -14,11 +14,6 @@ namespace Chill\BudgetBundle\DependencyInjection;
|
|||||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the class that validates and merges configuration from your app/config files.
|
|
||||||
*
|
|
||||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
|
|
||||||
*/
|
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder()
|
||||||
@ -37,6 +32,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->info('the key stored in database')
|
->info('the key stored in database')
|
||||||
->example('salary')
|
->example('salary')
|
||||||
->end()
|
->end()
|
||||||
|
->booleanNode('active')->defaultTrue()->end()
|
||||||
->arrayNode('labels')->isRequired()->requiresAtLeastOneElement()
|
->arrayNode('labels')->isRequired()->requiresAtLeastOneElement()
|
||||||
->arrayPrototype()
|
->arrayPrototype()
|
||||||
->children()
|
->children()
|
||||||
@ -59,6 +55,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->info('the key stored in database')
|
->info('the key stored in database')
|
||||||
->example('salary')
|
->example('salary')
|
||||||
->end()
|
->end()
|
||||||
|
->booleanNode('active')->defaultTrue()->end()
|
||||||
->arrayNode('labels')->isRequired()->requiresAtLeastOneElement()
|
->arrayNode('labels')->isRequired()->requiresAtLeastOneElement()
|
||||||
->arrayPrototype()
|
->arrayPrototype()
|
||||||
->children()
|
->children()
|
||||||
|
@ -103,7 +103,7 @@ class ChargeType extends AbstractType
|
|||||||
private function getTypes()
|
private function getTypes()
|
||||||
{
|
{
|
||||||
$charges = $this->configRepository
|
$charges = $this->configRepository
|
||||||
->getChargesLabels();
|
->getChargesLabels(true);
|
||||||
|
|
||||||
// rewrite labels to filter in language
|
// rewrite labels to filter in language
|
||||||
foreach ($charges as $key => $labels) {
|
foreach ($charges as $key => $labels) {
|
||||||
|
@ -87,7 +87,7 @@ class ResourceType extends AbstractType
|
|||||||
private function getTypes()
|
private function getTypes()
|
||||||
{
|
{
|
||||||
$resources = $this->configRepository
|
$resources = $this->configRepository
|
||||||
->getResourcesLabels();
|
->getResourcesLabels(true);
|
||||||
|
|
||||||
// rewrite labels to filter in language
|
// rewrite labels to filter in language
|
||||||
foreach ($resources as $key => $labels) {
|
foreach ($resources as $key => $labels) {
|
||||||
|
@ -16,6 +16,7 @@ use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
@ -40,6 +41,10 @@ class EvaluationType extends AbstractType
|
|||||||
->add('title', TranslatableStringFormType::class, [
|
->add('title', TranslatableStringFormType::class, [
|
||||||
'label' => 'Nom',
|
'label' => 'Nom',
|
||||||
])
|
])
|
||||||
|
->add('url', UrlType::class, [
|
||||||
|
'label' => 'evaluation.url',
|
||||||
|
'required' => false,
|
||||||
|
])
|
||||||
->add('delay', DateIntervalType::class, [
|
->add('delay', DateIntervalType::class, [
|
||||||
'label' => 'evaluation.delay',
|
'label' => 'evaluation.delay',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
@ -675,6 +675,7 @@ origin:
|
|||||||
evaluation:
|
evaluation:
|
||||||
delay: Délai
|
delay: Délai
|
||||||
notificationDelay: Délai de notification
|
notificationDelay: Délai de notification
|
||||||
|
url: Lien internet
|
||||||
|
|
||||||
goal:
|
goal:
|
||||||
desactivationDate: Date de désactivation
|
desactivationDate: Date de désactivation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user