X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fsepa.pl;h=edb6edae1ae8c03344ebe84be1fed69139a5b4f7;hb=841d44c00aae1166a0721e40dc2f9ffb7b9ac5b5;hp=40d2dff79f4b62864f26527783855cd5b4598fbb;hpb=b6d6ad18d758a2725f46a6706b709fbf92d8d0eb;p=kivitendo-erp.git diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl index 40d2dff79..edb6edae1 100755 --- a/bin/mozilla/sepa.pl +++ b/bin/mozilla/sepa.pl @@ -40,7 +40,12 @@ sub bank_transfer_add { return; } - $_->{checked} = $_->{direct_debit} for @{ $invoices }; + # Only include those per default that require manual action from our + # side. For sales invoices these are the ones for which direct debit + # has been selected. For purchase invoices it's the other way + # around: if direct debit is active then the vendor will collect + # from us automatically and we don't have to send money manually. + $_->{checked} = ($vc eq 'customer' ? $_->{direct_debit} : !$_->{direct_debit}) for @{ $invoices }; my $bank_account_label_sub = sub { $locale->text('Account number #1, bank code #2, #3', $_[0]->{account_number}, $_[0]->{bank_code}, $_[0]->{bank}) }; @@ -447,13 +452,14 @@ sub bank_transfer_download_sepa_xml { my $locale = $main::locale; my $cgi = $::request->{cgi}; my $vc = $form->{vc} eq 'customer' ? 'customer' : 'vendor'; + my $defaults = SL::DB::Default->get; - if (!$myconfig->{company}) { - $form->show_generic_error($locale->text('You have to enter a company name in your user preferences (see the "Program" menu, "Preferences").'), 'back_button' => 1); + if (!$defaults->company) { + $form->show_generic_error($locale->text('You have to enter a company name in the client configuration.'), 'back_button' => 1); } - if (($vc eq 'customer') && !$myconfig->{sepa_creditor_id}) { - $form->show_generic_error($locale->text('You have to enter the SEPA creditor ID in your user preferences (see the "Program" menu, "Preferences").'), 'back_button' => 1); + if (($vc eq 'customer') && !$defaults->sepa_creditor_id) { + $form->show_generic_error($locale->text('You have to enter the SEPA creditor ID in the client configuration.'), 'back_button' => 1); } my @ids; @@ -481,8 +487,8 @@ sub bank_transfer_download_sepa_xml { my $message_id = strftime('MSG%Y%m%d%H%M%S', localtime) . sprintf('%06d', $$); - my $sepa_xml = SL::SEPA::XML->new('company' => $myconfig->{company}, - 'creditor_id' => $myconfig->{sepa_creditor_id}, + my $sepa_xml = SL::SEPA::XML->new('company' => $defaults->company, + 'creditor_id' => $defaults->sepa_creditor_id, 'src_charset' => $::lx_office_conf{system}->{dbcharset} || 'ISO-8859-15', 'message_id' => $message_id, 'grouped' => 1, @@ -506,6 +512,7 @@ sub bank_transfer_download_sepa_xml { 'dst_iban' => $item->{vc_iban}, 'dst_bic' => $item->{vc_bic}, 'company' => $item->{vc_name}, + 'company_number' => $item->{vc_number}, 'amount' => $item->{amount}, 'reference' => $item->{reference}, 'reference_date' => $item->{reference_date},