Master bug#9592 otrs 3.4

Hi Martin,

I fixed this for OTRS 3.4 as you suggested earlier. I think it is that we need. And I've also added new unit test file for it, with testing new logic.
If you have any suggestion for better solution feel free to tell me.

Regards
Zoran