Resolve deadlock problem

This problem would occur when using the send via email feature on an
object with a pentaho report, such as an invoice, and the database had
the portal features enabled.