Revision 945bae4c
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/BankAccount.pm | ||
---|---|---|
1 |
package SL::Controller::BankAccount; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use parent qw(SL::Controller::Base); |
|
6 |
|
|
7 |
use SL::Helper::Flash; |
|
8 |
use SL::Locale::String; |
|
9 |
use SL::DB::Default; |
|
10 |
use SL::DB::Manager::BankAccount; |
|
11 |
use SL::DB::Manager::BankTransaction; |
|
12 |
|
|
13 |
use Rose::Object::MakeMethods::Generic ( |
|
14 |
scalar => [ qw(bank_account) ], |
|
15 |
); |
|
16 |
|
|
17 |
__PACKAGE__->run_before('check_auth'); |
|
18 |
__PACKAGE__->run_before('load_bank_account', only => [ qw(edit update delete) ]); |
|
19 |
|
|
20 |
# |
|
21 |
# actions |
|
22 |
# |
|
23 |
|
|
24 |
sub action_list { |
|
25 |
my ($self) = @_; |
|
26 |
|
|
27 |
$self->render('bankaccounts/list', |
|
28 |
title => t8('Bank accounts'), |
|
29 |
BANKACCOUNTS => SL::DB::Manager::BankAccount->get_all_sorted, |
|
30 |
); |
|
31 |
} |
|
32 |
|
|
33 |
sub action_new { |
|
34 |
my ($self) = @_; |
|
35 |
|
|
36 |
$self->{bank_account} = SL::DB::BankAccount->new; |
|
37 |
$self->render('bankaccounts/form', |
|
38 |
title => t8('Add bank account')); |
|
39 |
} |
|
40 |
|
|
41 |
sub action_edit { |
|
42 |
my ($self) = @_; |
|
43 |
|
|
44 |
$self->render('bankaccounts/form', title => t8('Edit bank account')); |
|
45 |
} |
|
46 |
|
|
47 |
sub action_create { |
|
48 |
my ($self) = @_; |
|
49 |
|
|
50 |
$self->{bank_account} = SL::DB::BankAccount->new; |
|
51 |
$self->create_or_update; |
|
52 |
} |
|
53 |
|
|
54 |
sub action_update { |
|
55 |
my ($self) = @_; |
|
56 |
$self->create_or_update; |
|
57 |
} |
|
58 |
|
|
59 |
sub action_delete { |
|
60 |
my ($self) = @_; |
|
61 |
|
|
62 |
if ( $self->{bank_account}->{number_of_bank_transactions} > 0 ) { |
|
63 |
flash_later('error', $::locale->text('The bank account has been used and cannot be deleted.')); |
|
64 |
} elsif ( eval { $self->{bank_account}->delete; 1; } ) { |
|
65 |
flash_later('info', $::locale->text('The bank account has been deleted.')); |
|
66 |
} else { |
|
67 |
flash_later('error', $::locale->text('The bank account has been used and cannot be deleted.')); |
|
68 |
}; |
|
69 |
$self->redirect_to(action => 'list'); |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
sub action_reorder { |
|
74 |
my ($self) = @_; |
|
75 |
|
|
76 |
SL::DB::BankAccount->reorder_list(@{ $::form->{account_id} || [] }); |
|
77 |
$self->render(\'', { type => 'json' }); |
|
78 |
} |
|
79 |
|
|
80 |
# |
|
81 |
# filters |
|
82 |
# |
|
83 |
|
|
84 |
sub check_auth { |
|
85 |
$::auth->assert('config'); |
|
86 |
} |
|
87 |
|
|
88 |
sub load_bank_account { |
|
89 |
my ($self) = @_; |
|
90 |
|
|
91 |
$self->{bank_account} = SL::DB::BankAccount->new(id => $::form->{id})->load; |
|
92 |
$self->{bank_account}->{number_of_bank_transactions} = SL::DB::Manager::BankTransaction->get_all_count( query => [ local_bank_account_id => $self->{bank_account}->{id} ] ); |
|
93 |
} |
|
94 |
|
|
95 |
# |
|
96 |
# helpers |
|
97 |
# |
|
98 |
|
|
99 |
sub create_or_update { |
|
100 |
my ($self) = @_; |
|
101 |
my $is_new = !$self->{bank_account}->id; |
|
102 |
|
|
103 |
my $params = delete($::form->{bank_account}) || { }; |
|
104 |
|
|
105 |
$self->{bank_account}->assign_attributes(%{ $params }); |
|
106 |
|
|
107 |
my @errors = $self->{bank_account}->validate; |
|
108 |
|
|
109 |
if (@errors) { |
|
110 |
flash('error', @errors); |
|
111 |
$self->render('bankaccounts/form', |
|
112 |
title => $is_new ? t8('Add bank account') : t8('Edit bank account')); |
|
113 |
return; |
|
114 |
} |
|
115 |
|
|
116 |
$self->{bank_account}->save; |
|
117 |
|
|
118 |
flash_later('info', $is_new ? t8('The bank account has been created.') : t8('The bank account has been saved.')); |
|
119 |
$self->redirect_to(action => 'list'); |
|
120 |
} |
|
121 |
|
|
122 |
1; |
SL/Controller/SimpleSystemSetting.pm | ||
---|---|---|
21 | 21 |
# Make locales.pl happy: $self->render("simple_system_setting/_default_form") |
22 | 22 |
|
23 | 23 |
my %supported_types = ( |
24 |
bank_account => { |
|
25 |
# Make locales.pl happy: $self->render("simple_system_setting/_bank_account_form") |
|
26 |
class => 'BankAccount', |
|
27 |
titles => { |
|
28 |
list => t8('Bank accounts'), |
|
29 |
add => t8('Add bank account'), |
|
30 |
edit => t8('Edit bank account'), |
|
31 |
}, |
|
32 |
list_attributes => [ |
|
33 |
{ method => 'name', title => t8('Name'), }, |
|
34 |
{ method => 'iban', title => t8('IBAN'), }, |
|
35 |
{ method => 'bank', title => t8('Bank'), }, |
|
36 |
{ method => 'bank_code', title => t8('Bank code'), }, |
|
37 |
{ method => 'bic', title => t8('BIC'), }, |
|
38 |
{ method => 'reconciliation_starting_date_as_date', title => t8('Date'), align => 'right' }, |
|
39 |
{ method => 'reconciliation_starting_balance_as_number', title => t8('Balance'), align => 'right' }, |
|
40 |
], |
|
41 |
}, |
|
42 |
|
|
24 | 43 |
pricegroup => { |
25 | 44 |
# Make locales.pl happy: $self->render("simple_system_setting/_pricegroup_form") |
26 | 45 |
class => 'Pricegroup', |
js/locale/de.js | ||
---|---|---|
94 | 94 |
"Subject":"Betreff", |
95 | 95 |
"Text block actions":"Textblockaktionen", |
96 | 96 |
"Text block picture actions":"Aktionen für Textblockbilder", |
97 |
"The IBAN is missing.":"Die IBAN fehlt.", |
|
98 | 97 |
"The description is missing.":"Die Beschreibung fehlt.", |
99 | 98 |
"The field '#{title}' must be set.":"Das Feld »#{title}« muss gesetzt sein.", |
100 | 99 |
"The name is missing.":"Der Name fehlt.", |
... | ... | |
106 | 105 |
"The uploaded filename still exists.<br>If you not modify the name this is a new version of the file":"Der Dateiname existiert bereits.<br>Wenn Sie den Namen nicht ändern gibt dies eine neue Version der Datei", |
107 | 106 |
"There are duplicate parts at positions":"Es gibt doppelte Artikel bei den Positionen", |
108 | 107 |
"There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?":"Einige der Lagerbewegungen sind nicht vollständig und Lagerbewegungen können nachträglich nicht mehr verändert werden. Wollen Sie wirklich fortfahren?", |
109 |
"There is no connected chart.":"Es fehlt ein verknüpftes Buchungskonto.", |
|
110 | 108 |
"There is one or more sections for which no part has been assigned yet; therefore creating the new record is not possible yet.":"Es gibt einen oder mehrere Abschnitte ohne Artikelzuweisung; daher kann der neue Beleg noch nicht erstellt werden.", |
111 | 109 |
"This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?":"Dieser Auftrag besitzt eine aktive Konfiguration für wiederkehrende Rechnungen. Wenn Sie jetzt speichern, so werden alle zukünftig hieraus erzeugten Rechnungen die Änderungen enthalten, nicht aber die bereits erzeugten Rechnungen. Wollen Sie speichern?", |
112 | 110 |
"Time/cost estimate actions":"Aktionen für Kosten-/Zeitabschätzung", |
locale/de/all | ||
---|---|---|
2918 | 2918 |
'The background job has been deleted.' => 'Der Hintergrund-Job wurde gelöscht.', |
2919 | 2919 |
'The background job has been saved.' => 'Der Hintergrund-Job wurde gespeichert.', |
2920 | 2920 |
'The background job was executed successfully.' => 'Der Hintergrund-Job wurde erfolgreich ausgeführt.', |
2921 |
'The bank account has been created.' => 'Das Bankkonto wurde erstellt.', |
|
2922 |
'The bank account has been deleted.' => 'Das Bankkonto wurde gelöscht.', |
|
2923 |
'The bank account has been saved.' => 'Das Bankkonto wurde gespeichert', |
|
2924 |
'The bank account has been used and cannot be deleted.' => 'Das Bankkonto wurde benutzt und kann nicht gelöscht werden.', |
|
2925 | 2921 |
'The bank information must not be empty.' => 'Die Bankinformationen müssen vollständig ausgefüllt werden.', |
2926 | 2922 |
'The base file name without a path or an extension to be used for printing for this type of requirement spec.' => 'Der Basisdateiname ohne Pfadanteil oder Erweiterung, der bei Drucken dieses Pflichtenhefttyps verwendet wird.', |
2927 | 2923 |
'The base unit does not exist or it is about to be deleted in row %d.' => 'Die Basiseinheit in Zeile %d existiert nicht oder soll gelöscht werden.', |
menus/user/00-erp.yaml | ||
---|---|---|
1065 | 1065 |
name: Bank accounts |
1066 | 1066 |
order: 800 |
1067 | 1067 |
params: |
1068 |
action: BankAccount/list |
|
1068 |
action: SimpleSystemSetting/list |
|
1069 |
type: bank_account |
|
1069 | 1070 |
- parent: system |
1070 | 1071 |
id: system_partsgroups |
1071 | 1072 |
name: Partsgroups |
templates/webpages/bankaccounts/form.html | ||
---|---|---|
1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%] |
|
2 |
|
|
3 |
[% SET style="width: 400px" %] |
|
4 |
[% SET size=34 %] |
|
5 |
|
|
6 |
<h1>[% HTML.escape(title) %]</h1> |
|
7 |
|
|
8 |
<form action="controller.pl" method="post"> |
|
9 |
|
|
10 |
[%- INCLUDE 'common/flash.html' %] |
|
11 |
|
|
12 |
[%- L.hidden_tag("id", SELF.bank_account.id) %] |
|
13 |
|
|
14 |
<table> |
|
15 |
<tr> |
|
16 |
<th align="right">[% 'Description' | $T8 %]</th> |
|
17 |
<td>[%- L.input_tag("bank_account.name", SELF.bank_account.name, size=size) %]</td> |
|
18 |
</tr> |
|
19 |
<tr> |
|
20 |
<th align="right">[% 'IBAN' | $T8 %]</th> |
|
21 |
<td>[%- L.input_tag("bank_account.iban", SELF.bank_account.iban, size=size) %]</td> |
|
22 |
</tr> |
|
23 |
<tr> |
|
24 |
<th align="right">[% 'Bank' | $T8 %]</th> |
|
25 |
<td>[%- L.input_tag("bank_account.bank", SELF.bank_account.bank, size=size) %]</td> |
|
26 |
</tr> |
|
27 |
<tr> |
|
28 |
<th align="right">[% 'Account number' | $T8 %]</th> |
|
29 |
<td>[%- L.input_tag("bank_account.account_number", SELF.bank_account.account_number, size=size) %]</td> |
|
30 |
</tr> |
|
31 |
<tr> |
|
32 |
<th align="right">[% 'BIC' | $T8 %]</th> |
|
33 |
<td>[%- L.input_tag("bank_account.bic", SELF.bank_account.bic, size=size) %]</td> |
|
34 |
</tr> |
|
35 |
<tr> |
|
36 |
<th align="right">[% 'Bank code' | $T8 %]</th> |
|
37 |
<td>[%- L.input_tag("bank_account.bank_code", SELF.bank_account.bank_code, size=size) %]</td> |
|
38 |
</tr> |
|
39 |
<tr> |
|
40 |
<th align="right">[% 'Chart' | $T8 %]</th> |
|
41 |
<td>[% L.chart_picker('bank_account.chart_id', SELF.bank_account.chart_id, type='AR_paid,AP_paid', category='A,L,Q', choose=1, style=style) %]</td> |
|
42 |
</tr> |
|
43 |
<tr> |
|
44 |
<th align="right">[% 'Obsolete' | $T8 %]</th> |
|
45 |
<td>[% L.checkbox_tag('bank_account.obsolete', checked = SELF.bank_account.obsolete, for_submit=1) %]</td> |
|
46 |
</tr> |
|
47 |
<tr> |
|
48 |
<td align="left">[% 'Reconciliation' | $T8 %]:</td> |
|
49 |
<td></td> |
|
50 |
</tr> |
|
51 |
<tr> |
|
52 |
<th align="right">[% 'Starting date' | $T8 %]</th> |
|
53 |
<td>[% L.date_tag('bank_account.reconciliation_starting_date', SELF.bank_account.reconciliation_starting_date) %]</td> |
|
54 |
</tr> |
|
55 |
<tr> |
|
56 |
<th align="right">[% 'Starting balance' | $T8 %]</th> |
|
57 |
<td>[%- L.input_tag('bank_account.reconciliation_starting_balance_as_number', SELF.bank_account.reconciliation_starting_balance_as_number) %]</td> |
|
58 |
</tr> |
|
59 |
</table> |
|
60 |
|
|
61 |
<p> |
|
62 |
[% L.hidden_tag("action", "BankAccount/dispatch") %] |
|
63 |
[% L.submit_tag("action_" _ (SELF.bank_account.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %] |
|
64 |
[%- IF SELF.bank_account.id AND SELF.bank_account.number_of_bank_transactions == 0 -%] |
|
65 |
[% L.submit_tag("action_delete", LxERP.t8('Delete')) %] |
|
66 |
[%- END %] |
|
67 |
<a href="[% SELF.url_for(action='list') %]">[%- LxERP.t8("Cancel") %]</a> |
|
68 |
</p> |
|
69 |
|
|
70 |
<hr> |
|
71 |
|
|
72 |
<script type="text/javascript"> |
|
73 |
<!-- |
|
74 |
function check_prerequisites() { |
|
75 |
if ($('#bank_account_name').val() === "") { |
|
76 |
alert(kivi.t8('The name is missing.')); |
|
77 |
return false; |
|
78 |
} |
|
79 |
if ($('#bank_account_iban').val() === "") { |
|
80 |
alert(kivi.t8('The IBAN is missing.')); |
|
81 |
return false; |
|
82 |
} |
|
83 |
if ($('#bank_account_chart_id').val() === "") { |
|
84 |
alert(kivi.t8('There is no connected chart.')); |
|
85 |
return false; |
|
86 |
} |
|
87 |
|
|
88 |
return true; |
|
89 |
} |
|
90 |
--> |
|
91 |
</script> |
|
92 |
</form> |
templates/webpages/bankaccounts/list.html | ||
---|---|---|
1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%][%- INCLUDE 'common/flash.html' %] |
|
2 |
|
|
3 |
<h1>[% title %]</h1> |
|
4 |
|
|
5 |
<p> |
|
6 |
<table width="100%" id="bankaccount_list"> |
|
7 |
<thead> |
|
8 |
<tr class="listheading"> |
|
9 |
<th align="center" width="1%"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th> |
|
10 |
<th>[% 'Name' | $T8 %]</th> |
|
11 |
<th>[% 'IBAN' | $T8 %]</th> |
|
12 |
<th>[% 'Bank' | $T8 %]</th> |
|
13 |
<th>[% 'Bank code' | $T8 %]</th> |
|
14 |
<th>[% 'BIC' | $T8 %]</th> |
|
15 |
<th>[% 'Date' | $T8 %]</th> |
|
16 |
<th>[% 'Balance' | $T8 %]</th> |
|
17 |
</tr> |
|
18 |
</thead> |
|
19 |
|
|
20 |
<tbody> |
|
21 |
[%- FOREACH account = BANKACCOUNTS %] |
|
22 |
<tr class="listrow" id="account_id_[% account.id %]"> |
|
23 |
<td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td> |
|
24 |
<td><a href="[% SELF.url_for(action='edit', id=account.id) %]">[% HTML.escape(account.name) %]</a></td> |
|
25 |
<td>[% HTML.escape(account.iban) %]</a></td> |
|
26 |
<td>[% HTML.escape(account.bank) %]</a></td> |
|
27 |
<td>[% HTML.escape(account.bank_code) %]</a></td> |
|
28 |
<td>[% HTML.escape(account.bic) %]</a></td> |
|
29 |
<td>[% HTML.escape(account.reconciliation_starting_date.to_kivitendo) %]</a></td> |
|
30 |
<td align="right">[% HTML.escape(account.reconciliation_starting_balance_as_number) %]</a></td> |
|
31 |
</tr> |
|
32 |
[%- END %] |
|
33 |
</tbody> |
|
34 |
</table> |
|
35 |
</p> |
|
36 |
|
|
37 |
<hr height="3"> |
|
38 |
|
|
39 |
[% L.sortable_element('#bankaccount_list tbody', url=SELF.url_for(action='reorder'), with='account_id') %] |
|
40 |
|
|
41 |
<p> |
|
42 |
<a href="[% SELF.url_for(action='new') %]">[%- 'Add' | $T8 %]</a> |
|
43 |
</p> |
templates/webpages/simple_system_setting/_bank_account_form.html | ||
---|---|---|
1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%] |
|
2 |
|
|
3 |
[% SET style="width: 400px" %] |
|
4 |
|
|
5 |
<table> |
|
6 |
<tr> |
|
7 |
<th align="right">[% LxERP.t8('Description') %]</th> |
|
8 |
<td>[%- L.input_tag("object.name", SELF.object.name, style=style, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td> |
|
9 |
</tr> |
|
10 |
<tr> |
|
11 |
<th align="right">[% LxERP.t8('IBAN') %]</th> |
|
12 |
<td>[%- L.input_tag("object.iban", SELF.object.iban, style=style, "data-validate"="required", "data-title"=LxERP.t8("IBAN")) %]</td> |
|
13 |
</tr> |
|
14 |
<tr> |
|
15 |
<th align="right">[% LxERP.t8('Bank') %]</th> |
|
16 |
<td>[%- L.input_tag("object.bank", SELF.object.bank, style=style) %]</td> |
|
17 |
</tr> |
|
18 |
<tr> |
|
19 |
<th align="right">[% LxERP.t8('Account number') %]</th> |
|
20 |
<td>[%- L.input_tag("object.account_number", SELF.object.account_number, style=style) %]</td> |
|
21 |
</tr> |
|
22 |
<tr> |
|
23 |
<th align="right">[% LxERP.t8('BIC') %]</th> |
|
24 |
<td>[%- L.input_tag("object.bic", SELF.object.bic, style=style) %]</td> |
|
25 |
</tr> |
|
26 |
<tr> |
|
27 |
<th align="right">[% LxERP.t8('Bank code') %]</th> |
|
28 |
<td>[%- L.input_tag("object.bank_code", SELF.object.bank_code, style=style) %]</td> |
|
29 |
</tr> |
|
30 |
<tr> |
|
31 |
<th align="right">[% LxERP.t8('Chart') %]</th> |
|
32 |
<td>[% L.chart_picker('object.chart_id', SELF.object.chart_id, type='AR_paid,AP_paid', category='A,L,Q', choose=1, style=style, "data-validate"="required", "data-title"=LxERP.t8("Chart")) %]</td> |
|
33 |
</tr> |
|
34 |
<tr> |
|
35 |
<th align="right">[% LxERP.t8('Obsolete') %]</th> |
|
36 |
<td>[% L.checkbox_tag('object.obsolete', checked = SELF.object.obsolete, for_submit=1) %]</td> |
|
37 |
</tr> |
|
38 |
<tr> |
|
39 |
<td align="left">[% LxERP.t8('Reconciliation') %]:</td> |
|
40 |
<td></td> |
|
41 |
</tr> |
|
42 |
<tr> |
|
43 |
<th align="right">[% LxERP.t8('Starting date') %]</th> |
|
44 |
<td>[% L.date_tag('object.reconciliation_starting_date', SELF.object.reconciliation_starting_date) %]</td> |
|
45 |
</tr> |
|
46 |
<tr> |
|
47 |
<th align="right">[% LxERP.t8('Starting balance') %]</th> |
|
48 |
<td>[%- L.input_tag('object.reconciliation_starting_balance_as_number', SELF.object.reconciliation_starting_balance_as_number) %]</td> |
|
49 |
</tr> |
|
50 |
</table> |
Auch abrufbar als: Unified diff
SimpleSystemSetting: Umstellung von »Bankkonten«