Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0ce1b04e

Von Jan Büren vor mehr als 15 Jahren hinzugefügt

  • ID 0ce1b04e2a9bbd52692e118debb272e628f327f4
  • Vorgänger 4ce81208
  • Nachfolger 7cb88587

Erweiterung der Kundenmaske um IBAN und BIC - Patch aus xplace Projekt

Unterschiede anzeigen:

SL/BankAccount.pm
1
package SL::BankAccount;
2

  
3
use strict;
4

  
5
use SL::DBUtils;
6

  
7
sub save {
8
  $main::lxdebug->enter_sub();
9

  
10
  my $self     = shift;
11
  my %params   = @_;
12

  
13
  my $myconfig = \%main::myconfig;
14
  my $form     = $main::form;
15

  
16
  my $dbh      = $params{dbh} || $form->get_standard_dbh($myconfig);
17

  
18
  if (!$params{id}) {
19
    ($params{id}) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('id')|);
20
    do_query($form, $dbh, qq|INSERT INTO bank_accounts (id, chart_id)
21
                             VALUES (?, (SELECT id FROM chart LIMIT 1))|, conv_i($params{id}));
22
  }
23

  
24
  my $query =
25
    qq|UPDATE bank_accounts
26
       SET account_number = ?, bank_code = ?, bank = ?, iban = ?, bic = ?, chart_id = ?
27
       WHERE id = ?|;
28
  my @values = (@params{qw(account_number bank_code bank iban bic)}, conv_i($params{chart_id}), conv_i($params{id}));
29

  
30
  do_query($form, $dbh, $query, @values);
31

  
32
  $dbh->commit() unless ($params{dbh});
33

  
34
  $main::lxdebug->leave_sub();
35

  
36
  return $params{id};
37
}
38

  
39
sub retrieve {
40
  $main::lxdebug->enter_sub();
41

  
42
  my $self     = shift;
43
  my %params   = @_;
44

  
45
  Common::check_params(\%params, qw(id));
46

  
47
  my $myconfig = \%main::myconfig;
48
  my $form     = $main::form;
49

  
50
  my $dbh      = $params{dbh} || $form->get_standard_dbh($myconfig);
51

  
52
  my $query    = qq|SELECT * FROM bank_accounts WHERE id = ?|;
53
  my $account  = selectfirst_hashref_query($form, $dbh, $query, conv_i($params{id}));
54

  
55
  $main::lxdebug->leave_sub();
56

  
57
  return $account;
58
}
59

  
60
sub list {
61
  $main::lxdebug->enter_sub();
62

  
63
  my $self     = shift;
64
  my %params   = @_;
65

  
66
  my $myconfig = \%main::myconfig;
67
  my $form     = $main::form;
68

  
69
  my $dbh      = $params{dbh} || $form->get_standard_dbh($myconfig);
70

  
71
  my %sort_columns = (
72
    'account_number'    => [ 'ba.account_number', ],
73
    'bank_code'         => [ 'ba.bank_code', 'ba.account_number', ],
74
    'bank'              => [ 'ba.bank',      'ba.account_number', ],
75
    'iban'              => [ 'ba.iban',      'ba.account_number', ],
76
    'bic'               => [ 'ba.bic',       'ba.account_number', ],
77
    'chart_accno'       => [ 'c.accno', ],
78
    'chart_description' => [ 'c.description', ],
79
    );
80

  
81
  my %sort_spec = create_sort_spec('defs' => \%sort_columns, 'default' => 'bank', 'column' => $params{sortorder}, 'dir' => $params{sortdir});
82

  
83
  my $query =
84
    qq|SELECT ba.id, ba.account_number, ba.bank_code, ba.bank, ba.iban, ba.bic, ba.chart_id,
85
         c.accno AS chart_accno, c.description AS chart_description
86
       FROM bank_accounts ba
87
       LEFT JOIN chart c ON (ba.chart_id = c.id)
88
       ORDER BY $sort_spec{sql}|;
89

  
90
  my $results = selectall_hashref_query($form, $dbh, $query);
91

  
92
  $main::lxdebug->leave_sub();
93

  
94
  return $results;
95
}
96

  
97

  
98
1;
SL/CT.pm
306 306
    qq|account_number = ?, | .
307 307
    qq|bank_code = ?, | .
308 308
    qq|bank = ?, | .
309
    qq|iban = ?, | .
310
    qq|bic = ?, | .
309 311
    qq|obsolete = ?, | .
310 312
    qq|direct_debit = ?, | .
311 313
    qq|ustid = ?, | .
......
345 347
    $form->{account_number},
346 348
    $form->{bank_code},
347 349
    $form->{bank},
350
    $form->{iban},
351
    $form->{bic},
348 352
    $form->{obsolete} ? 't' : 'f',
349 353
    $form->{direct_debit} ? 't' : 'f',
350 354
    $form->{ustid},
......
511 515
    qq|  account_number = ?, | .
512 516
    qq|  bank_code = ?, | .
513 517
    qq|  bank = ?, | .
518
    qq|  iban = ?, | .
519
    qq|  bic = ?, | .
514 520
    qq|  obsolete = ?, | .
515 521
    qq|  direct_debit = ?, | .
516 522
    qq|  ustid = ?, | .
......
548 554
    $form->{account_number},
549 555
    $form->{bank_code},
550 556
    $form->{bank},
557
    $form->{iban},
558
    $form->{bic},
551 559
    $form->{obsolete} ? 't' : 'f',
552 560
    $form->{direct_debit} ? 't' : 'f',
553 561
    $form->{ustid},
......
1057 1065
  $main::lxdebug->leave_sub();
1058 1066
}
1059 1067

  
1068
sub get_bank_info {
1069
  $main::lxdebug->enter_sub();
1070

  
1071
  my $self     = shift;
1072
  my %params   = @_;
1073

  
1074
  Common::check_params(\%params, qw(vc id));
1075

  
1076
  my $myconfig = \%main::myconfig;
1077
  my $form     = $main::form;
1078

  
1079
  my $dbh      = $params{dbh} || $form->get_standard_dbh($myconfig);
1080

  
1081
  my $table        = $params{vc} eq 'customer' ? 'customer' : 'vendor';
1082
  my @ids          = ref $params{id} eq 'ARRAY' ? @{ $params{id} } : ($params{id});
1083
  my $placeholders = ('?') x scalar @ids;
1084
  my $query        = qq|SELECT id, name, account_number, bank, bank_code, iban, bic
1085
                        FROM ${table}
1086
                        WHERE id IN (${placeholders})|;
1087

  
1088
  my $result       = selectall_hashref_query($form, $dbh, $query, map { conv_i($_) } @ids);
1089

  
1090
  if (ref $params{id} eq 'ARRAY') {
1091
    $result = { map { $_->{id} => $_ } @{ $result } };
1092
  } else {
1093
    $result = $result->[0] || { 'id' => $params{id} };
1094
  }
1095

  
1096
  $main::lxdebug->leave_sub();
1097

  
1098
  return $result;
1099
}
1100

  
1060 1101
1;
locale/de/all
212 212
  'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung f?r Geb?hren und Zinsen zu Mahnung %s',
213 213
  'Available qty'               => 'Lagerbestand',
214 214
  'BALANCE SHEET'               => 'BILANZ',
215
  'BIC'                         => 'BIC',
215 216
  'BOM'                         => 'St?ckliste',
216 217
  'BWA'                         => 'BWA',
217 218
  'Back'                        => 'Zur?ck',
......
724 725
  'Host'                        => 'Datenbankcomputer',
725 726
  'However, you can create a new part which will then be selected.' => 'Sie können jedoch einen neuen Artikel anlegen, der dann automatisch ausgewählt wird.',
726 727
  'I'                           => 'I',
728
  'IBAN'                        => 'IBAN',
727 729
  'ID'                          => 'Buchungsnummer',
728 730
  'ID-Nummer'                   => 'ID-Nummer (intern)',
729 731
  'II'                          => 'II',
sql/Pg-upgrade2/bank_accounts.sql
1
-- @tag: bank_accounts
2
-- @description: Tabelle f?r Bankkonten (u.a. f?r SEPA-Export)
3
-- @depends: release_2_4_3
4
CREATE TABLE bank_accounts (
5
  id integer NOT NULL DEFAULT nextval('id'),
6
  account_number varchar(100),
7
  bank_code varchar(100),
8
  iban varchar(100),
9
  bic varchar(100),
10
  bank text,
11
  chart_id integer NOT NULL,
12

  
13
  PRIMARY KEY (id),
14
  FOREIGN KEY (chart_id) REFERENCES chart (id)
15
);
16

  
17
ALTER TABLE customer ADD COLUMN iban varchar(100);
18
ALTER TABLE customer ADD COLUMN bic varchar(100);
19
UPDATE customer SET iban = '', bic = '';
20

  
21
ALTER TABLE vendor ADD COLUMN iban varchar(100);
22
ALTER TABLE vendor ADD COLUMN bic varchar(100);
23
UPDATE vendor SET iban = '', bic = '';
templates/webpages/ct/form_header_de.html
2 2

  
3 3
 <div class="listtop">[% title %]</div>
4 4

  
5
 <form method="post" name="ct" action="ct.pl">
5
 <form method="post" name="ct" action="ct.pl" onKeyUp="highlight(event)" onClick="highlight(event)">
6 6

  
7 7
  <ul id="maintab" class="shadetabs">
8 8
   <li class="selected"><a href="#" rel="billing">Rechnungsadresse</a></li>
......
139 139

  
140 140
     <tr>
141 141
      <th align="right">Kontonummer</th>
142
      <td><input name="account_number" size="10" maxlength="15" value="[% HTML.escape(account_number) %]"></td>
142
      <td><input name="account_number" size="10" maxlength="100" value="[% HTML.escape(account_number) %]"></td>
143 143
      <th align="right">Bankleitzahl</th>
144
      <td><input name="bank_code" size="10" maxlength="10" value="[% HTML.escape(bank_code) %]"></td>
144
      <td><input name="bank_code" size="10" maxlength="100" value="[% HTML.escape(bank_code) %]"></td>
145 145
      <th align="right">Bank</th>
146
      <td><input name="bank" size="30" value="[% HTML.escape(bank) %]"></td>
146
      <td><input name="bank" size="20" value="[% HTML.escape(bank) %]"></td>
147
     </tr>
148

  
149
     <tr>
150
      <th align="right">IBAN</th>
151
      <td><input name="iban" size="10" maxlength="100" value="[% HTML.escape(iban) %]"></td>
152
      <th align="right">BIC</th>
153
      <td><input name="bic" size="10" maxlength="100" value="[% HTML.escape(bic) %]"></td>
147 154
     </tr>
148 155

  
149 156
     <tr>
templates/webpages/ct/form_header_master.html
2 2

  
3 3
 <div class="listtop">[% title %]</div>
4 4

  
5
 <form method="post" name="ct" action="ct.pl">
5
 <form method="post" name="ct" action="ct.pl" onKeyUp="highlight(event)" onClick="highlight(event)">
6 6

  
7 7
  <ul id="maintab" class="shadetabs">
8 8
   <li class="selected"><a href="#" rel="billing"><translate>Billing Address</translate></a></li>
......
139 139

  
140 140
     <tr>
141 141
      <th align="right"><translate>Account Number</translate></th>
142
      <td><input name="account_number" size="10" maxlength="15" value="[% HTML.escape(account_number) %]"></td>
142
      <td><input name="account_number" size="10" maxlength="100" value="[% HTML.escape(account_number) %]"></td>
143 143
      <th align="right"><translate>Bank Code Number</translate></th>
144
      <td><input name="bank_code" size="10" maxlength="10" value="[% HTML.escape(bank_code) %]"></td>
144
      <td><input name="bank_code" size="10" maxlength="100" value="[% HTML.escape(bank_code) %]"></td>
145 145
      <th align="right"><translate>Bank</translate></th>
146
      <td><input name="bank" size="30" value="[% HTML.escape(bank) %]"></td>
146
      <td><input name="bank" size="20" value="[% HTML.escape(bank) %]"></td>
147
     </tr>
148

  
149
     <tr>
150
      <th align="right"><translate>IBAN</translate></th>
151
      <td><input name="iban" size="10" maxlength="100" value="[% HTML.escape(iban) %]"></td>
152
      <th align="right"><translate>BIC</translate></th>
153
      <td><input name="bic" size="10" maxlength="100" value="[% HTML.escape(bic) %]"></td>
147 154
     </tr>
148 155

  
149 156
     <tr>

Auch abrufbar als: Unified diff