Fix bug -refs BT#7794

Add next commits:
https://github.com/beeznest/chamilo-lms-icpna/commit/35814aa94b83830125546f1d2d5544dc59ede2d8
https://github.com/beeznest/chamilo-lms-icpna/commit/4f94c78cb981a70b883a04448b6947749c8c69a1
https://github.com/beeznest/chamilo-lms-icpna/commit/df930603659717b8e3308c880379ab686924d4ba
and also this