Merge branch 'features/activity-type' into features/activity-form

This commit is contained in:
Jean-Francois Monfort
2021-04-15 14:10:46 +02:00
66 changed files with 2779 additions and 583 deletions

View File

@@ -43,7 +43,7 @@ class ActivityType
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id;
private ?int $id;
/**
* @ORM\Column(type="json_array")
@@ -113,12 +113,12 @@ class ActivityType
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
*/
private int $thirdpartyVisible = self::FIELD_INVISIBLE;
private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
/**
* @ORM\Column(type="string", nullable=false, options={"default"=""})
*/
private string $thirdpartyLabel = '';
private string $thirdPartiesLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
@@ -173,12 +173,12 @@ class ActivityType
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
*/
private int $documentVisible = self::FIELD_OPTIONAL;
private int $documentsVisible = self::FIELD_OPTIONAL;
/**
* @ORM\Column(type="string", nullable=false, options={"default"=""})
*/
private string $documentLabel = '';
private string $documentsLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
@@ -221,7 +221,7 @@ class ActivityType
/**
* Set name
*/
public function setName(string $name): self
public function setName(array $name): self
{
$this->name = $name;
@@ -230,26 +230,10 @@ class ActivityType
/**
* Get name
*
* @return array | string
*/
public function getName(?string $locale = null)
public function getName(): array
{
// TODO
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
} else {
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
}
return '';
} else {
return $this->name;
}
return $this->name;
}
/**
@@ -391,24 +375,24 @@ class ActivityType
$this->personsLabel = $personsLabel;
}
public function getThirdpartyVisible(): int
public function getThirdPartiesVisible(): int
{
return $this->thirdpartyVisible;
return $this->thirdPartiesVisible;
}
public function setThirdpartyVisible(int $thirdpartyVisible): void
public function setThirdPartiesVisible(int $thirdPartiesVisible): void
{
$this->thirdpartyVisible = $thirdpartyVisible;
$this->thirdPartiesVisible = $thirdPartiesVisible;
}
public function getThirdpartyLabel(): string
public function getThirdPartiesLabel(): string
{
return $this->thirdpartyLabel;
return $this->thirdPartiesLabel;
}
public function setThirdpartyLabel(string $thirdpartyLabel): void
public function setThirdPartiesLabel(string $thirdPartiesLabel): void
{
$this->thirdpartyLabel = $thirdpartyLabel;
$this->thirdPartiesLabel = $thirdPartiesLabel;
}
public function getDurationTimeVisible(): int
@@ -511,24 +495,24 @@ class ActivityType
$this->sentReceivedLabel = $sentReceivedLabel;
}
public function getDocumentVisible(): int
public function getDocumentsVisible(): int
{
return $this->documentVisible;
return $this->documentsVisible;
}
public function setDocumentVisible(int $documentVisible): void
public function setDocumentsVisible(int $documentsVisible): void
{
$this->documentVisible = $documentVisible;
$this->documentsVisible = $documentsVisible;
}
public function getDocumentLabel(): string
public function getDocumentsLabel(): string
{
return $this->documentLabel;
return $this->documentsLabel;
}
public function setDocumentLabel(string $documentLabel): void
public function setDocumentsLabel(string $documentsLabel): void
{
$this->documentLabel = $documentLabel;
$this->documentsLabel = $documentsLabel;
}
public function getEmergencyVisible(): int

View File

@@ -22,10 +22,6 @@ class ActivityTypeType extends AbstractType
$this->translatableStringHelper = $translatableStringHelper;
}
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
@@ -46,12 +42,11 @@ class ActivityTypeType extends AbstractType
;
$fields = [
'person', 'user', 'date', 'place', 'persons',
'thirdparty', 'durationTime', 'attendee',
'reasons', 'comment', 'sentReceived', 'document',
'persons', 'user', 'date', 'place', 'persons',
'thirdParties', 'durationTime', 'attendee',
'reasons', 'comment', 'sentReceived', 'documents',
'emergency', 'accompanyingPeriod', 'socialData'
];
foreach ($fields as $field) {
$builder
->add($field.'Visible', ActivityFieldPresence::class)
@@ -62,9 +57,6 @@ class ActivityTypeType extends AbstractType
}
}
/**
* @param OptionsResolverInterface $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(

View File

@@ -46,12 +46,7 @@
<td>{{ activity.durationTime|date('H:i') }}</td>
<td>
{% if activity.comment.comment is not empty %}
<blockquote class="chill-user-quote">
{{ activity.comment.comment|slice(0, 250) }} {#
sf4 check: if 'slice' could replace 'truncate' filter ?
truncate come with twig-extensions, in conflict with twig 3
#}
</blockquote>
{{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
{% endif %}
{%- if activity.reasons is empty -%}
{{ 'No reason associated'|trans }}

View File

@@ -13,7 +13,7 @@
{% if is_granted(constant('Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter::SEE_DETAILS'), activity) %}
<dl class="chill_view_data">
<dd>{% if activity.comment.comment is empty %}{{ 'No comments'|trans }}{% else %}<blockquote class="chill-user-quote">{{ activity.comment.comment|nl2br }}</blockquote>{% endif %}</dd>
<dd>{% if activity.comment.comment is empty %}{{ 'No comments'|trans }}{% else %}{{ activity.comment|chill_entity_render_box({'metadata': false}) }}{% endif %}</dd>
<dt class="inline">{{ 'Reasons'|trans }}</dt>
{%- if activity.reasons is empty -%}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210415113216 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql('ALTER TABLE activitytype ADD thirdPartiesVisible SMALLINT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD thirdPartiesLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD documentsVisible SMALLINT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD documentsLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
$this->addSql('ALTER TABLE activitytype DROP thirdpartyvisible');
$this->addSql('ALTER TABLE activitytype DROP thirdpartylabel');
$this->addSql('ALTER TABLE activitytype DROP documentvisible');
$this->addSql('ALTER TABLE activitytype DROP documentlabel');
}
public function down(Schema $schema) : void
{
$this->addSql('ALTER TABLE activitytype ADD thirdpartyvisible SMALLINT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD thirdpartylabel VARCHAR(255) DEFAULT \'\' NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD documentvisible SMALLINT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE activitytype ADD documentlabel VARCHAR(255) DEFAULT \'\' NOT NULL');
$this->addSql('ALTER TABLE activitytype DROP thirdPartiesVisible');
$this->addSql('ALTER TABLE activitytype DROP thirdPartiesLabel');
$this->addSql('ALTER TABLE activitytype DROP documentsVisible');
$this->addSql('ALTER TABLE activitytype DROP documentsLabel');
}
}