mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-24 07:35:03 +00:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
c0ae2f8ed9
|
|||
cd7a80b680 | |||
27f797d736
|
|||
471898e6d8
|
|||
146103e87c
|
|||
45724100d4 | |||
9d2dfbe610
|
|||
70e6aee3c5 | |||
6c16967cdc
|
|||
4359c2dddc
|
|||
c8bab1218f | |||
72f5b0b275 | |||
60aeb57c45 |
3
.changes/v2.2.1.md
Normal file
3
.changes/v2.2.1.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## v2.2.1 - 2023-06-19
|
||||
### Fixed
|
||||
* ([#114](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/114)) [notification on document evaluation] fix entityId and return path when adding a notification on a document in an evaluation
|
5
.changes/v2.2.2.md
Normal file
5
.changes/v2.2.2.md
Normal file
@@ -0,0 +1,5 @@
|
||||
## v2.2.2 - 2023-06-26
|
||||
### Fixed
|
||||
* [Accompanying period comments]: order comments from the most recent to the oldest, in the list
|
||||
* Api: filter social action to keep only the currently activated
|
||||
* ([#82](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/82)) Fix deletion and re-creation of filiation relationship
|
@@ -6,7 +6,7 @@ versionExt: md
|
||||
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
|
||||
kindFormat: '### {{.Kind}}'
|
||||
changeFormat: >-
|
||||
* {{ if not (eq .Custom.Issue "") }}([#{{ .Custom.Issue }}](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/{{ .Custom.Issue }})) {{- end }}{{.Body}}
|
||||
* {{ if not (eq .Custom.Issue "") }}([#{{ .Custom.Issue }}](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/{{ .Custom.Issue }})) {{ end }}{{.Body}}
|
||||
custom:
|
||||
- key: Issue
|
||||
label: Issue number (on chill-bundles repository) (optional)
|
||||
|
@@ -34,6 +34,7 @@ variables:
|
||||
stages:
|
||||
- Composer install
|
||||
- Tests
|
||||
- Deploy
|
||||
|
||||
build:
|
||||
stage: Composer install
|
||||
@@ -121,3 +122,14 @@ unit_tests:
|
||||
paths:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
|
||||
release:
|
||||
stage: Deploy
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
script:
|
||||
- echo "running release_job"
|
||||
release:
|
||||
tag_name: '$CI_COMMIT_TAG'
|
||||
description: "./.changes/v$CI_COMMIT_TAG.md"
|
||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@@ -6,6 +6,16 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
|
||||
|
||||
## v2.2.2 - 2023-06-26
|
||||
### Fixed
|
||||
* [Accompanying period comments]: order comments from the most recent to the oldest, in the list
|
||||
* Api: filter social action to keep only the currently activated
|
||||
* ([#82](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/82)) Fix deletion and re-creation of filiation relationship
|
||||
|
||||
## v2.2.1 - 2023-06-19
|
||||
### Fixed
|
||||
* ([#114](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/114)) [notification on document evaluation] fix entityId and return path when adding a notification on a document in an evaluation
|
||||
|
||||
## v2.2.0 - 2023-06-18
|
||||
### Feature
|
||||
* When navigating from a workflow regarding to an evaluation's document to an accompanying course, scroll directly to the document, and blink to highlight this document
|
||||
|
@@ -0,0 +1,20 @@
|
||||
const buildLinkCreate = function (relatedEntityClass: string, relatedEntityId: number, to: number | null, returnPath: string | null): string
|
||||
{
|
||||
const params = new URLSearchParams();
|
||||
params.append('entityClass', relatedEntityClass);
|
||||
params.append('entityId', relatedEntityId.toString());
|
||||
|
||||
if (null !== to) {
|
||||
params.append('tos[0]', to.toString());
|
||||
}
|
||||
|
||||
if (null !== returnPath) {
|
||||
params.append('returnPath', returnPath);
|
||||
}
|
||||
|
||||
return `/fr/notification/create?${params.toString()}`;
|
||||
}
|
||||
|
||||
export {
|
||||
buildLinkCreate,
|
||||
}
|
@@ -16,21 +16,19 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Serializer\Model\Collection;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||
use Symfony\Component\Clock\ClockInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use function count;
|
||||
|
||||
class SocialWorkSocialActionApiController extends ApiController
|
||||
final class SocialWorkSocialActionApiController extends ApiController
|
||||
{
|
||||
private PaginatorFactory $paginator;
|
||||
|
||||
private SocialIssueRepository $socialIssueRepository;
|
||||
|
||||
public function __construct(SocialIssueRepository $socialIssueRepository, PaginatorFactory $paginator)
|
||||
{
|
||||
$this->socialIssueRepository = $socialIssueRepository;
|
||||
$this->paginator = $paginator;
|
||||
public function __construct(
|
||||
private readonly SocialIssueRepository $socialIssueRepository,
|
||||
private readonly PaginatorFactory $paginator,
|
||||
private readonly ClockInterface $clock,
|
||||
) {
|
||||
}
|
||||
|
||||
public function listBySocialIssueApi($id, Request $request)
|
||||
@@ -42,7 +40,10 @@ class SocialWorkSocialActionApiController extends ApiController
|
||||
throw $this->createNotFoundException('socialIssue not found');
|
||||
}
|
||||
|
||||
$socialActions = $socialIssue->getRecursiveSocialActions()->toArray();
|
||||
$socialActions = SocialAction::filterRemoveDeactivatedActions(
|
||||
$socialIssue->getRecursiveSocialActions()->toArray(),
|
||||
\DateTime::createFromImmutable($this->clock->now())
|
||||
);
|
||||
|
||||
usort($socialActions, static fn (SocialAction $sa, SocialAction $sb) => $sa->getOrdering() <=> $sb->getOrdering());
|
||||
|
||||
|
@@ -185,7 +185,9 @@ class AccompanyingPeriod implements
|
||||
* cascade={"persist", "remove"},
|
||||
* orphanRemoval=true
|
||||
* )
|
||||
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
|
||||
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_DRAFT})
|
||||
* @var Collection<Comment>
|
||||
*/
|
||||
private Collection $comments;
|
||||
|
||||
@@ -705,10 +707,11 @@ class AccompanyingPeriod implements
|
||||
->comments
|
||||
->filter(
|
||||
static fn (Comment $c): bool => $c !== $pinnedComment
|
||||
);
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): ?DateTime
|
||||
public function getCreatedAt(): DateTimeInterface
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ use DateInterval;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ReadableCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
@@ -295,6 +296,19 @@ class SocialAction
|
||||
return 0 < $this->getChildren()->count();
|
||||
}
|
||||
|
||||
public function isDesactivated(\DateTime $atDate): bool
|
||||
{
|
||||
if (null !== $this->desactivationDate && $this->desactivationDate < $atDate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->hasParent()) {
|
||||
return $this->parent->isDesactivated($atDate);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasParent(): bool
|
||||
{
|
||||
return $this->getParent() instanceof self;
|
||||
@@ -401,4 +415,14 @@ class SocialAction
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function filterRemoveDeactivatedActions(ReadableCollection|array $actions, \DateTime $comparisonDate): ReadableCollection|array
|
||||
{
|
||||
$filterFn = fn (SocialAction $socialAction) => !$socialAction->isDesactivated($comparisonDate);
|
||||
|
||||
return match ($actions instanceof ReadableCollection) {
|
||||
true => $actions->filter($filterFn),
|
||||
false => array_filter($actions, $filterFn)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -253,7 +253,7 @@ class SocialIssue
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|SocialAction[] All the descendant social actions of all
|
||||
* @return Collection<SocialAction> All the descendant social actions of all
|
||||
* the descendants of the entity
|
||||
*/
|
||||
public function getRecursiveSocialActions(): Collection
|
||||
@@ -272,7 +272,7 @@ class SocialIssue
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|SocialAction[]
|
||||
* @return Collection<SocialAction>
|
||||
*/
|
||||
public function getSocialActions(): Collection
|
||||
{
|
||||
|
@@ -201,6 +201,7 @@ import AddAsyncUpload from 'ChillDocStoreAssets/vuejs/_components/AddAsyncUpload
|
||||
import AddAsyncUploadDownloader from 'ChillDocStoreAssets/vuejs/_components/AddAsyncUploadDownloader.vue';
|
||||
import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue';
|
||||
import {buildLinkCreate} from 'ChillMainAssets/lib/entity-workflow/api.js';
|
||||
import {buildLinkCreate as buildLinkCreateNotification} from 'ChillMainAssets/lib/entity-notification/api';
|
||||
import DocumentActionButtonsGroup from "ChillDocStoreAssets/vuejs/DocumentActionButtonsGroup.vue";
|
||||
|
||||
const i18n = {
|
||||
@@ -413,14 +414,16 @@ export default {
|
||||
return this.$store.dispatch('submit', callback)
|
||||
.catch(e => { console.log(e); throw e; });
|
||||
},
|
||||
goToGenerateDocumentNotification(document, tos){
|
||||
goToGenerateDocumentNotification(document, tos) {
|
||||
const callback = (data) => {
|
||||
let evaluation = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key);
|
||||
if (tos === true) {
|
||||
window.location.assign(`/fr/notification/create?entityClass=Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument&entityId=${document.id}&tos[0]=${this.$store.state.work.accompanyingPeriod.user.id}&returnPath=/fr/person/accompanying-period/work/${evaluation.id}/edit`)
|
||||
} else {
|
||||
window.location.assign(`/fr/notification/create?entityClass=Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument&entityId=${document.id}&returnPath=/fr/person/accompanying-period/work/${evaluation.id}/edit`)
|
||||
}
|
||||
let updatedDocument = evaluation.documents.find(d => d.key === document.key);
|
||||
window.location.assign(buildLinkCreateNotification(
|
||||
'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument',
|
||||
updatedDocument.id,
|
||||
tos === true ? this.$store.state.work.accompanyingPeriod.user.id : null,
|
||||
window.location.pathname + window.location.search + window.location.hash
|
||||
));
|
||||
};
|
||||
return this.$store.dispatch('submit', callback)
|
||||
.catch(e => {console.log(e); throw e});
|
||||
|
@@ -20,7 +20,7 @@
|
||||
<td>{{ entity.ordering }}</td>
|
||||
<td>
|
||||
{% if entity.desactivationDate is not null %}
|
||||
{{ entity.desactivationDate|date('Y-m-d') }}
|
||||
{{ entity.desactivationDate|format_date('medium') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
|
@@ -46,11 +46,13 @@ class RelationshipNoDuplicateValidator extends ConstraintValidator
|
||||
]);
|
||||
|
||||
foreach ($relationships as $r) {
|
||||
if (
|
||||
$r->getFromPerson() === $fromPerson
|
||||
|| $r->getFromPerson() === $toPerson
|
||||
|| $r->getToPerson() === $fromPerson
|
||||
|| $r->getToPerson() === $toPerson
|
||||
if (spl_object_hash($r) !== spl_object_hash($value)
|
||||
and
|
||||
(
|
||||
($r->getFromPerson() === $fromPerson and $r->getToPerson() === $toPerson)
|
||||
||
|
||||
($r->getFromPerson() === $toPerson and $r->getToPerson() === $fromPerson)
|
||||
)
|
||||
) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->addViolation();
|
||||
|
Reference in New Issue
Block a user