Merge branch 'master' into 292_activity_acl

This commit is contained in:
2021-12-13 09:13:43 +01:00
35 changed files with 357 additions and 172 deletions

View File

@@ -163,16 +163,6 @@ class ActivityType
*/
private int $personVisible = self::FIELD_REQUIRED;
/**
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
private string $placeLabel = '';
/**
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*/
private int $placeVisible = self::FIELD_OPTIONAL;
/**
* @ORM\Column(type="string", nullable=false, options={"default": ""})
*/
@@ -406,16 +396,6 @@ class ActivityType
return $this->personVisible;
}
public function getPlaceLabel(): string
{
return $this->placeLabel;
}
public function getPlaceVisible(): int
{
return $this->placeVisible;
}
public function getReasonsLabel(): string
{
return $this->reasonsLabel;
@@ -688,20 +668,6 @@ class ActivityType
return $this;
}
public function setPlaceLabel(string $placeLabel): self
{
$this->placeLabel = $placeLabel;
return $this;
}
public function setPlaceVisible(int $placeVisible): self
{
$this->placeVisible = $placeVisible;
return $this;
}
public function setReasonsLabel(string $reasonsLabel): self
{
$this->reasonsLabel = $reasonsLabel;

View File

@@ -143,7 +143,7 @@ class ActivityType extends AbstractType
return array_map(
fn (string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
explode(',', (string) $socialIssuesAsString)
explode(',', $socialIssuesAsString)
);
}
));
@@ -169,7 +169,7 @@ class ActivityType extends AbstractType
return array_map(
fn (string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
explode(',', (string) $socialActionsAsString)
explode(',', $socialActionsAsString)
);
}
));
@@ -260,9 +260,13 @@ class ActivityType extends AbstractType
return implode(',', $personIds);
},
function (?string $personsAsString): array {
if (null === $personsAsString) {
return [];
}
return array_map(
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
explode(',', (string) $personsAsString)
explode(',', $personsAsString)
);
}
));
@@ -282,9 +286,13 @@ class ActivityType extends AbstractType
return implode(',', $thirdpartyIds);
},
function (?string $thirdpartyAsString): array {
if (null === $thirdpartyAsString) {
return [];
}
return array_map(
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
explode(',', (string) $thirdpartyAsString)
explode(',', $thirdpartyAsString)
);
}
));
@@ -315,9 +323,13 @@ class ActivityType extends AbstractType
return implode(',', $userIds);
},
function (?string $usersAsString): array {
if (null === $usersAsString) {
return [];
}
return array_map(
fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
explode(',', (string) $usersAsString)
explode(',', $usersAsString)
);
}
));

View File

@@ -55,7 +55,7 @@ class ActivityTypeType extends AbstractType
]);
$fields = [
'persons', 'user', 'date', 'place', 'persons',
'persons', 'user', 'date', 'location', 'persons',
'thirdParties', 'durationTime', 'travelTime', 'attendee',
'reasons', 'comment', 'sentReceived', 'documents',
'emergency', 'socialIssues', 'socialActions', 'users',

View File

@@ -31,6 +31,8 @@ class ActivityRepository extends ServiceEntityRepository
}
/**
* @deprecated use @see{ActivityACLAwareRepositoryInterface::findByAccompanyingPeriod}
*
* @return Activity[]
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array

View File

@@ -0,0 +1,34 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20211207152023 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException('placevisible and placelabel could not be created');
}
public function getDescription(): string
{
return 'DROP place visible and place label, which are replaced by location';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE activitytype DROP placevisible');
$this->addSql('ALTER TABLE activitytype DROP placelabel');
}
}

View File

@@ -146,8 +146,8 @@ User visible: Visibilité du champ Utilisateur
User label: Libellé du champ Utilisateur
Date visible: Visibilité du champ Date
Date label: Libellé du champ Date
Place visible: Visibilité du champ Lieu
Place label: Libellé du champ Lieu
Location visible: Visibilité du champ Lieu
Location label: Libellé du champ Lieu
Third parties visible: Visibilité du champ Tiers
Third parties label: Libellé du champ Tiers
Duration time visible: Visibilité du champ Durée