creecros / MetaMagik

Custom Fields for Kanboard - Plugin MetaMagik
MIT License
98 stars 16 forks source link

Custom field value shows up twice in task summary when used in different projects #48

Closed YohannLYD closed 4 years ago

YohannLYD commented 4 years ago

If I create two or more non-global custom fields of the same name, they show up multiple times in the task summary. It seems to be alright on the edit task part.

In my particular case, I have the DCP field that is associated with the projects 20 and 24. They are declared in the settings part of kanboard : image

If I fill this field in any task, it ends up showing up twice : image

Considering that I will definitely use this field for upcoming projects, it's gonna add up each time I will associate it to additional projects...

I think the bug could be fixed somewhere around the task template/custom field loop but I am no PHP fluent enough to do it on my own.

creecros commented 4 years ago

I should have some time before the holidays to take a look.

YohannLYD commented 4 years ago

After investigating the issue, I think the bug can be solved somewhere around how the metadata are rendered on the task's summary.

It seems that the summary only relies on the task_has_metadata table to check if there are metadata to show. It's not using the attached_to field in the metadata_types table to make sure which information has to be shown on the summary.

I made changes on Template/task/metasummary.php by filtering the fields to display with getAllInScope() instead of getAll(). It seemed that it fixes the issue.

See PR #51

creecros commented 4 years ago

oversight on my part i guess, thanks for PR.