Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

value relation widget - drive down lists (filter expression) #2561

Closed
josemvm opened this issue Oct 26, 2021 · 10 comments · Fixed by #2562
Closed

value relation widget - drive down lists (filter expression) #2561

josemvm opened this issue Oct 26, 2021 · 10 comments · Fixed by #2562

Comments

@josemvm
Copy link
Collaborator

josemvm commented Oct 26, 2021

What is the bug?

i had the drive down lists working on both side (qgis desktop form and lizmap form), now they only work on the qgis desktop side.

qgis desktop:
imagem

lizmap:
`imagem

i'm using this filter expression "cod_tipo" = current_value ('tipo_abrev') as you can see it in the qgis server logs as below:

09:41:14 INFO Server[375409]: FILTER: "cod_tipo" = current_value ('tipo_abrev')

Steps to reproduce the issue

...

Lizmap version

3.4.6, plugin 3.6.3

QGIS desktop version

3.16.10

QGIS server version

3.16.10

Operating system

Ubuntu 20.04

Browsers

Firefox

Browsers version

93.0

Relevant log output

this is the log when i open the form:
`
09:41:14 INFO Server[375409]: ******************** New request ***************
09:41:14 INFO Server[375409]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap_web_client%2Flizmap%2Finstall%2Fma%2Ftipo_subtipo.qgs
09:41:14 INFO Server[375409]: Environment:
09:41:14 INFO Server[375409]: ------------------------------------------------
09:41:14 INFO Server[375409]: SERVER_NAME: 127.0.0.1
09:41:14 INFO Server[375409]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi?service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2Ftipo%5Fsubtipo%2Eqgs
09:41:14 INFO Server[375409]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
09:41:14 INFO Server[375409]: REMOTE_ADDR: 127.0.0.1
09:41:14 INFO Server[375409]: SERVER_PORT: 80
09:41:14 INFO Server[375409]: QUERY_STRING: service=LIZMAP&request=GetServerSettings&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2Ftipo%5Fsubtipo%2Eqgs
09:41:14 INFO Server[375409]: REQUEST_METHOD: GET
09:41:14 INFO Server[375409]: HTTP_ACCEPT: */*
09:41:14 INFO Server[375409]: HTTP_USER_AGENT: Lizmap
09:41:14 INFO WfsOutputExtension[375409]: WfsOutputExtension.requestReady
09:41:14 INFO Lizmap[375409]: Request headers provided
09:41:14 INFO Lizmap[375409]: No lizmap user groups in request headers
09:41:14 INFO Server[375409]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/tipo_subtipo.qgs
09:41:14 INFO Server[375409]: REQUEST:GetServerSettings
09:41:14 INFO Server[375409]: SERVICE:LIZMAP
09:41:14 WARNING [375409]: Service CADASTRE is not registered
09:41:14 INFO Lizmap[375409]: Sending JSON response : {'qgis': {'version': '3.16.10', 'name': 'Hannover', 'version_int': 31610}, 'gdalogr': {'name': 'GDAL 3.0.4, released 2020/01/28', 'version_int': '3000400'}, 'services': ['WMS', 'WFS', 'WCS', 'WMTS', 'ATLAS', 'EXPRESSION', 'LIZMAP'], 'lizmap': {'name': 'Lizmap', 'version': '3.6.3'}}
09:41:14 INFO WfsOutputExtension[375409]: WfsOutputExtension.responseComplete
09:41:14 INFO Server[375409]: Request finished in 3 ms
09:41:14 INFO Server[375409]: ******************** New request ***************
09:41:14 INFO Server[375409]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap_web_client%2Flizmap%2Finstall%2Fma%2Ftipo_subtipo.qgs
09:41:14 INFO Server[375409]: Environment:
09:41:14 INFO Server[375409]: ------------------------------------------------
09:41:14 INFO Server[375409]: SERVER_NAME: 127.0.0.1
09:41:14 INFO Server[375409]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi?service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2Ftipo%5Fsubtipo%2Eqgs
09:41:14 INFO Server[375409]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
09:41:14 INFO Server[375409]: REMOTE_ADDR: 127.0.0.1
09:41:14 INFO Server[375409]: SERVER_PORT: 80
09:41:14 INFO Server[375409]: QUERY_STRING: service=WMS&request=GetCapabilitiesAtlas&map=%2Fvar%2Fwww%2Fhtml%2Flizmap%5Fweb%5Fclient%2Flizmap%2Finstall%2Fma%2Ftipo%5Fsubtipo%2Eqgs
09:41:14 INFO Server[375409]: REQUEST_METHOD: GET
09:41:14 INFO Server[375409]: HTTP_ACCEPT: */*
09:41:14 INFO Server[375409]: HTTP_USER_AGENT: Lizmap
09:41:14 INFO WfsOutputExtension[375409]: WfsOutputExtension.requestReady
09:41:14 INFO Lizmap[375409]: Request headers provided
09:41:14 INFO Lizmap[375409]: No lizmap user groups in request headers
09:41:14 INFO Server[375409]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/tipo_subtipo.qgs
09:41:14 INFO Server[375409]: REQUEST:GetCapabilities
09:41:14 INFO Server[375409]: SERVICE:ATLAS
09:41:14 INFO Server[375409]: VERSION:1.0.0
09:41:14 INFO WfsOutputExtension[375409]: WfsOutputExtension.responseComplete
09:41:14 INFO Server[375409]: Request finished in 1 ms
09:41:14 INFO Server[375409]: ******************** New request ***************
09:41:14 INFO Server[375409]: Request URL: http://127.0.0.1/cgi-bin/qgis_mapserv.fcgi?
09:41:14 INFO Server[375409]: Environment:
09:41:14 INFO Server[375409]: ------------------------------------------------
09:41:14 INFO Server[375409]: SERVER_NAME: 127.0.0.1
09:41:14 INFO Server[375409]: REQUEST_URI: /cgi-bin/qgis_mapserv.fcgi
09:41:14 INFO Server[375409]: SCRIPT_NAME: /cgi-bin/qgis_mapserv.fcgi
09:41:14 INFO Server[375409]: REMOTE_ADDR: 127.0.0.1
09:41:14 INFO Server[375409]: SERVER_PORT: 80
09:41:14 INFO Server[375409]: QUERY_STRING:
09:41:14 INFO Server[375409]: CONTENT_TYPE: application/x-www-form-urlencoded
09:41:14 INFO Server[375409]: REQUEST_METHOD: POST
09:41:14 INFO Server[375409]: HTTP_ACCEPT: */*
09:41:14 INFO Server[375409]: HTTP_USER_AGENT: Lizmap
09:41:14 WARNING [375409]: Warning: error parsing post data as XML: at line 1, column 1: error occurred while parsing element. Assuming urlencoded query string sent in the post body.
09:41:14 INFO WfsOutputExtension[375409]: WfsOutputExtension.requestReady
09:41:14 INFO Lizmap[375409]: Request headers provided
09:41:14 INFO Lizmap[375409]: No lizmap user groups in request headers
09:41:14 INFO Server[375409]: FIELDS:abrev,subtipo
09:41:14 INFO Server[375409]: FILTER: "cod_tipo"  =  current_value ('tipo_abrev')
09:41:14 INFO Server[375409]: FORM_FEATURE:{"type":"Feature","geometry":null,"properties":[]}
09:41:14 INFO Server[375409]: LAYER:subtipo
09:41:14 INFO Server[375409]: MAP:/var/www/html/lizmap_web_client/lizmap/install/ma/tipo_subtipo.qgs
09:41:14 INFO Server[375409]: REQUEST:getFeatureWithFormScope
09:41:14 INFO Server[375409]: SERVICE:EXPRESSION
09:41:14 INFO Lizmap[375409]: Request headers provided
09:41:14 INFO Lizmap[375409]: No lizmap user groups in request headers
09:41:14 INFO Lizmap[375409]: Request headers provided
09:41:14 INFO Lizmap[375409]: No lizmap user login in request headers
09:41:14 INFO WfsOutputExtension[375409]: WfsOutputExtension.responseComplete
09:41:14 INFO Server[375409]: Request finished in 12 ms
@josemvm josemvm added the bug label Oct 26, 2021
@josemvm
Copy link
Collaborator Author

josemvm commented Oct 26, 2021

@nboisteault please check your mailbox

@nboisteault nboisteault added this to the 3.4.7 milestone Oct 26, 2021
@nboisteault nboisteault linked a pull request Oct 26, 2021 that will close this issue
@nboisteault
Copy link
Member

Thanks @josemvm . Do you remember when issue first occurred? Lizmap, QGIS Server, lizmap plugin update?

@josemvm
Copy link
Collaborator Author

josemvm commented Oct 26, 2021

@nboisteault d don't remember when issue first occurred.
i did the plugin downgrade to 3.6.1 (desktop and server) but problem remains...

thanks

@josemvm
Copy link
Collaborator Author

josemvm commented Oct 26, 2021

@nboisteault do you think these issues #2526 and #2540 can be related to this regression (or not)?...

@rldhont
Copy link
Collaborator

rldhont commented Oct 27, 2021

The attributes of the FORM_FEATURE is empty. So the evaluation of current_value ('tipo_abrev') is Null.

The regression is probably in the way lizmap build FORM_FEATURE based on HTML form.

@rldhont
Copy link
Collaborator

rldhont commented Oct 27, 2021

@josemvm can you update the expression by removing the space between current_value and ( ?

The expression becomes current_value ('tipo_abrev').

@rldhont
Copy link
Collaborator

rldhont commented Oct 27, 2021

@nboisteault @mdouchin the regexp to get the field name used in current_value expression method as to be enhanced and tested:

preg_match_all('/\\bcurrent_value\\(\\s*\'([^)]*)\'\\s*\\)/', $exp, $matches);

preg_match_all('/\\bcurrent_value\\(\\s*\'([^)]*)\'\\s*\\)/', $exp, $matches);

@nboisteault
Copy link
Member

@rldhont @mdouchin I take it.

@Gustry
Copy link
Member

Gustry commented Oct 27, 2021

This kind of regex is indeed very fragile, especially because expression is nearly a free-text area for users, between line breaks, expression comments, spaces etc...
But I understand the need, not sure how we can do.

@josemvm
Copy link
Collaborator Author

josemvm commented Oct 27, 2021

@rldhont your suggestion solves the problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants