MT#5879 Make email invoices query simplier.

Remove redundant link through contract_balances to contracts.
Process customer email template and add month and year into invoice data.
MT#5879 Default content on template creation and x- mimetype.

Store default template content on template creation.
Replace image/x-mimetype with image/mimetype to fix PDF generation.
MT#7867 Api changes for invoice template per customer. For review.
MT#7867 InvoiceTemplate API draft.
MT#5879 Fix multi-undo functionality.

Call setCurrentLayer => draw.setCurrentLayer only on initialization stages.
MT#5879 Make possible to restart generate_invoices.
MT#5879 Deny to create  invoice templates with duplicated names
MT#5879 Merge with Andreas version of Invoice Template APIs.
I18N dump: snapshot Tue Jul 22 01:17:01 +0200 2014
I18N dump: snapshot Tue Jul 22 01:17:10 +0200 2014
I18N dump: snapshot Tue Jul 22 01:17:19 +0200 2014
I18N dump: snapshot Tue Jul 22 01:17:28 +0200 2014
I18N dump: snapshot Tue Jul 22 01:17:37 +0200 2014
MT#8261 allow zero in number ranges
MT#8261 fix evaluation zero to false
MT#7931 group captured calls

and sort by newest first
I18N dump: snapshot Wed Jul 23 01:16:49 +0200 2014
I18N dump: snapshot Wed Jul 23 01:16:59 +0200 2014
I18N dump: snapshot Wed Jul 23 01:17:12 +0200 2014
I18N dump: snapshot Wed Jul 23 01:17:23 +0200 2014