mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Merge remote-tracking branch 'origin/master' into thirdparty/redirect-to-parent-when-child-is-viewed
This commit is contained in:
@@ -45,6 +45,40 @@ use function spl_object_hash;
|
||||
* all users with the right 'CHILL_3PARTY_3PARTY_SEE', 'CHILL_3PARTY_3 to see, select and edit parties for this
|
||||
* center.
|
||||
*
|
||||
* A ThirdParty may have:
|
||||
*
|
||||
* * 0, one or more categories;
|
||||
* * 0, one or more type
|
||||
* * 1 kind.
|
||||
*
|
||||
* ## Kind
|
||||
*
|
||||
* The kind indicate if a thirdparty is a:
|
||||
*
|
||||
* * company ("personne morale");
|
||||
* * a contact ("personne morale")
|
||||
* * a child inside a company ("contact" in French). Only companies may have childs
|
||||
*
|
||||
* **take care** the french translation may lead to misinterpretation, as the string "contact" is the translation of
|
||||
* kind "child".
|
||||
*
|
||||
* ## Categories and types
|
||||
*
|
||||
* ThirdParty may have zero, one or more categories and/or type.
|
||||
*
|
||||
* Categories are managed in the database. The Chill administrator may create or desactivate categories.
|
||||
*
|
||||
* Types are also a way to categorize the thirdparties, but this is done **into the code**, through
|
||||
* @link{Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeProviderInterface}. The type is stored into the
|
||||
* database by a Php array, mapped by a jsonb into the database. This has one advantage: it is easily searchable.
|
||||
*
|
||||
* As the list of type is hardcoded into database, it is more easily searchable. (for chill 2.0, the
|
||||
* @link{Chill\ThirdPartyBundle\Form\Type\PickThirdPartyDynamicType} does not support it yet, but
|
||||
* the legacy @link{Chill\ThirdPartyBundle\Form\Type\PickThirdPartyType} does.
|
||||
*
|
||||
* The difference between categories and types is transparent for user: they choose the same fields into the UI, without
|
||||
* noticing a difference.
|
||||
*
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="chill_3party.third_party")
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
|
@@ -11,11 +11,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\ThirdPartyBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Entity\Civility;
|
||||
use Chill\MainBundle\Form\Type\ChillCollectionType;
|
||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||
use Chill\MainBundle\Form\Type\PickAddressType;
|
||||
use Chill\MainBundle\Form\Type\PickCenterType;
|
||||
use Chill\MainBundle\Form\Type\PickCivilityType;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
@@ -101,16 +101,8 @@ class ThirdPartyType extends AbstractType
|
||||
// Contact Person ThirdParty (child)
|
||||
if (ThirdParty::KIND_CONTACT === $options['kind'] || ThirdParty::KIND_CHILD === $options['kind']) {
|
||||
$builder
|
||||
->add('civility', EntityType::class, [
|
||||
->add('civility', PickCivilityType::class, [
|
||||
'label' => 'thirdparty.Civility',
|
||||
'class' => Civility::class,
|
||||
'choice_label' => function (Civility $civility): string {
|
||||
return $this->translatableStringHelper->localize($civility->getName());
|
||||
},
|
||||
'query_builder' => static function (EntityRepository $er): QueryBuilder {
|
||||
return $er->createQueryBuilder('c')
|
||||
->where('c.active = true');
|
||||
},
|
||||
'placeholder' => 'thirdparty.choose civility',
|
||||
'required' => false,
|
||||
])
|
||||
|
Reference in New Issue
Block a user