error after upgrade (SOLVED)

Status
Not open for further replies.

creanet

New Member
Hi,
I took over a project that was already partially developed but with joomla 3.7.4 and fabrik 3.7, when I upgrade to joomla 3.8.10 and fabrik 3.8.1 with joomla manager I've got an error on the homepage (due to a module list but the same error is on the list "page") : 1054 Unknown column 'fk_themes_0.theme' in 'order clause'. I make a git update and now I have
Fabrik has generated an incorrect query for the list Voyages - public :
Unknown column 'fk_themes.parent_id' in 'where clause'
And nothing in the console
Could you please help me ? If needed all the joomla details are in my profile.
Thx
 
Can you add a backend superadmin access?
Create an extra one which can be disabled if not longer needed.
 
It's the element Inspirations (name =themes), dbjoin as checkbox in the Voyage - public list.
I have disabled it and the error is gone.
But I don't know what is the reason (it's referring to the wrong table).

Do you have a backup of your site?
I would try to edit this element (=Click unlink...) and resave.
 
How did you do it, I have 500 errors on lists 45, 46, 53, 63, 69 and 104 and would like to try your solution please
 
I had a look at the site, fixed one or two issues, but found some others.

I tried installing the site here with an Akeeba backup, so I can debug the issues, but I hadn't noticed your database is on a remote host, so it doesn't work from here. Is it possible to give me access from here?

-- hugh
 
OK, I figured it out.

You (or whoever you inherited this from) had set "Record in Database" to "No" on a bunch if your forms. This breaks pretty much anything that has to do with ... well, the database. Including building join queries, which is what was blowing up.

This isn't something that would have happened during an update, someone would have had to have manually set that option.

You should NEVER set that to "No" on a form, if you actually have a database table and corresponding List.

I set it back to Yes on form ID's 45 and 46, and both seem to be working now. You should be able to just set that to Yes (it's under the "Form Processing" tab) on the other affected forms.

-- hugh
 
OK now I have notices and warning that wasn't there before the update :
Lists 19, 54, 87, 97, 99 :
Notice: Trying to get property of non-object in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 6
List 44:
Notice: Undefined index: join___144___fk_etapes___activites in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 6
Warning: Invalid argument supplied for foreach() in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 10
And list 83:
Warning: Division by zero in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 6

On list 69 I have:
500 Fabrik has generated an incorrect query for the list Recherche libre: <br /><br /><pre>Unknown column '780' in 'order clause'</pre>
/home/toursinnei/www/components/com_fabrik/models/list.php:937
And on
List 72:
Fatal error: Call to a member function getOrderByName() on boolean in /home/toursinnei/www/plugins/fabrik_list/order/order.php on line 79

This 2 errors where apparently there also before the update but I would like some help with this too, should I open a new thread?
 
OK now I have notices and warning that wasn't there before the update :
Lists 19, 54, 87, 97, 99 :
Notice: Trying to get property of non-object in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 6
List 44:
Notice: Undefined index: join___144___fk_etapes___activites in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 6
Warning: Invalid argument supplied for foreach() in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 10
And list 83:
Warning: Division by zero in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 6

Anything that says "eval()'d code" means it's in code you (or whoever) wrote, in this case in a calc element.

I strongly suspect those warnings were there, you just didn't have error reporting turned on, so you never saw them before.

The first one, list 19, seems to be in the "Suivi client" calc ... which starts with this:

