X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate%2FOpenDocument.pm;h=66d8f83ac3f5bbae8924020e4bb1f64cf5eeba41;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hp=7a9f95207daf5996b1ec93b6e7189c3b11b6134d;hpb=079c91d5a281f1bbf4c93681e3ccab4208271a0e;p=kivitendo-erp.git diff --git a/SL/Template/OpenDocument.pm b/SL/Template/OpenDocument.pm index 7a9f95207..66d8f83ac 100644 --- a/SL/Template/OpenDocument.pm +++ b/SL/Template/OpenDocument.pm @@ -359,7 +359,7 @@ sub parse { 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 @@ -435,7 +435,7 @@ sub parse { $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); @@ -653,8 +653,15 @@ sub generate_qr_code { 'countrycode' => $biller_countrycode, ); + my $amount; + if ($form->{'qrbill_without_amount'}) { + $amount = ''; + } else { + $amount = sprintf("%.2f", $form->parse_amount(\%::myconfig, $form->{'total'})); + } + my %payment_information = ( - 'amount' => sprintf("%.2f", $form->parse_amount(\%::myconfig, $form->{'total'})), + 'amount' => $amount, 'currency' => $form->{'currency'}, ); @@ -670,26 +677,35 @@ sub generate_qr_code { 'countrycode' => $customer_countrycode, ); - # generate ref.-no. with check digit - my $ref_number = assemble_ref_number( - $qr_account->{'bank_account_id'}, - $form->{'customernumber'}, - $form->{'ordnumber'}, - $form->{'invnumber'}, - ); - - my %ref_nr_data = ( - 'type' => 'QRR', - 'ref_number' => $ref_number, - ); + my %ref_nr_data; + if ($::instance_conf->get_create_qrbill_invoices == 1) { + # generate ref.-no. with check digit + my $ref_number = assemble_ref_number( + $qr_account->{'bank_account_id'}, + $form->{'customernumber'}, + $form->{'ordnumber'}, + $form->{'invnumber'}, + ); + %ref_nr_data = ( + 'type' => 'QRR', + 'ref_number' => $ref_number, + ); + # get ref. number/iban formatted with spaces and set into form for template + # processing + $form->{'ref_number'} = $ref_number; + $form->{'ref_number_formatted'} = get_ref_number_formatted($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; $form->{'biller_data'} = \%biller_data; - $form->{'ref_number'} = $ref_number; - - # get ref. number/iban formatted with spaces - $form->{'ref_number_formatted'} = get_ref_number_formatted($ref_number); $form->{'iban_formatted'} = get_iban_formatted($qr_account->{'iban'}); # format amount for template