OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

SingleTermId is null when Term has no LocalizationPart #8661

Closed AndreaPiovanelli closed 1 year ago

AndreaPiovanelli commented 1 year ago

https://github.com/OrchardCMS/Orchard/blob/049b4a8f3582a7b9d8daf55d61a93dff275e6f48/src/Orchard.Web/Modules/Orchard.Taxonomies/Controllers/LocalizedTaxonomyController.cs#L67

As the subject of the issue says, if TermPart has no LocalizationPart, no first term is found and the SingleTermId property of the TaxonomyFieldViewModel doesn't get to be valued. This causes a issue when a TaxonomyField is configured to accept the selection of on term only.

To clarify, a scenario where Taxonomy has the LocalizationPart and its relative Term hasn't can exist if terms aren't visible at front-end but need to be a group criteria for content (e.g. are used in queries for specific projection widgets).