DF#QCADOOCLS-1806 Some fixes in sql.
Merge branch 'dev' of github.com:qcadoo/mes into dev