Revision 69af4ea8
Von Bernd Bleßmann vor etwa 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
206 | 206 |
sub action_delete { |
207 | 207 |
my ($self) = @_; |
208 | 208 |
|
209 |
my $number_type = $self->order->type =~ m{order} ? 'ordnumber' : 'quonumber'; |
|
210 |
my %history = (snumbers => $number_type . '_' . $self->order->$number_type); |
|
211 |
my %params = (history => \%history); |
|
209 |
my %params = (history => { snumbers => $self->get_history_snumbers() }); |
|
212 | 210 |
SL::Model::Record->delete($self->order, %params); |
213 | 211 |
my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been deleted') |
214 | 212 |
: $self->type eq sales_order_type() ? $::locale->text('The order confirmation has been deleted') |
... | ... | |
2918 | 2916 |
$self->redirect_to(%params, id => $self->order->id); |
2919 | 2917 |
} |
2920 | 2918 |
|
2921 |
sub save_history {
|
|
2922 |
my ($self, $addition) = @_;
|
|
2919 |
sub get_history_snumbers {
|
|
2920 |
my ($self) = @_; |
|
2923 | 2921 |
|
2924 | 2922 |
my $number_type = $self->order->type =~ m{order} ? 'ordnumber' : 'quonumber'; |
2925 | 2923 |
my $snumbers = $number_type . '_' . $self->order->$number_type; |
2926 | 2924 |
|
2925 |
return $snumbers; |
|
2926 |
} |
|
2927 |
|
|
2928 |
sub save_history { |
|
2929 |
my ($self, $addition) = @_; |
|
2930 |
|
|
2927 | 2931 |
SL::DB::History->new( |
2928 | 2932 |
trans_id => $self->order->id, |
2929 | 2933 |
employee_id => SL::DB::Manager::Employee->current->id, |
2930 | 2934 |
what_done => $self->order->type, |
2931 |
snumbers => $snumbers,
|
|
2935 |
snumbers => $self->get_history_snumbers(),
|
|
2932 | 2936 |
addition => $addition, |
2933 | 2937 |
)->save; |
2934 | 2938 |
} |
Auch abrufbar als: Unified diff
Order-Controller: snumbers für History in eigener Routine zusammenbauen