Revision 8b2bb114
Von Bernd Bleßmann vor mehr als 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
196 | 196 |
sub action_delete { |
197 | 197 |
my ($self) = @_; |
198 | 198 |
|
199 |
my $number_type = $self->order->type =~ m{order} ? 'ordnumber' : 'quonumber'; |
|
200 |
my %history = (snumbers => $number_type . '_' . $self->order->$number_type); |
|
201 |
my %params = (history => \%history); |
|
199 |
my %params = (history => { snumbers => $self->get_history_snumbers() }); |
|
202 | 200 |
SL::Model::Record->delete($self->order, %params); |
203 | 201 |
my $text = $self->type eq sales_order_type() ? $::locale->text('The order has been deleted') |
204 | 202 |
: $self->type eq purchase_order_type() ? $::locale->text('The order has been deleted') |
... | ... | |
2840 | 2838 |
$self->redirect_to(%params, id => $self->order->id); |
2841 | 2839 |
} |
2842 | 2840 |
|
2843 |
sub save_history {
|
|
2844 |
my ($self, $addition) = @_;
|
|
2841 |
sub get_history_snumbers {
|
|
2842 |
my ($self) = @_; |
|
2845 | 2843 |
|
2846 | 2844 |
my $number_type = $self->order->type =~ m{order} ? 'ordnumber' : 'quonumber'; |
2847 | 2845 |
my $snumbers = $number_type . '_' . $self->order->$number_type; |
2848 | 2846 |
|
2847 |
return $snumbers; |
|
2848 |
} |
|
2849 |
|
|
2850 |
sub save_history { |
|
2851 |
my ($self, $addition) = @_; |
|
2852 |
|
|
2849 | 2853 |
SL::DB::History->new( |
2850 | 2854 |
trans_id => $self->order->id, |
2851 | 2855 |
employee_id => SL::DB::Manager::Employee->current->id, |
2852 | 2856 |
what_done => $self->order->type, |
2853 |
snumbers => $snumbers,
|
|
2857 |
snumbers => $self->get_history_snumbers(),
|
|
2854 | 2858 |
addition => $addition, |
2855 | 2859 |
)->save; |
2856 | 2860 |
} |
Auch abrufbar als: Unified diff
Order-Controller: snumbers für History in eigener Routine zusammenbauen