Revision 2d0ead91
Von Bernd Bleßmann vor mehr als 1 Jahr hinzugefügt
SL/Model/Record.pm | ||
---|---|---|
sub increment_subversion {
|
||
my ($class, $record, %flags) = @_;
|
||
|
||
$record->increment_version_number if $record->type_data->features('subversions');
|
||
if ($record->type_data->features('subversions')) {
|
||
$record->increment_version_number;
|
||
} else {
|
||
die t8('Subversions are not supported or disabled for this record type.');
|
||
}
|
||
|
||
return;
|
||
}
|
||
... | ... | |
|
||
Increments the record's subversion number.
|
||
|
||
TODO: check type data if this is allowed/supported for this record and trow exception or error
|
||
|
||
=item C<delete>
|
||
|
||
Expects a record to delete.
|
locale/de/all | ||
---|---|---|
'Subtotal' => 'Zwischensumme',
|
||
'Subtotal cannot distinguish betweens record types. Only one of the selected record types will be displayed: #1' => 'Zwischensummen können nicht zwischen den einzelnen Belegen unterscheiden, es wird nur "#1" angezeigt',
|
||
'Subtotals per quarter' => 'Zwischensummen pro Quartal',
|
||
'Subversions are not supported or disabled for this record type.' => '',
|
||
'Such entries cannot be exported into the DATEV format and have to be fixed as well.' => 'Solche Einträge sind aber nicht DATEV-exportiertbar und müssen ebenfalls korrigiert werden.',
|
||
'Suggested invoice' => 'Rechnungsvorschlag',
|
||
'Sum Credit' => 'Summe Haben',
|
locale/en/all | ||
---|---|---|
'Subtotal' => '',
|
||
'Subtotal cannot distinguish betweens record types. Only one of the selected record types will be displayed: #1' => '',
|
||
'Subtotals per quarter' => '',
|
||
'Subversions are not supported or disabled for this record type.' => '',
|
||
'Such entries cannot be exported into the DATEV format and have to be fixed as well.' => '',
|
||
'Suggested invoice' => '',
|
||
'Sum Credit' => '',
|
t/model/records.t | ||
---|---|---|
use Test::More;
|
||
use Test::Exception;
|
||
|
||
use strict;
|
||
|
||
... | ... | |
# make current version a final version, currently this is handled via frontend/controller
|
||
is($sales_order1->ordnumber, "ord-01", "ordnumber before increment_subversion ok");
|
||
SL::DB::OrderVersion->new(oe_id => $sales_order1->id, version => 1, final_version => 1)->save;
|
||
SL::Model::Record->increment_subversion($sales_order1);
|
||
# feature incrementing subversion disabled throws an error
|
||
throws_ok {
|
||
local $::instance_conf->data->{lock_oe_subversions} = 0;
|
||
SL::Model::Record->increment_subversion($sales_order1);
|
||
} qr{Subversions are not supported or disabled for this record type.}, 'feature subversion disabled throws error when trying to increment';
|
||
{
|
||
local $::instance_conf->data->{lock_oe_subversions} = 1;
|
||
SL::Model::Record->increment_subversion($sales_order1);
|
||
}
|
||
is($sales_order1->ordnumber, "ord-01-2", "ordnumber after increment_subversion ok");
|
||
is(SL::DB::Manager::Order->get_all_count(
|
||
where => [ and => ['!record_type' => 'sales_quotation', '!record_type' => 'request_quotation' ]]),
|
Auch abrufbar als: Unified diff
S:M:Record: Unterversionen: Fehler, wenn Feature aus.