Revision d3801bc9
Von Kivitendo Admin vor mehr als 10 Jahren hinzugefügt
SL/Controller/Buchungsgruppen.pm | ||
---|---|---|
61 | 61 |
sub action_edit { |
62 | 62 |
my ($self) = @_; |
63 | 63 |
|
64 |
# Allow editing of Buchungsgruppe if it isn't assigned to any parts. The |
|
65 |
# variable is checked in the template, which toggles between L.select_tag and |
|
66 |
# text. |
|
67 |
|
|
68 |
my $number_of_parts_with_buchungsgruppe = SL::DB::Manager::Part->get_objects_count(where => [ buchungsgruppen_id => $self->config->id]); |
|
64 |
# Allow editing of the charts of the Buchungsgruppe if it isn't assigned to |
|
65 |
# any parts. This is checked inside the template via the Buchungsgruppen |
|
66 |
# orphaned method, where an IF-ELSE statement toggles between L.select_tag |
|
67 |
# and text. |
|
69 | 68 |
|
70 | 69 |
$self->show_form(title => t8('Edit Buchungsgruppe'), |
71 |
linked_parts => $number_of_parts_with_buchungsgruppe, |
|
72 | 70 |
CHARTLIST => SL::DB::TaxzoneChart->get_all_accounts_by_buchungsgruppen_id($self->config->id)); |
73 | 71 |
} |
74 | 72 |
|
... | ... | |
147 | 145 |
|
148 | 146 |
$self->config->save; |
149 | 147 |
|
150 |
# check whether there are any assigned parts |
|
151 |
my $number_of_parts_with_buchungsgruppe = SL::DB::Manager::Part->get_objects_count(where => [ buchungsgruppen_id => $self->config->id]); |
|
152 |
|
|
153 |
# Save or update taxzone_charts: |
|
154 |
if ($is_new or $number_of_parts_with_buchungsgruppe == 0) { |
|
148 |
# Save or update taxzone_charts for new or unused Buchungsgruppen |
|
149 |
if ($is_new or $self->config->orphaned) { |
|
155 | 150 |
my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted(); |
156 | 151 |
|
157 | 152 |
foreach my $tz (@{ $taxzones }) { |
Auch abrufbar als: Unified diff
Neue Methode orphaned für Buchungsgruppe
Zum Prüfen, ob eine Buchungsgruppe gelöscht oder bearbeitet werden kann.