Calc element plugins issue after migration

Hello,

One of my lists with the following code on the calc element plugins

$result = 0;
$quota_doch_id = '{calendario_2022_23a___quota_docente_raw}';
$quota_docy_id = '{calendario_2022_23a___nrlezioni_raw}';
if (!empty($quota_doch_id) && !empty($quota_docy_id)) {
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('nbre_heure_an')->from('packages')->where('id = ' . $myDb->quote($quota_docy_id));
$myDb->setQuery($myQuery);
$quota_docy = $myDb->loadResult();
$myQuery->clear()->select('quota_docente')->from('quota_corsi')->where('id = ' . $myDb->quote($quota_doch_id));
$myDb->setQuery($myQuery);
$quota_doch = $myDb->loadResult();
$result = $quota_doch * $quota_docy;
}
return $result;

throws this error message:

0 Illegal offset type
Debug: Eval exception : quota_doc_year (id 5181)::preFormatFormJoins() : $result = 0; $quota_doch_id = '5'; $quota_docy_id = '5'; if (!empty($quota_doch_id) && !empty($quota_docy_id)) { $myDb = JFactory::getDbo(); $myQuery = $myDb->getQuery(true); $myQuery->select('nbre_heure_an')->from('packages')->where('id = ' . $myDb->quote($quota_docy_id)); $myDb->setQuery($myQuery); $quota_docy = $myDb->loadResult(); $myQuery->clear()->select('quota_docente')->from('quota_corsi')->where('id = ' . $myDb->quote($quota_doch_id)); $myDb->setQuery($myQuery); $quota_doch = $myDb->loadResult(); $result = $quota_doch * $quota_docy; } return $result; : Joomla\CMS\Factory::getDbo() is deprecated. Load the database from the dependency injection container.

Any idea why?

Joomla! 4.3.4 - Fabrik Epsilon - PHP 8.1.21 - Template Cassipoeia

Thank you for your help.
 
I don't see anything obvious.
Enable J! System Debug and try again. This should show the error stack.
 
After enabling J! System Debug, I get the following error stack.

Call stack
#Function Location
1() JROOT/plugins/fabrik_element/usergroup/usergroup.php:142
2PlgFabrik_ElementUsergroup>renderListData ()JROOT/components/com_fabrik/models/list.php:12883FabrikFEModelList->formatData()JROOT/components/com_fabrik/models/list.php:10624FabrikFEModelList->finesseData()JROOT/components/com_fabrik/models/list.php:9575FabrikFEModelList->getData()JROOT/components/com_fabrik/models/list.php:7346FabrikFEModelList->render()JROOT/components/com_fabrik/views/list/view.base.php:4377FabrikViewListBase->display()JROOT/components/com_fabrik/views/list/view.html.php:448FabrikViewList->display()JROOT/libraries/src/Cache/Controller/ViewController.php:959Joomla\CMS\Cache\Controller\ViewController->get()JROOT/components/com_fabrik/controllers/list.php:11410FabrikControllerList->display()JROOT/libraries/src/MVC/Controller/BaseController.php:67811Joomla\CMS\MVC\Controller\BaseController->execute()JROOT/components/com_fabrik/fabrik.php:20012require_once()JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:7113Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}()JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:7314Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()JROOT/libraries/src/Component/ComponentHelper.php:36115Joomla\CMS\Component\ComponentHelper::renderComponent()JROOT/libraries/src/Application/SiteApplication.php:20816Joomla\CMS\Application\SiteApplication->dispatch()JROOT/libraries/src/Application/SiteApplication.php:24917Joomla\CMS\Application\SiteApplication->doExecute()JROOT/libraries/src/Application/CMSApplication.php:29318Joomla\CMS\Application\CMSApplication->execute()JROOT/includes/app.php:6119require_once()JROOT/index.php:32

upload_2023-8-31_12-2-16.png

upload_2023-8-31_12-2-46.png
 
Last edited:
Which F4 are you running, Epsilon?
What are the settings of your usergroup element?
 
One usergroup element is a repeat group. Yes, the error is in list view. After having set all the elements to not show in the list, I still have the same error.
 
Was this ok with Delta? There's a fix in Epsilon for showing usergroup names in list view (before it was showing only the values).
But this should not matter if you don't show these elements in list view.

What happens if you unpublish the usergroup elements (one by one)?
 
Thank you so much. :) You have solved the issue.
I have unpublished the usergroup element belonging to the repeat group, and the list displays correctly. About the version I used before, I have migrated directly to Epsilon. So, I wouldn't know if it was working with Delta.
 
Good you got it working in your case.

But unpublishing is not resolving an issue;), it won't help if you really need the element.
But as long as nobody else is running into it...
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top