improve and apply patch from webmyster


git-svn-id: https://forge.indepnet.net/svn/glpi/trunk@20743 35612d4c-9d10-0410-837c-bf9dd1be60d7