Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6eb84397

Von Moritz Bunkus vor etwa 2 Jahren hinzugefügt

  • ID 6eb843977077aabdf5f9e488916ab3ad0c58fed9
  • Vorgänger 46282860

Buchungsgruppen ungültig setzen können

Unterschiede anzeigen:

SL/Controller/Buchungsgruppen.pm
@errors = $self->config->validate; # check for description and inventory_accno_id
if (@errors) {
die "foo" . @errors . "\n";
};
return 0 if @errors;
$self->config->save;
......
1;
})) {
die @errors ? join("\n", @errors) . "\n" : $db->error . "\n";
my $error = @errors ? join("\n", @errors) . "\n" : $db->error . "\n";
$::form->show_generic_error($error);
# die with rollback of taxzone save if saving of any of the taxzone_charts fails
# only show the $db->error if we haven't already identified the likely error ourselves
}
SL/Controller/Part.pm
sub init_all_buchungsgruppen {
my ($self) = @_;
if ( $self->part->orphaned ) {
return SL::DB::Manager::Buchungsgruppe->get_all_sorted;
} else {
if (!$self->part->orphaned) {
return SL::DB::Manager::Buchungsgruppe->get_all_sorted(where => [ id => $self->part->buchungsgruppen_id ]);
}
return SL::DB::Manager::Buchungsgruppe->get_all_sorted(
where => [
or => [
id => $self->part->buchungsgruppen_id,
obsolete => 0,
],
]
);
}
sub init_shops_not_assigned {
......
return 1;
}
sub form_check_buchungsgruppe {
my ($self) = @_;
return 1 if $::form->{part}->{obsolete};
my $buchungsgruppe = SL::DB::Buchungsgruppe->new(id => $::form->{part}->{buchungsgruppen_id})->load;
return 1 if !$buchungsgruppe->obsolete;
$self->js->flash('error', t8("The booking group '#1' is obsolete and cannot be used with active articles.", $buchungsgruppe->description))
->focus('#part_buchungsgruppen_id');
return 0;
}
# general checking functions
sub check_part_id {
......
$self->form_check_assortment_items_unique || return 0;
$self->form_check_assembly_items_exist || return 0;
$self->form_check_partnumber_is_unique || return 0;
$self->form_check_buchungsgruppe || return 0;
return 1;
}
SL/DB/Buchungsgruppe.pm
push(@errors, $::locale->text('Booking group #1 needs a valid inventory account', $self->description)) unless $inventory_accno;
} else {
push @errors, $::locale->text('The booking group needs an inventory account.');
};
}
if ($self->id && $self->obsolete) {
require SL::DB::Part;
my $in_use = SL::DB::Manager::Part->get_first(
where => [
buchungsgruppen_id => $self->id,
obsolete => 0,
]);
if ($in_use) {
push @errors, $::locale->text('The booking group cannot be marked obsolete while still being used by active parts.');
}
}
return @errors;
}
SL/DB/MetaSetup/Buchungsgruppe.pm
description => { type => 'text' },
id => { type => 'integer', not_null => 1, sequence => 'id' },
inventory_accno_id => { type => 'integer', not_null => 1 },
obsolete => { type => 'boolean', default => 'false', not_null => 1 },
sortkey => { type => 'integer', not_null => 1 },
);
SL/DB/MetaSetup/Part.pm
mtime => { type => 'timestamp' },
not_discountable => { type => 'boolean', default => 'false' },
notes => { type => 'text' },
obsolete => { type => 'boolean', default => 'false' },
obsolete => { type => 'boolean', default => 'false', not_null => 1 },
onhand => { type => 'numeric', default => '0', precision => 25, scale => 5 },
part_type => { type => 'enum', check_in => [ 'part', 'service', 'assembly', 'assortment' ], db_type => 'part_type_enum', not_null => 1 },
partnumber => { type => 'text', not_null => 1 },
locale/de/all
'The basic client tables have not been created for this client\'s database yet.' => 'Die grundlegenden Mandantentabellen wurden in der für diesen Mandanten konfigurierten Datenbank noch nicht angelegt.',
'The billing period has already been locked.' => 'Die Buchungsperiode wurde bereits abgeschlossen.',
'The body is missing.' => 'Der Text fehlt',
'The booking group \'#1\' is obsolete and cannot be used with active articles.' => 'Die Buchungsgruppe "#1" ist ungültig und kann nicht für aktive Artikel genutzt werden.',
'The booking group cannot be marked obsolete while still being used by active parts.' => 'Die Buchungsgruppe kann nicht auf ungültig gesetzt werden, solange sie von gültigen Artikeln benutzt wird.',
'The booking group has been created.' => 'Die Buchungsgruppe wurde erstellt.',
'The booking group has been deleted.' => 'Die Buchungsgruppe wurde gelöscht.',
'The booking group has been saved.' => 'Die Buchungsgruppe wurde gespeichert.',
sql/Pg-upgrade2/booking_group_obsolete.sql
-- @tag: booking_group_obsolete
-- @description: Buchungsgruppen ungültig setzen können
-- @depends: release_3_7_0
ALTER TABLE buchungsgruppen
ADD COLUMN obsolete BOOLEAN NOT NULL DEFAULT FALSE;
UPDATE parts
SET obsolete = FALSE
WHERE obsolete IS NULL;
ALTER TABLE parts
ALTER COLUMN obsolete SET NOT NULL;
templates/design40_webpages/buchungsgruppen/form.html
[% END %]
</tr>
[% END %]
<tr>
<th>[% 'Obsolete' | $T8 %]</td>
<td>[% L.checkbox_tag('config.obsolete', checked=SELF.config.obsolete, for_submit=1) %]</td>
</tr>
<tbody>
</table>
templates/design40_webpages/buchungsgruppen/list.html
<th>[% 'Revenue' | $T8 %] [% HTML.escape(tz.description) %]</th>
<th>[% 'Expense' | $T8 %] [% HTML.escape(tz.description) %]</th>
[% END %]
<th>[% 'Obsolete' | $T8 %]</th>
</tr>
</thead>
<tbody>
......
<td>[% HTML.escape(CHARTLIST.${bg.id}.${tz.id}.income_accno) %]</td>
<td>[% HTML.escape(CHARTLIST.${bg.id}.${tz.id}.expense_accno) %]</td>
[% END %]
<td>[% IF bg.obsolete %][% LxERP.t8("yes") %][% ELSE %][% LxERP.t8("no") %][% END %]</td>
</tr>
[% END %]
</tbody>
</table>
templates/webpages/buchungsgruppen/form.html
[%- END %]
</tr>
[%- END %]
<tr>
<th align="right">[% 'Obsolete' | $T8 %]</td>
<td>[% L.checkbox_tag('config.obsolete', checked=SELF.config.obsolete, for_submit=1) %]</td>
</tr>
</table>
</form>
templates/webpages/buchungsgruppen/list.html
<th width="20%">[% 'Revenue' | $T8 %] [% HTML.escape(tz.description) %]</th>
<th width="20%">[% 'Expense' | $T8 %] [% HTML.escape(tz.description) %]</th>
[%- END %]
<th>[% 'Obsolete' | $T8 %]</th>
</tr>
</thead>
......
<td>[% HTML.escape(CHARTLIST.${bg.id}.${tz.id}.income_accno) %]</td>
<td>[% HTML.escape(CHARTLIST.${bg.id}.${tz.id}.expense_accno) %]</td>
[%- END %]
<td>[% IF bg.obsolete %][% LxERP.t8("yes") %][% ELSE %][% LxERP.t8("no") %][% END %]</td>
</tr>
[%- END %]
</tbody>
</table>

Auch abrufbar als: Unified diff