I think it will depend on just how severely it affects the person with their job.
As Darty Thanos mentioned, it's only a problem at work when you let it become a problem with your work.
As much as I love Barclay, if I'm being honest, he was really lucky. If something like his situation were to happen at, say, an office job on Earth, at worst he would lose his job. (Which is not a small thing, either. Though for a world that doesn't use money, one wonders how bad being fired actually is.) However, being an officer on a starship... especially the Federation flagship... is quite a different thing. At any time, a red alert might happen and you need to be focused on your job because of an anomaly, an attack, a disaster, or any number of things. If you aren't on point with your job because of a holo-addiction (or worse, you fall asleep in the arms of your favorite holodeck character so you don't hear the red alert go off and don't even go to your post), then lives can easily be lost. Not just the lives of fellow officers, but the civilians also on board, and any potential people outside that the ship may be trying to defend.
In other words... he should have been, at best, transferred off ship to an assignment that doesn't have dangerous situations happen every week. At worst, taken out of Starfleet.