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