georchestra / mapstore2-cadastrapp

repository for the mapstore2 version of cadastrapp
GNU General Public License v3.0
2 stars 10 forks source link

[regression] search by name or numeric code #144

Closed landryb closed 2 years ago

landryb commented 2 years ago

in the extjs version, one could either lookup communes by name or numeric code, eg if entering '1500' the query done is /cadastrapp/services/getCommune?cgocommune=1500 and if entering 'com' the query done is /cadastrapp/services/getCommune?libcom=com.

from my testing in ms2-cadastrapp, whatever the value entered in the ville/commune search field, the second query is done with libcom parameter, thus search by insee code doesnt work.

in the original extjs version this was done by checking if the query was a number or a string, cf https://github.com/georchestra/cadastrapp/blob/master/addons/cadastrapp/js/searchParcelleByRef.js#L56 and https://github.com/georchestra/cadastrapp/blob/master/addons/cadastrapp/js/searchParcelleByOwner.js#L42 (there are more occurences of those isNaN checks)

i think https://github.com/georchestra/mapstore2-cadastrapp/blob/master/js/extension/api/api.js#L96 should be fixed, but there might be more occurences of the same similar issue for other searches.

cc @catmorales @MaelREBOUX

landryb commented 2 years ago

while here, i also noted that minCharToSearch parameter wasnt used anyway, 'something somewhere' hardcodes 3 per the comment in https://github.com/georchestra/mapstore2-cadastrapp/blob/master/js/extension/api/api.js#L93 ?