X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FCT.pm;h=f2745fb02644e0788ec20ba6d9ec72cae7bc0474;hb=41b8891d96b1ea8b22b06e9a14eb20eb96cc0300;hp=7e81d66c419a44f6419d241664387dc291a1a8b0;hpb=4f19857efd5a26253699b24a305176fda21b010a;p=kivitendo-erp.git diff --git a/SL/CT.pm b/SL/CT.pm index 7e81d66c4..f2745fb02 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -306,6 +306,8 @@ sub save_customer { qq|account_number = ?, | . qq|bank_code = ?, | . qq|bank = ?, | . + qq|iban = ?, | . + qq|bic = ?, | . qq|obsolete = ?, | . qq|direct_debit = ?, | . qq|ustid = ?, | . @@ -345,6 +347,8 @@ sub save_customer { $form->{account_number}, $form->{bank_code}, $form->{bank}, + $form->{iban}, + $form->{bic}, $form->{obsolete} ? 't' : 'f', $form->{direct_debit} ? 't' : 'f', $form->{ustid}, @@ -511,6 +515,8 @@ sub save_vendor { qq| account_number = ?, | . qq| bank_code = ?, | . qq| bank = ?, | . + qq| iban = ?, | . + qq| bic = ?, | . qq| obsolete = ?, | . qq| direct_debit = ?, | . qq| ustid = ?, | . @@ -548,6 +554,8 @@ sub save_vendor { $form->{account_number}, $form->{bank_code}, $form->{bank}, + $form->{iban}, + $form->{bic}, $form->{obsolete} ? 't' : 'f', $form->{direct_debit} ? 't' : 'f', $form->{ustid}, @@ -923,8 +931,9 @@ sub get_delivery { } my $query = qq|SELECT s.shiptoname, i.qty, | . - qq| ${arap}.transdate, ${arap}.invnumber, ${arap}.ordnumber, | . - qq| i.description, i.unit, i.sellprice | . + qq| ${arap}.id, ${arap}.transdate, ${arap}.invnumber, ${arap}.ordnumber, | . + qq| i.description, i.unit, i.sellprice, | . + qq| oe.id AS oe_id | . qq|FROM $arap | . qq|LEFT JOIN shipto s ON | . ($arap eq "ar" @@ -932,6 +941,7 @@ sub get_delivery { : qq|(ap.id = s.trans_id) |) . qq|LEFT JOIN invoice i ON (${arap}.id = i.trans_id) | . qq|LEFT join parts p ON (p.id = i.parts_id) | . + qq|LEFT JOIN oe ON (oe.ordnumber = ${arap}.ordnumber AND NOT ${arap}.ordnumber = '') | . $where . qq|ORDER BY ${arap}.transdate DESC LIMIT 15|; @@ -1055,4 +1065,37 @@ sub delete_shipto { $main::lxdebug->leave_sub(); } +sub get_bank_info { + $main::lxdebug->enter_sub(); + + my $self = shift; + my %params = @_; + + Common::check_params(\%params, qw(vc id)); + + my $myconfig = \%main::myconfig; + my $form = $main::form; + + my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); + + my $table = $params{vc} eq 'customer' ? 'customer' : 'vendor'; + my @ids = ref $params{id} eq 'ARRAY' ? @{ $params{id} } : ($params{id}); + my $placeholders = ('?') x scalar @ids; + my $query = qq|SELECT id, name, account_number, bank, bank_code, iban, bic + FROM ${table} + WHERE id IN (${placeholders})|; + + my $result = selectall_hashref_query($form, $dbh, $query, map { conv_i($_) } @ids); + + if (ref $params{id} eq 'ARRAY') { + $result = { map { $_->{id} => $_ } @{ $result } }; + } else { + $result = $result->[0] || { 'id' => $params{id} }; + } + + $main::lxdebug->leave_sub(); + + return $result; +} + 1;