This is a re-submit of issue
CRM-2629. I'm resubmitting it because the attached patch files are for verified 2.0 rather than 1.9, a fact I couldn't figure out how to record for the old issue. My apologies if I'm making more work for you....
Anyway, the attached archive contains patches to three files. As I said, I've verified these changes for 2.0. I also updated my changes to use what I perceived to be some new coding styles in 2.0.