mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
fix merge conflicts
This commit is contained in:
@@ -25,7 +25,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_merge;
|
||||
|
||||
@@ -140,4 +140,29 @@ final class ThirdPartyController extends CRUDController
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $action
|
||||
* @param ThirdParty $entity
|
||||
*/
|
||||
protected function onPostFetchEntity($action, Request $request, $entity): ?Response
|
||||
{
|
||||
if ('view' === $action && $entity->getParent() instanceof ThirdParty) {
|
||||
$params = [
|
||||
'id' => $entity->getParent()->getId(),
|
||||
];
|
||||
|
||||
if ($request->query->has('returnPath')) {
|
||||
$params['returnPath'] = $request->query->get('returnPath');
|
||||
}
|
||||
|
||||
if ($request->query->has('returnLabel')) {
|
||||
$params['returnLabel'] = $request->query->get('returnLabel');
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('chill_crud_3party_3party_view', $params);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -45,6 +45,41 @@ 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
|
||||
*
|
||||
* @see{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
|
||||
* @see{Chill\ThirdPartyBundle\Form\Type\PickThirdPartyDynamicType} does not support it yet, but
|
||||
* the legacy @see{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,
|
||||
])
|
||||
|
@@ -22,7 +22,7 @@ use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_diff;
|
||||
use function array_merge;
|
||||
|
@@ -15,7 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* Add an entry in section to go to third party index page.
|
||||
|
@@ -40,16 +40,16 @@
|
||||
<div class="form-check">
|
||||
<input class="form-check-input mt-0" type="radio" v-model="kind" value="contact" id="tpartyKindContact">
|
||||
<label for="tpartyKindContact" class="required">
|
||||
<badge-entity
|
||||
:entity="{ type: 'thirdparty', kind: 'contact' }"
|
||||
:options="{ displayLong: true }">
|
||||
</badge-entity>
|
||||
<badge-entity
|
||||
:entity="{ type: 'thirdparty', kind: 'contact' }"
|
||||
:options="{ displayLong: true }">
|
||||
</badge-entity>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<third-party-render-box
|
||||
:thirdparty="thirdparty"
|
||||
<p>Contact de :</p>
|
||||
<third-party-render-box :thirdparty="thirdparty.parent"
|
||||
:options="{
|
||||
addInfo: true,
|
||||
addEntity: false,
|
||||
@@ -118,7 +118,7 @@
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="phonenumber"><i class="fa fa-fw fa-phone"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="thirdparty.telephone"
|
||||
v-model="thirdparty.phonenumber"
|
||||
v-bind:placeholder="$t('thirdparty.phonenumber')"
|
||||
v-bind:aria-label="$t('thirdparty.phonenumber')"
|
||||
aria-describedby="phonenumber" />
|
||||
|
@@ -23,15 +23,15 @@
|
||||
{{ form_row(form.contactDataAnonymous) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.address is defined %}
|
||||
{{ form_row(form.address) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.activeChildren is defined %}
|
||||
<h2>{{ 'Contacts'|trans }}</h2>
|
||||
{{ form_widget(form.activeChildren) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.address is defined %}
|
||||
{{ form_row(form.address) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.comment) }}
|
||||
|
||||
{% if form.centers is defined %}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
Chill\ThirdPartyBundle\Menu\MenuBuilder:
|
||||
arguments:
|
||||
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
|
||||
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
|
||||
tags:
|
||||
- { name: 'chill.menu_builder' }
|
||||
|
Reference in New Issue
Block a user