Error message after upgrading to 17.0.2 version

Hi, after upgrading to 17.0.2 version, I see the following errors message After login.

How can I fix it?

During the upgrade I didn’t notice any warning.
I have 4 more dolibarr with no errors, this one has this error message when I login successfully.
What could I do?

Thanks

Dolibarr has detected a technical error.
This information can be useful for diagnostic purposes (you can set option $dolibarr_main_prod to ‘1’ to hide sensitive information):
Date: 20230731193520
Dolibarr: 17.0.2 - https://www.dolibarr.org
Level of features: 0
PHP: 7.0.33-0ubuntu0.16.04.16
Server: Apache
OS: Linux ip-172-31-59-222 4.4.0-1128-aws #142-Ubuntu SMP Fri Apr 16 12:42:33 UTC 2021 x86_64
User Agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Mobile Safari/537.36

Requested URL: /index.php?mainmenu=home
Referer: xxxx
Menu manager: eldy_menu.php

Modules/Applications: user, api, receiptprinter, projet, banque, commande, expensereport, facture, fournisseur, holiday, margin, opensurvey, printing, salaries, societe, stripe, loan, tax, comptabilite, product, stock, notification, supplier_proposal, efattita, mailing, paymentbybanktransfer, fckeditor, workflow, timesheet, paypal, expedition, productbatch, webservices

Database type manager: mysqli

Latest database access request error: SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.total_ht) as total, AVG(tl.total_ht) as avg FROM gre_commande as c, gre_commandedet as tl, gre_product as product INNER JOIN gre_societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = 13 WHERE c.entity IN (1) AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid AND c.date_commande BETWEEN ‘2023-01-01 00:00:00’ AND ‘2023-12-31 23:59:59’ GROUP BY product.ref ORDER BY nb DESC

Return code for latest database access request error: DB_ERROR_NOSUCHFIELD
Information for latest database access request error: Unknown column ‘c.fk_soc’ in ‘on clause’

Hi,

the error mentions that something is missing in the table gre_commande. It searchs for the field fk_soc but it is not available. Please check e.g. via PHP Admin if the mentioned field is available in the table.

If you have the logs from the time of doing the migration to the latest Dolibarr Version, I would check this as I guess there was some error in the migration of the database part.

Regards,
Sven

1 Like

thanks, wgere can I find the logs from the time of doing the migration to the latest Dolibarr Version?

Hi @billyva,

it depends a bit on your setting. If you didn’t change everything but the Dolibarr Logs Module were activated at this time, simply download your Dolibarr Logs and check the date in the logs where you made the update.

Did you checked if the field is really missing in the database?

Regards,
Sven

Please check and compare the permissions for “third parties” for user with the id=“13” in your setup:

Extend access to all third parties AND their objects (not only third parties for which the user is a sale representative).
Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc.).
Not effective for projects (only rules on project permissions, visibility and assignment matters).

Located in commande\class\commandestats.class.php in function “getAllByProduct(…)”

		if (empty($user->rights->societe->client->voir) && !$user->socid) {
			$sql .= "  INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
		}

If I uncheck this permission I got the same error as you.

Hi, have I to go to a dolibarr module and uncheck? Which module?

Or have I to edit the PHP code?
Thanks

Go to „setup → modules/application setup → products“.
There you will find the mentioned permission.

No need to change the php-code.

On this machine your using an outdated version of PHP: 7.0.33-0ubuntu0.16.04.16 it could be that the upgrade didn’t like that version of PHP you may need to upgrade try 7.4. xx as they may have upgraded the code and need a newer version. I have noticed a similar problem trying to get it to run on 8.1 & 8.2. I think the new version of Dolibarr (18) will allow it to run on 8.x series php but I think at this point 7.4 was the one they tested and used it on during development, also make sure the install.lock is not set and that config is not set to 444 set it to 777 to install and set it back to 444 when done it may need to write to that file on installation of the database

Hi, ok.
How can I upgrade PHP on the server?
Is very difficult?

It depends on if Dolibarr is hosted on a cPanel shared hosting account or on your own linux server - in a shared hosting environment you simply go into cPanel and change the setting in that. On a self hosted server more is involved to do this . Like making sure the version of php is installed that you want to use and changing some ini files in apache on it. Many use webmin to do this I recommend seeking info on how to do this in a web search online on what needs to be done for whatever flavor of linux you use