Dolibarr / dolibarr

Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
https://www.dolibarr.org
GNU General Public License v3.0
5.29k stars 2.74k forks source link

DB_ERROR_NOSUCHFIELD 'status' in 'where clause' #24877

Closed Pyhot closed 1 year ago

Pyhot commented 1 year ago

Bug

Hello,

I have an issu that I can't fix.

Is anybody can help ?

Thanks in advance.

Dolibarr a détecté une erreur technique. Ces informations peuvent être utiles à des fins de diagnostic (vous pouvez définir l'option $dolibarr_main_prod sur '1' pour masquer les informations sensibles): Date: 20230525124329 Dolibarr: 17.0.1 - https://www.dolibarr.org Niveau de fonctionnalités: 0 PHP: 7.4.33 Server: Apache OS: Linux webd003.cluster021.gra.hosting.ovh.net 5.15.80-ovh-vps-grsec-zfs-classid #1 SMP Wed Nov 30 08:49:06 UTC 2022 x86_64 User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15

Url sollicitée: /htdocs/product/stock/list.php?leftmenu=

Gestionnaire de menu: eldy_menu.php

Modules/Applications: user, syslog, supplier_proposal, agenda, barcode, fckeditor, cron, commande, ecm, facture, fournisseur, margin, printing, service, societe, categorie, projet, bom, propal, mrp, debugbar, bookmark, expedition, incoterm, workflow, product, stock, reception, productbatch, notification Type gestionnaire de base de données: mysqli Requête dernier accès en base en erreur: SELECT t.rowid, t.ref,t.lieu FROM llx_entrepot as t WHERE 1=1 AND t.entity IN (1) AND ((status = 1 AND entity IN (1))) ORDER BY t.ref ASC, t.lieu ASC Code retour dernier accès en base en erreur: DB_ERROR_NOSUCHFIELD Information sur le dernier accès en base en erreur: Unknown column 'status' in 'where clause'

Environment Version

No response

Environment OS

No response

Environment Web server

No response

Environment PHP

No response

Environment Database

No response

Environment URL(s)

No response

Expected and actual behavior

No response

Steps to reproduce the behavior

No response

Attached files

No response

Daviid-P commented 1 year ago

https://github.com/Dolibarr/dolibarr/blob/029d46730eee0cfe70361006b5b6fb5530a307d3/htdocs/install/mysql/tables/llx_entrepot.sql#L41

https://github.com/Dolibarr/dolibarr/blob/029d46730eee0cfe70361006b5b6fb5530a307d3/htdocs/product/stock/list.php#L98-L100

Someone changed to status without changing statut in class and DB, I guess?

https://github.com/Dolibarr/dolibarr/blob/029d46730eee0cfe70361006b5b6fb5530a307d3/htdocs/product/stock/class/entrepot.class.php#L570-L592

Pyhot commented 1 year ago

Dear Daviid -, thank you very much for your help.

Unfortunately, php files and -llx are excately the same than what you show !

I never put my hand in those files before ...

Maybe an external Module (factory ? equipement ?) could have change somewhere else ?

... Or interclassement ? it is sometimes Swedish or UTF8 a huge mix in that ...

Maybe a will do a clean install of 17.02 this WE and import all my documents... Do you think it could be a good way ?

Capture d’écran 2023-05-26 à 12 24 58
Daviid-P commented 1 year ago

Don't worry @Pyhot I wasn't implying you touched these files.

Ignore my message too, I was comparing dolibarr/htdocs/product/stock/list.php Line 98 to 100 with Lines 250 to 252. I didn't notice there were 2 similar pieces of codes.

Daviid-P commented 1 year ago

I've just tried and in 16.0.3 going to htdocs/product/stock/list.php doesn't trigger the error. If those factory and equipement modules have anything to do with warehouses (judging by the names I assume they do) it could be possible that they use the wrong/old column name?

What exactly are you doing when the error happens?

Pyhot commented 1 year ago

Thanks for your tests ;)

Maybe a conflit with GPAO module ?

I think I will start a clean install maybe.

Pyhot commented 1 year ago

Hello everybody,

Problem remains, after Clean install.

It's doesn't seem to be a problem in SQL tables where column 'status' exists.

Dolibarr works properly but still shows DB_ERROR_NOSUCHFIELD on page wharehouse / List : url (/product/stock/list.php)

Any solution ?

thanks for helping :)

ksar-ksar commented 1 year ago

Hello,

