close(OUT);
my $qr_image_path;
- if ($::instance_conf->get_create_qrbill_invoices) {
+ if ($::instance_conf->get_create_qrbill_invoices && $form->{formname} eq 'invoice') {
# the biller account information, biller address and the reference number,
# are needed in the template aswell as in the qr-code generation, therefore
# assemble these and add to $::form
$zip->contents("styles.xml", Encode::encode('utf-8-strict', $new_styles));
}
- if ($::instance_conf->get_create_qrbill_invoices) {
+ if ($::instance_conf->get_create_qrbill_invoices && $form->{formname} eq 'invoice') {
# get placeholder path from odt XML
my $qr_placeholder_path;
my $dom = XML::LibXML->load_xml(string => $contents);
$form->{'invnumber'},
);
- my %ref_nr_data = (
- 'type' => 'QRR',
- 'ref_number' => $ref_number,
- );
+ my %ref_nr_data;
+ if ($::instance_conf->get_create_qrbill_invoices == 1) {
+ %ref_nr_data = (
+ 'type' => 'QRR',
+ 'ref_number' => $ref_number,
+ );
+ } elsif ($::instance_conf->get_create_qrbill_invoices == 2) {
+ %ref_nr_data = (
+ 'type' => 'NON',
+ 'ref_number' => '',
+ );
+ } else {
+ $::form->error($::locale->text('Error getting QR-Bill type.'));
+ }
# set into form for template processing
$form->{'biller_information'} = \%biller_information;