Adding the possibility to not use any image at all.

This commit is contained in:
sergiotarxz 2023-11-22 16:45:33 +01:00
parent 039fa4c785
commit 21df8325d3
2 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,9 @@ sub postal_code ($self) {
} }
sub image ($self) { sub image ($self) {
if (!defined $self->config->{img}) {
return
}
return $ROOT_PATH->child($self->config->{img}); return $ROOT_PATH->child($self->config->{img});
} }

View File

@ -81,7 +81,12 @@ sub run ($self) {
COMPLETA => $COMPLETA, COMPLETA => $COMPLETA,
concepts => $concepts, concepts => $concepts,
final_data => $final_data, final_data => $final_data,
logo => MIME::Base64::encode_base64($logo->slurp_raw), (
( defined $logo )
? ( logo => MIME::Base64::encode_base64( $logo->slurp_raw ),
)
: ( logo => undef )
),
} }
) )
); );
@ -94,7 +99,9 @@ sub template_bill ($self) {
</head> </head>
<body> <body>
<div class="page-contents"> <div class="page-contents">
% if (defined $logo) {
<img class="logo" src="data:image/svg+xml;base64,<%=$logo%>"/> <img class="logo" src="data:image/svg+xml;base64,<%=$logo%>"/>
% }
<h1>Factura <%=$kind_of_bill eq $SIMPLIFICADA ? 'Simplificada' : 'Completa'%></h1> <h1>Factura <%=$kind_of_bill eq $SIMPLIFICADA ? 'Simplificada' : 'Completa'%></h1>
<h2>Datos de factura</h2> <h2>Datos de factura</h2>