Revision 630d7e07
Von Bernd Bleßmann vor etwa 1 Jahr hinzugefügt
SL/Model/Record.pm | ||
---|---|---|
92 | 92 |
sub increment_subversion { |
93 | 93 |
my ($class, $record, %flags) = @_; |
94 | 94 |
|
95 |
$record->increment_version_number if $record->type_data->features('subversions'); |
|
95 |
if ($record->type_data->features('subversions')) { |
|
96 |
$record->increment_version_number; |
|
97 |
} else { |
|
98 |
die t8('Subversions are not supported or disabled for this record type.'); |
|
99 |
} |
|
96 | 100 |
|
97 | 101 |
return; |
98 | 102 |
} |
... | ... | |
399 | 403 |
|
400 | 404 |
Increments the record's subversion number. |
401 | 405 |
|
402 |
TODO: check type data if this is allowed/supported for this record and trow exception or error |
|
403 |
|
|
404 | 406 |
=item C<delete> |
405 | 407 |
|
406 | 408 |
Expects a record to delete. |
locale/de/all | ||
---|---|---|
3695 | 3695 |
'Subtotal' => 'Zwischensumme', |
3696 | 3696 |
'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', |
3697 | 3697 |
'Subtotals per quarter' => 'Zwischensummen pro Quartal', |
3698 |
'Subversions are not supported or disabled for this record type.' => '', |
|
3698 | 3699 |
'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.', |
3699 | 3700 |
'Suggested invoice' => 'Rechnungsvorschlag', |
3700 | 3701 |
'Sum Credit' => 'Summe Haben', |
locale/en/all | ||
---|---|---|
3694 | 3694 |
'Subtotal' => '', |
3695 | 3695 |
'Subtotal cannot distinguish betweens record types. Only one of the selected record types will be displayed: #1' => '', |
3696 | 3696 |
'Subtotals per quarter' => '', |
3697 |
'Subversions are not supported or disabled for this record type.' => '', |
|
3697 | 3698 |
'Such entries cannot be exported into the DATEV format and have to be fixed as well.' => '', |
3698 | 3699 |
'Suggested invoice' => '', |
3699 | 3700 |
'Sum Credit' => '', |
t/model/records.t | ||
---|---|---|
1 | 1 |
use Test::More; |
2 |
use Test::Exception; |
|
2 | 3 |
|
3 | 4 |
use strict; |
4 | 5 |
|
... | ... | |
76 | 77 |
# make current version a final version, currently this is handled via frontend/controller |
77 | 78 |
is($sales_order1->ordnumber, "ord-01", "ordnumber before increment_subversion ok"); |
78 | 79 |
SL::DB::OrderVersion->new(oe_id => $sales_order1->id, version => 1, final_version => 1)->save; |
79 |
SL::Model::Record->increment_subversion($sales_order1); |
|
80 |
# feature incrementing subversion disabled throws an error |
|
81 |
throws_ok { |
|
82 |
local $::instance_conf->data->{lock_oe_subversions} = 0; |
|
83 |
SL::Model::Record->increment_subversion($sales_order1); |
|
84 |
} qr{Subversions are not supported or disabled for this record type.}, 'feature subversion disabled throws error when trying to increment'; |
|
85 |
{ |
|
86 |
local $::instance_conf->data->{lock_oe_subversions} = 1; |
|
87 |
SL::Model::Record->increment_subversion($sales_order1); |
|
88 |
} |
|
80 | 89 |
is($sales_order1->ordnumber, "ord-01-2", "ordnumber after increment_subversion ok"); |
81 | 90 |
is(SL::DB::Manager::Order->get_all_count( |
82 | 91 |
where => [ and => ['!record_type' => 'sales_quotation', '!record_type' => 'request_quotation' ]]), |
Auch abrufbar als: Unified diff
S:M:Record: Unterversionen: Fehler, wenn Feature aus.