mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-19 03:32:51 +00:00
Merge branch 'master' into 709-notification-eval-action
This commit is contained in:
@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('chill_doc_store');
|
||||
$rootNode = $treeBuilder->getRootNode('chill_doc_store');
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
|
||||
// Here you should define the parameters that are allowed to
|
||||
// configure your bundle. See the documentation linked above for
|
||||
|
@@ -58,7 +58,7 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa
|
||||
* @ORM\Column(type="integer")
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private ?int $id;
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @var int[]
|
||||
@@ -94,7 +94,7 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=DocGeneratorTemplate::class)
|
||||
*/
|
||||
private ?DocGeneratorTemplate $template;
|
||||
private ?DocGeneratorTemplate $template = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", options={"default": "ready"})
|
||||
|
@@ -72,14 +72,10 @@ class AccompanyingCourseDocumentType extends AbstractType
|
||||
->add('category', EntityType::class, [
|
||||
'placeholder' => 'Choose a document category',
|
||||
'class' => DocumentCategory::class,
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('c')
|
||||
->where('c.documentClass = :docClass')
|
||||
->setParameter('docClass', AccompanyingCourseDocument::class);
|
||||
},
|
||||
'choice_label' => function ($entity = null) {
|
||||
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
||||
},
|
||||
'query_builder' => static fn (EntityRepository $er) => $er->createQueryBuilder('c')
|
||||
->where('c.documentClass = :docClass')
|
||||
->setParameter('docClass', AccompanyingCourseDocument::class),
|
||||
'choice_label' => fn ($entity = null) => $entity ? $this->translatableStringHelper->localize($entity->getName()) : '',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -67,14 +67,10 @@ class PersonDocumentType extends AbstractType
|
||||
->add('category', EntityType::class, [
|
||||
'placeholder' => 'Choose a document category',
|
||||
'class' => DocumentCategory::class,
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('c')
|
||||
->where('c.documentClass = :docClass')
|
||||
->setParameter('docClass', PersonDocument::class);
|
||||
},
|
||||
'choice_label' => function ($entity = null) {
|
||||
return $entity ? $this->translatableStringHelper->localize($entity->getName()) : '';
|
||||
},
|
||||
'query_builder' => static fn (EntityRepository $er) => $er->createQueryBuilder('c')
|
||||
->where('c.documentClass = :docClass')
|
||||
->setParameter('docClass', PersonDocument::class),
|
||||
'choice_label' => fn ($entity = null) => $entity ? $this->translatableStringHelper->localize($entity->getName()) : '',
|
||||
]);
|
||||
|
||||
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {
|
||||
|
@@ -95,7 +95,7 @@ class StoredObjectType extends AbstractType
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_decode($value, true);
|
||||
return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
public function reverseTransformObject($object)
|
||||
@@ -120,7 +120,7 @@ class StoredObjectType extends AbstractType
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_encode($object);
|
||||
return json_encode($object, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
public function transformObject($object = null)
|
||||
|
@@ -18,22 +18,20 @@ interface DownloadButtonConfig {
|
||||
}
|
||||
|
||||
interface DownloadButtonState {
|
||||
content: null|string
|
||||
is_ready: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<DownloadButtonConfig>();
|
||||
const state: DownloadButtonState = reactive({content: null});
|
||||
const state: DownloadButtonState = reactive({is_ready: false});
|
||||
|
||||
async function download_and_open(event: Event): Promise<void> {
|
||||
const button = event.target as HTMLAnchorElement;
|
||||
|
||||
if (null === state.content) {
|
||||
if (!state.is_ready) {
|
||||
event.preventDefault();
|
||||
|
||||
const urlInfo = build_download_info_link(props.storedObject.filename);
|
||||
|
||||
const raw = await download_and_decrypt_doc(urlInfo, props.storedObject.keyInfos, new Uint8Array(props.storedObject.iv));
|
||||
state.content = window.URL.createObjectURL(raw);
|
||||
|
||||
button.href = window.URL.createObjectURL(raw);
|
||||
button.type = props.storedObject.type;
|
||||
@@ -44,8 +42,13 @@ async function download_and_open(event: Event): Promise<void> {
|
||||
if (null !== ext) {
|
||||
button.download = button.download + '.' + ext;
|
||||
}
|
||||
}
|
||||
|
||||
button.click();
|
||||
state.is_ready = true;
|
||||
|
||||
// for fixing https://gitlab.com/Chill-Projet/chill-bundles/-/issues/98
|
||||
window.setTimeout(() => {
|
||||
button.click()
|
||||
}, 750);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -51,9 +51,7 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
|
||||
$persons = [];
|
||||
|
||||
if (null !== $course) {
|
||||
$persons = $course->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $participation) {
|
||||
return $participation->getPerson();
|
||||
})->toArray();
|
||||
$persons = $course->getCurrentParticipations()->map(static fn (AccompanyingPeriodParticipation $participation) => $participation->getPerson())->toArray();
|
||||
}
|
||||
|
||||
return [
|
||||
|
Reference in New Issue
Block a user