MT#5879 Tspan replaced with text

Y coordinates adjusted, but generation not tested yet.
MT#5879 Use log4perl for logging.

And added option allow_terminated to allow to generate invoice
for customers with terminated contracts.

Conflicts:
	share/tools/generate_invoices.pl
	Solved.
Cherry-picked from 030f227d57d795078fba709a615fd8441a42513d
MT#5879 Return utf usage for mysql after merge.
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.