Fix sql uery make very long tim because not use indexcorrectly
%Many fixes
Fix view rights
Fixes