Code:
$db = JFactory::getDbo();
$fk = $db->Quote('{fk_demandes___id}');
$query = "SELECT fk_actions_story.datetime as date_time, fk_actions.nom_action as action, #__content.title as modele FROM fk_actions_story INNER JOIN fk_actions ON fk_actions_story.action=fk_actions.id LEFT JOIN #__content ON fk_actions_story.modele_email=#__content.id WHERE fk_actions_story.demande_id=$fk ORDER BY fk_actions_story.id DESC LIMIT 1";
$db->setQuery($query);
$action = $db->loadObject();
$date_action=strftime ("%d-%m-%Y",strtotime($action->date_time));
if(!empty($action)){
...

... the error is telling us "Trying to get property of non-object ... on line 6", and line 6 ...

Code:
$date_action=strftime ("%d-%m-%Y",strtotime($action->date_time));

... has $action->date_time on it ... but if that query doesn't return anything, and $action is empty ... trying to access $action->date_time will give that error, "trying to get property of a non-object".

So it should be ...

Code:
$action = $db->loadObject();
if(!empty($action)){
$date_action=strftime ("%d-%m-%Y",strtotime($action->date_time));
...

... ie. don't try and access $action->date_time till you've checked that $action is not empty.

I've fixed it on list 19, it's probably something similar on 54, 87, 97 and 99. You'll need to check each calc element in those forms, and see if line 6 does something similar, trying to access an object property (the -> syntax, so $foo->bar, where 'bar' is a property of the 'foo' object).

I'll look at the other types of error and get back to you.

-- hugh
 
Last edited:
This one ...

List 44:
Notice: Undefined index: join___144___fk_etapes___activites in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 6
Warning: Invalid argument supplied for foreach() in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 10

...is due to the calc "Photos des activités", which doesn't actually do anything ...

Code:
// Replace these two lines with your element's values
$joinId = '144';
$fullElementName = 'fk_etapes___activites';

// $vals is an array - it contains values of either 0 (not selected) or other
$vals = $data['join___' . $joinId . '___' . $fullElementName];

// Lets just get the selected values in a new array '$selected'
$selected = array();
foreach ($vals as $val)
  {
    if ($val != 0)
    {
      $selected[] = $val;
    }
}

That code is boilerplate stuff from Fabrik 2.x and 3.0, it doesn't apply to 3.1+ ... we no longer store joined data in that 'join___X___table___element' naming format. So that's giving a warning because that key doesn't exist in the $data array, and because the code then tries to do a foreach() on a null variable ... and then the code never returns anything anyway, so that calc would never have displayed anything anyway.

So as it is broken code and doesn't return anything, I've unpublished it.

-- hugh
 
OK, this one:

And list 83:
Warning: Division by zero in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(304) : eval()'d code on line 6

... was due to 5 of the calcs on that form, which do something similar to this:

Code:
$db = JFactory::getDbo();
$devise = $db->Quote('{fk_prestations___devise_achat_raw}');
$query = "SELECT taux_conversion FROM fk_devises WHERE id=$devise LIMIT 1";
$db->setQuery($query);
$taux = $db->loadResult();
$prix_achat_euros = "{fk_prestations___prix_achat}" / $taux;
return sprintf("%01.2f", $prix_achat_euros);

... where they look up $taux in the database, and divide by it ... but don't check to see if the query actually returned anything ... and if it didn't (or if it returned 0) then line 6 winds up dividing by 0 ... which is of course an error.

I've modified them all to do (something like) this:

Code:
$db = JFactory::getDbo();
$devise = $db->Quote('{fk_prestations___devise_achat_raw}');
$query = "SELECT taux_conversion FROM fk_devises WHERE id=$devise LIMIT 1";
$db->setQuery($query);
$taux = $db->loadResult();

if (!empty($taux)) {
  $prix_achat_euros = "{fk_prestations___prix_achat}" / $taux;
  return sprintf("%01.2f", $prix_achat_euros);
}

return '0';

... so it only does the actual division and returns a formatted result if $taux is not empty, and if it's empty, returns '0'.

-- hugh
 
On list 69 I have:
500 Fabrik has generated an incorrect query for the list Recherche libre: <br /><br /><pre>Unknown column '780' in 'order clause'</pre>
/home/toursinnei/www/components/com_fabrik/models/list.php:937

I just edited the list settings and re-saved them, it cleared up.

-- hugh
 
List 72:
Fatal error: Call to a member function getOrderByName() on boolean in /home/toursinnei/www/plugins/fabrik_list/order/order.php on line 79

The 'order' plugin on that list wasn't configured correctly - no "order element" was specified. I can't see an obvious element to set as the "order by", which would typically be a field that the plugin will re-set when you drag and drop the rows to order them, so I just unpublished the plugin.,

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top