Revision 040b9146
Von Werner Hahn vor mehr als 1 Jahr hinzugefügt
SL/Model/Record.pm | ||
---|---|---|
146 | 146 |
my $spool = $::lx_office_conf{paths}->{spool}; |
147 | 147 |
unlink map { "$spool/$_" } @spoolfiles if $spool; |
148 | 148 |
|
149 |
_save_history($record,'DELETED', %{$params{history}});
|
|
149 |
_save_history($record,'DELETED'); |
|
150 | 150 |
|
151 | 151 |
1; |
152 | 152 |
}) || push(@{$errors}, $db->error); |
... | ... | |
162 | 162 |
# fehler: exception |
163 | 163 |
} |
164 | 164 |
|
165 |
sub _get_history_snumbers { |
|
166 |
my ($record) = @_; |
|
167 |
|
|
168 |
my $number_type = $record->type_data->properties( 'nr_key'); |
|
169 |
my $snumbers = $number_type . '_' . $record->$number_type; |
|
170 |
|
|
171 |
return $snumbers; |
|
172 |
} |
|
173 |
|
|
165 | 174 |
sub _save_history { |
166 |
my ($record, $addition, %history) = @_;
|
|
175 |
my ($record, $addition) = @_; |
|
167 | 176 |
|
168 | 177 |
SL::DB::History->new( |
169 | 178 |
trans_id => $record->id, |
170 | 179 |
employee_id => SL::DB::Manager::Employee->current->id, |
171 | 180 |
what_done => $record->type, |
172 |
snumbers => $history{snumbers},
|
|
181 |
snumbers => _get_history_snumbers($record),
|
|
173 | 182 |
addition => $addition, |
174 | 183 |
)->save; |
175 | 184 |
} |
... | ... | |
250 | 259 |
_set_project_in_linked_requirement_specs($record); |
251 | 260 |
} |
252 | 261 |
|
253 |
_save_history($record, 'SAVED', %{$params{history}});
|
|
262 |
_save_history($record, 'SAVED'); |
|
254 | 263 |
|
255 | 264 |
$validity_token->delete if $validity_token; |
256 | 265 |
|
... | ... | |
351 | 360 |
=item C<delete> |
352 | 361 |
|
353 | 362 |
Deletes the whole record and puts an entry in the history. |
354 |
Expects a record with %params for history params{history} = \%history |
|
355 | 363 |
|
356 | 364 |
=item C<_save_history> |
357 | 365 |
|
358 |
Expects a record for id, addition for text (SAVED,...) and %history{snumber}
|
|
366 |
Expects a record for id, addition for text (SAVED,...) |
|
359 | 367 |
|
360 | 368 |
=back |
361 | 369 |
|
Auch abrufbar als: Unified diff
Model:Record snumber als private _get_snumber sub