Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 058d70b8

Von Kivitendo Admin vor mehr als 10 Jahren hinzugefügt

  • ID 058d70b8ae5406a40ce5ddba2d11cc8563d06751
  • Vorgänger 1c62d23e
  • Nachfolger 068e2451

Buchungsgruppen - löschen und beim Erstellen Standardkonten benutzen

Wenn eine Buchungsgruppe noch nicht einer Waren zugeordnet ist kann
diese noch bearbeitet (Kontenzuordnung) oder gelöscht werden.

Beim neu Erstellen von Buchungsgruppen werden die Standardkonten aus der
Mandantenkonfiguration (Erlös/Aufwand/Bestand) vorausgewählt.

Unterschiede anzeigen:

SL/Controller/Buchungsgruppen.pm
use SL::Locale::String;
use SL::DB::TaxzoneChart;
use SL::Controller::ClientConfig;
use SL::DB::Default;
use Rose::Object::MakeMethods::Generic (
scalar => [ qw(config) ],
'scalar --get_set_init' => [ qw(defaults) ],
);
__PACKAGE__->run_before('check_auth');
__PACKAGE__->run_before('load_config', only => [ qw(edit update) ]); #destroy
__PACKAGE__->run_before('load_config', only => [ qw(edit update delete) ]);
#
# actions
......
sub action_edit {
my ($self) = @_;
# check whether buchungsgruppe is assigned to any parts
# Allow editing of Buchungsgruppe if it isn't assigned to any parts. The
# variable is checked in the template, which toggles between L.select_tag and
# text.
my $number_of_parts_with_buchungsgruppe = SL::DB::Manager::Part->get_objects_count(where => [ buchungsgruppen_id => $self->config->id]);
$self->show_form(title => t8('Edit Buchungsgruppe'),
......
$self->create_or_update;
}
sub action_delete {
my ($self) = @_;
# allow deletion of unused Buchungsgruppen. Will fail, due to database
# constraint, if Buchungsgruppe is connected to a part
my $db = $self->{config}->db;
$db->do_transaction(sub {
my $taxzone_charts = SL::DB::Manager::TaxzoneChart->get_all(where => [ buchungsgruppen_id => $self->config->id ]);
foreach my $taxzonechart ( @{$taxzone_charts} ) { $taxzonechart->delete };
$self->config->delete();
flash_later('info', $::locale->text('The buchungsgruppe has been deleted.'));
}) || flash_later('error', $::locale->text('The buchungsgruppe is in use and cannot be deleted.'));
$self->redirect_to(action => 'list');
}
sub action_reorder {
my ($self) = @_;
......
$self->redirect_to(action => 'list');
}
#
# initializers
#
sub init_defaults { SL::DB::Default->get }
1;
templates/webpages/buchungsgruppen/form.html
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]<h1>[% HTML.escape(title) %]</h1>
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
<h1>[% HTML.escape(title) %]</h1>
<form action="controller.pl" method="post">
[%- L.hidden_tag("id", SELF.config.id) %]
......
<th align="right">[% 'Inventory account' | $T8 %]</th>
[%- IF SELF.config.id AND linked_parts != 0 %]
<td>[%- CHARTLIST.inventory_accno %] -- [%- CHARTLIST.inventory_accno_description %]</td>
[%- ELSIF NOT SELF.config.id AND linked_parts != 0 %]
<td>[%- L.select_tag("config.inventory_accno_id", ACCOUNTS.ic, title_sub=\account_label, default=SELF.defaults.inventory_accno_id) %]</td>
[%- ELSE %]
<td>[%- L.select_tag("config.inventory_accno_id", ACCOUNTS.ic, title_sub=\account_label, default=SELF.config.inventory_accno_id) %]</td>
[%- END %]
......
<th align="right">[% 'Revenue' | $T8 %] [% HTML.escape(tz.description) %]</th>
[%- IF SELF.config.id AND linked_parts != 0 %]
<td>[% CHARTLIST.${tz.id}.income_accno %] -- [% CHARTLIST.${tz.id}.income_accno_description %]</td>
[%- ELSIF NOT SELF.config.id AND linked_parts != 0 %]
<td>[%- L.select_tag('income_accno_id_' _ tz.id, ACCOUNTS.ic_income, title_sub=\account_label, default=SELF.defaults.income_accno_id) %]</td>
[%- ELSE %]
<td>[%- L.select_tag('income_accno_id_' _ tz.id, ACCOUNTS.ic_income, title_sub=\account_label, default=CHARTLIST.${tz.id}.income_accno_id) %]</td>
[%- END %]
......
<th align="right">[% 'Expense' | $T8 %] [% HTML.escape(tz.description) %]</th>
[%- IF SELF.config.id AND linked_parts != 0 %]
<td>[% CHARTLIST.${tz.id}.expense_accno %] -- [% CHARTLIST.${tz.id}.expense_accno_description %]</td>
[%- ELSIF NOT SELF.config.id AND linked_parts != 0 %]
<td>[%- L.select_tag('expense_accno_id_' _ tz.id, ACCOUNTS.ic_expense, title_sub=\account_label, default=SELF.defaults.expense_accno_id) %]</td>
[%- ELSE %]
<td>[%- L.select_tag('expense_accno_id_' _ tz.id, ACCOUNTS.ic_expense, title_sub=\account_label, default=CHARTLIST.${tz.id}.expense_accno_id) %]</td>
[%- END %]
......
<p>
[% L.hidden_tag("action", "Buchungsgruppen/dispatch") %]
[% L.submit_tag("action_" _ (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %]
<a href="[% SELF.url_for(action='list') %]">[%- LxERP.t8("Cancel") %]</a>
[%- IF SELF.config.id AND linked_parts == 0 %]
[% L.submit_tag("action_delete", LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure?')) %]
[%- END %]
</p>
<hr>
templates/webpages/buchungsgruppen/list.html
<tr class="listheading">
<th align="center" width="1%"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
<th width="20%">[% 'Description' | $T8 %]</th>
<th width="20%">[% 'Inventory' | $T8 %]</th>
<th width="20%">[% 'Inventory account' | $T8 %]</th>
[%- FOREACH tz = TAXZONES %]
<th width="20%">[% 'Revenue' | $T8 %] [% HTML.escape(tz.description) %]</th>
<th width="20%">[% 'Expense' | $T8 %] [% HTML.escape(tz.description) %]</th>

Auch abrufbar als: Unified diff