Need help with Joomla? We are available for hire to help with Joomla customization, upgrades, maintenance, and custom development.
Explore our services

Feedback on language filter implementation in EDocman 3.0 (Joomla 5.4)

  • hide10
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
10 months 1 week ago - 10 months 1 week ago #175237 by hide10
Hello,

After updating to EDocman 3.0 on Joomla 5.4, I encountered an error when trying to open the frontend update page:
Code:
Undefined constant Joomla\CMS\Factory::getApplication

Since I am not a PHP expert, I asked an AI assistant for help. Based on the analysis, the issue comes from the following line in:
administrator/components/com_edocman/model/fields/edocmancategory.php (around line 101)

Current code:
Code:
$query->where('tbl.language IN (' . $db->Quote(Factory::getApplication->getLanguage()->getTag()) . ',' . $db->Quote('*') . ', "")');

Suggested correction:
Code:
$query->where('tbl.language IN (' . $db->Quote(Factory::getApplication()->getLanguage()->getTag()) . ',' . $db->Quote('*') . ', "")');

I tested this correction locally, and it fixed the problem — the update page now works as expected.
It seems to be a simple syntax error (missing parentheses), but since this appears in the distributed package, I believe it should be addressed in an official update.

Could you please review and confirm?


Thanks
Last edit: 10 months 1 week ago by hide10.

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago #175238 by Dang Thuc Dam
Hi,
I confirm the issue, this is the code after updating:
Code:
if ($config->get('activate_multilingual_feature') && Factory::getContainer()->get('language.filter')->isEnabled()) { $query->where('tbl.language IN (' . $db->Quote(Factory::getApplication()->getLanguage()->getTag()) . ',' . $db->Quote('*') . ', "")'); }
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • hide10
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
10 months 6 days ago - 10 months 5 hours ago #175240 by hide10
Hi Dang,

Thank you for your quick response and for providing the updated code snippet regarding the multilingual feature.

I tested the suggested code:
Code:
if ($config->get('activate_multilingual_feature') && Factory::getContainer()->get('language.filter')->isEnabled()) {     $query->where('tbl.language IN (' . $db->Quote(Factory::getApplication()->getLanguage()->getTag()) . ',' . $db->Quote('*') . ', "")'); }

However, when running it on Joomla 5.4, I received the following error:
Resource 'language.filter' has not been registered with the container.

Since I am not a PHP expert, I consulted an AI assistant again.
The analysis suggested that this error occurs because language.filter is not always registered in the container (e.g., when the multilingual system plugin is not enabled).

As an alternative, the AI recommended using Multilanguage::isEnabled(), which works correctly and avoids the container registration issue. I tested this approach, and the update page displayed normally:
Code:
use Joomla\CMS\Factory; use Joomla\CMS\Language\Multilanguage; if ($config->get('activate_multilingual_feature') && Multilanguage::isEnabled()) {     $langTag = Factory::getApplication()->getLanguage()->getTag();     $query->where(         $db->quoteName('tbl.language') . ' IN (' .         implode(',', [$db->quote($langTag), $db->quote('*'), $db->quote('')]) .         ')'     ); }

This solution seems safer and more compatible with Joomla 5.x.
Could you please review and consider adopting this approach in a future release?

Thanks!
Last edit: 10 months 5 hours ago by Dang Thuc Dam.

Please Log in or Create an account to join the conversation.

More
10 months 6 days ago #175241 by Dang Thuc Dam
OK, thank you for your suggestion
Regards,
Dam

Please Log in or Create an account to join the conversation.

  • hide10
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
9 months 1 week ago #175710 by hide10
After updating EDocman from version 3.0 to 3.1 today, the issue I previously reported has reappeared. Upon checking the code, I found that the cause of the problem had been left unaddressed. It’s a bit disappointing. 

Please Log in or Create an account to join the conversation.

More
9 months 1 week ago #175711 by Dang Thuc Dam
Hi,
The recent Edocman release was a minor update, so not all bug fixes were included. We will fully update and address these issues in the upcoming version.

Thank you for your understanding and patience.
Dam

Please Log in or Create an account to join the conversation.