Well, I don't know about practices globally, but again, in the US, it is rare for a programmer to have such an employment contract. And if you did, wven volunteering on an Open Source project that competes with your employer would likely be in violation, and it would not make any difference between a "donation" and an "invoice".