OMP preventing to set same category path in different presses

Hi all, in a OMP 3.3.0-21 we want to use same categories in different presses, e.g. “Textbooks” with path “didattica”, but when we try to add a category path in a press after having set the path in an other press OMP returns this error message: “Please enter a category name. (Italiano) The category path already exists. Please enter a unique path.”

immagine

and writes “The category path already exists. Please enter a unique path.” under the Path field

I can’t understand why OMP check the category path name in all the platform and not in the scope of any press: it would be ok if OMP would allow to use all categories in all the presses, but this is not happening: if you want “Textbooks” category in different presses, you have to set a different path for each press, having in the database different numeric IDs for the same category.

I can’t find any answer in the forum nor in documentation.

Any hint?

Best regards
Stefano

Hi @bolelligallevi,

This is indeed a bug. The check is implemented here:

As you can see, it checks for uniqueness providing both the path and the context (press) ID. This is as it should be.

However, the CategoryDAO function it calls does not expect the second ($contextId) parameter, so it is silently discarded:

The fix for this will be to add support for the second $contextId parameter to CategoryDAO::categoryExistsByPath.

Note that this is already fixed implicitly by a refactor in OJS/OMP/OPS 3.4.0 and later (as part of this work), so it might be tough for us to prioritize a fix for 3.3.0-x. I’d be happy to review a PR.

Regards,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 11 days. New replies are no longer allowed.