Escape strings in the invoice template

This commit is contained in:
Paul van Tilburg 2015-06-05 22:30:02 +02:00
parent ac551fcf7a
commit 15b91d98ae
1 changed files with 40 additions and 40 deletions

View File

@ -1,6 +1,6 @@
\documentclass[a4paper,oneside,dutch]{isodoc} \documentclass[a4paper,oneside,dutch]{isodoc}
% rubber: clean <%= @number %>.out % rubber: clean <%=l @number %>.out
\usepackage{array} \usepackage{array}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
@ -10,13 +10,13 @@
dutch, dutch,
fill, fill,
%% Company info. %% Company info.
company=<%= @company.name %>, company=<%=l @company.name %>,
who=<%= @company.contact_name %>, who=<%=l @company.contact_name %>,
street=<%= @company.address_street %>, street=<%=l @company.address_street %>,
zip=<%= @company.address_postal_code %>, zip=<%=l @company.address_postal_code %>,
city=<%= @company.address_city %>, city=<%=l @company.address_city %>,
country=<%= @company.country %>, country=<%=l @company.country %>,
countrycode=<%= @company.country_code %>, countrycode=<%=l @company.country_code %>,
logoaddress={\hspace{-4.4em} logoaddress={\hspace{-4.4em}
\begin{tabular}{l@{\ }l} \begin{tabular}{l@{\ }l}
<% if @company.name.blank? %> \addresstext: & \who\\ <% if @company.name.blank? %> \addresstext: & \who\\
@ -33,38 +33,38 @@
%% Footer. %% Footer.
<% unless @company.website.blank? %> footer,<% <% unless @company.website.blank? %> footer,<%
end %> areacode=31, end %> areacode=31,
phone=<%= @company.phone %>, phone=<%=l @company.phone %>,
cellphone=<%= @company.cell %>, cellphone=<%=l @company.cell %>,
email=<%= @company.email %>, email=<%=l @company.email %>,
website=<%= @company.website %>, website=<%=l @company.website %>,
%% Addressee info. %% Addressee info.
%foreign, %foreign,
to={<%= @customer.name %>\\<% unless @customer.financial_contact.blank? to={<%=l @customer.name %>\\<% unless @customer.financial_contact.blank?
%><%= @customer.financial_contact %><%=l @customer.financial_contact
%>\\<% end %><%= @customer.address_street%>\\ %>\\<% end %><%=l @customer.address_street%>\\
<%= @customer.address_postal_code %> <%= @customer.address_city %>}, <%=l @customer.address_postal_code %> <%=l @customer.address_city %>},
% Headlines. % Headlines.
date=<%= @invoice.created_at.to_formatted_s(:day_code) %>, date=<%=l @invoice.created_at.to_formatted_s(:day_code) %>,
ourref=<%= @number %>, ourref=<%=l @number %>,
<% period = @period.map { |p| I18n.l p, :format => :month_and_year }.uniq <% period = @period.map { |p| I18n.l p, :format => :month_and_year }.uniq
case period.length case period.length
when 1 %> subject=Factuur <%= period.first %>,<% when 1 %> subject=Factuur <%=l period.first %>,<%
when 2 %> subject=Factuur <%= period.join(" t/m ") %>,<% when 2 %> subject=Factuur <%=l period.join(" t/m ") %>,<%
end %> end %>
yourref=, yourref=,
%% Payment data. %% Payment data.
term=30, term=30,
accountname=<%= @company.accountname %>, accountname=<%=l @company.accountname %>,
<% unless @company.accountiban.blank? %> iban=<%= @company.accountiban %>, <% unless @company.accountiban.blank? %> iban=<%=l @company.accountiban %>,
<% end %><% unless @company.bank_bic.blank? %> bic=<%= @company.bank_bic %>, <% end %><% unless @company.bank_bic.blank? %> bic=<%=l @company.bank_bic %>,
<% end %><% unless @company.vatno.blank? %> vatno=<%= @company.vatno %>, <% end %><% unless @company.vatno.blank? %> vatno=<%=l @company.vatno %>,
<% end %><% unless @company.chamber.blank? %> chamber=<%= @company.chamber %> <% end %><% unless @company.chamber.blank? %> chamber=<%=l @company.chamber %>
<% end %>} <% end %>}
\setlength{\parindent}{0pt} \setlength{\parindent}{0pt}
\setlength{\parskip}{\medskipamount} \setlength{\parskip}{\medskipamount}
<% if @company.bank_name.present? %> <% if @company.bank_name.present? %>
\renewcommand{\accountnotext}{<%= @company.bank_name %> rekeningnr} \renewcommand{\accountnotext}{<%=l @company.bank_name %> rekeningnr}
<% end %>\newcommand{\addresstext}{adres} <% end %>\newcommand{\addresstext}{adres}
\newcommand{\addresswhotext}{t.n.v.} \newcommand{\addresswhotext}{t.n.v.}
\renewcommand{\chambertext}{KvK-nr} \renewcommand{\chambertext}{KvK-nr}
@ -105,14 +105,14 @@
<% subtotal = 0.0 <% subtotal = 0.0
@tasks.each do |task, line| @tasks.each do |task, line|
if line[1].blank? if line[1].blank?
%> \ifcitem{<%= task.comment_or_name %>}% %> \ifcitem{<%=l task.comment_or_name %>}%
{<%= number_with_precision(line[0]) %>}% {<%=l number_with_precision(line[0]) %>}%
{<%= number_with_precision(line[2]) %>} {<%=l number_with_precision(line[2]) %>}
<% else <% else
%> \ihitem{<%= task.comment_or_name %>}% %> \ihitem{<%=l task.comment_or_name %>}%
{<%= number_with_precision(line[0]) %>}% {<%=l number_with_precision(line[0]) %>}%
{<%= number_with_precision(line[1]) %>}% {<%=l number_with_precision(line[1]) %>}%
{<%= number_with_precision(line[2]) %>} {<%=l number_with_precision(line[2]) %>}
<% end <% end
subtotal += line[2] subtotal += line[2]
end end
@ -120,13 +120,13 @@
if @company.vatno.blank? if @company.vatno.blank?
%> \ihnosubtotal{} <% %> \ihnosubtotal{} <%
else else
%> \ihsubtotal{<%= number_with_precision(subtotal) %>}<% %> \ihsubtotal{<%=l number_with_precision(subtotal) %>}<%
@vat.keys.sort.each do |rate| @vat.keys.sort.each do |rate|
vattotal += @vat[rate] %> vattotal += @vat[rate] %>
\ihvat{<%= "%d\\%%" % rate %>}{<%= number_with_precision(@vat[rate]) %>}<% \ihvat{<%= "%d\\%%" % rate %>}{<%=l number_with_precision(@vat[rate]) %>}<%
end end
end %> end %>
\ihtotal{<%= number_with_precision(subtotal + vattotal) %>} \ihtotal{<%=l number_with_precision(subtotal + vattotal) %>}
\end{ihtable} \end{ihtable}
\vspace{2em} \vspace{2em}
@ -148,11 +148,11 @@
\begin{istable} \begin{istable}
<% @invoice.tasks.each do |task| <% @invoice.tasks.each do |task|
%> \istask{<%= task.comment_or_name %>}<% %> \istask{<%=l task.comment_or_name %>}<%
task.time_entries.each do |time_entry| %> task.time_entries.each do |time_entry| %>
\isitem{<%= time_entry.comment || "Geen opmerking" %>}% \isitem{<%=l time_entry.comment || "Geen opmerking" %>}%
{<%= time_entry.date.to_date %>}% {<%=l time_entry.date.to_date %>}%
{<%= number_with_precision(time_entry.hours_total) %>}<% {<%=l number_with_precision(time_entry.hours_total) %>}<%
end %>\\[\medskipamount]<% end %>\\[\medskipamount]<%
end %> end %>
\end{istable} \end{istable}