First, try to update to V17.0.2. If the problem is still there, activate Dolibarr logs, and send us the logs.

ksar-ksar commented 1 year ago

Duplicate of #24811

Pyhot commented 1 year ago

Thanks for your answer.

Everything is updated, but no change.

I have discovered that ERROR triggers only when column 'parent wharehouse' is checked in on page wharehouse / List : url (/product/stock/list.php).

Curious no ?

Here is debug bar return :

WARNING
Undefined array key "fk_project" (/home/eurythm/wwwdollibavenger/htdocs/product/stock/list.php:505) WARNING
Undefined array key "fk_parent" (/home/eurythm/wwwdollibavenger/htdocs/product/stock/list.php:505) WARNING
Undefined array key "fk_pays" (/home/eurythm/wwwdollibavenger/htdocs/product/stock/list.php:505) WARNING
Undefined array key "type" (/home/eurythm/wwwdollibavenger/htdocs/core/tpl/list_print_total.tpl.php:16) WARNING
Trying to access array offset on value of type null (/home/eurythm/wwwdollibavenger/htdocs/core/tpl/list_print_total.tpl.php:16) WARNING
Undefined array key "type" (/home/eurythm/wwwdollibavenger/htdocs/core/tpl/list_print_total.tpl.php:16) WARNING
Trying to access array offset on value of type null (/home/eurythm/wwwdollibavenger/htdocs/core/tpl/list_print_total.tpl.php:16) WARNING
Undefined array key "type" (/home/eurythm/wwwdollibavenger/htdocs/core/tpl/list_print_total.tpl.php:16) WARNING
Trying to access array offset on value of type null (/home/eurythm/wwwdollibavenger/htdocs/core/tpl/list_print_total.tpl.php:16)

Here is my config :

Version dernière mise à jour (Base de données) 17.0.2 Version installation initiale 5.0.4

PHP_OS Linux

Infos PHP Paramètre Valeur Version  8.1.16

Infos base de données Base de données Version 8.0.32

Pyhot commented 1 year ago

Hello,

I have found a problem in 'status' and 'statut' in some php files.

Indeed if I create a new column in llx_entrepot called statut, and egal to status, the ERROR doesn't appear anymore.

Does somebody else have the same mix in spelling 'status' and 'statut' in php files ?

Have a good day.

Pyhot commented 1 year ago

Hello,

I found the origin of the problem : it is a Dollibarr's Bug !

The ERROR is (at least) in the version 17.0.2.

The Bug is in /htdocs/product/stock/list.php?leftmenu= (appears when you check option column 'Parent Wharehouse'

Do clean install, activate Product's Module, Go to Wharehouse / List check for column Parent Wharehouse then following ERROR appears :

Dolibarr: 17.0.2 - https://www.dolibarr.org Niveau de fonctionnalités: 0 PHP: 8.1.16 Server: Apache OS: Linux webd003.cluster021.gra.hosting.ovh.net 5.15.80-ovh-vps-grsec-zfs-classid #1 SMP Wed Nov 30 08:49:06 UTC 2022 x86_64 User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15

Url sollicitée: /htdocs/product/stock/list.php?leftmenu= Referer: ...... /htdocs/product/index.php?mainmenu=products&leftmenu= Gestionnaire de menu: eldy_menu.php

Modules/Applications: user, syslog, product, expedition, notification, categorie, bookmark, fckeditor, workflow, incoterm, reception, supplier_proposal, projet, propal, stock, productbatch, agenda, barcode, cron, commande, ecm, facture, fournisseur, margin, printing, service, societe, banque, tax, bom, mrp, debugbar, export

Type gestionnaire de base de données: mysqli

Requête dernier accès en base en erreur: SELECT t.rowid, t.ref,t.lieu FROM llx_entrepot as t WHERE 1=1 AND t.entity IN (1) AND ((status = 1 AND entity IN (1))) ORDER BY t.ref ASC, t.lieu ASC Code retour dernier accès en base en erreur: DB_ERROR_NOSUCHFIELD

Information sur le dernier accès en base en erreur: Unknown column 'status' in 'where clause'

Is the ERROR will be fixed ?

Thanks for your help, Dolibarr is a great ERP with very good job made by the community !

yledoare commented 1 year ago

Seems to be fixed by renaming "status" by "statut" in line 130 from htdocs/product/stock/class/entrepot.class.php

image

Pyhot commented 1 year ago

Hi,

thanks for you answer. It 's a great help for us.

Good job 👏