ihsn / nada

National Data Archive (NADA) is an open source data cataloging system that serves as a portal for researchers to browse, search, compare, apply for access, and download relevant census or survey information. It was originally developed to support the establishment of national survey data archives.
http://nada.ihsn.org
MIT License
38 stars 10 forks source link

Variable view selecting "data availible from external repo" generate error #44

Open Alhrath opened 2 years ago

Alhrath commented 2 years ago

Hello,

After working some time on the last nada upgrade, I gave to our survey team the task to look for any other bug in the application. They found some, for instance this one :

When you go on the search page, under "variable view" and you select "Data available from external repository", you get the following error :

ERROR - 2022-09-06 16:28:08 --> Query error: Unknown column 'forms.formid' in 'where clause' - Invalid query: SELECT SQL_CALC_FOUND_ROWS v.uid, v.name, v.labl, v.qstn, v.vid, surveys.title as title, surveys.idno, surveys.nation, v.sid
FROM `variables` as `v`
INNER JOIN `surveys` ON `v`.`sid` = `surveys`.`id`
LEFT JOIN `repositories` ON `surveys`.`repositoryid`=`repositories`.`repositoryid`
WHERE `forms`.`formid` in (5)
 AND `published` = 1
ORDER BY `title` ASC
 LIMIT 15