Revision 9dab1c5c
Von Bernd Bleßmann vor fast 2 Jahren 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') |
... | ... | |
2789 | 2787 |
$self->redirect_to(%params, id => $self->order->id); |
2790 | 2788 |
} |
2791 | 2789 |
|
2792 |
sub save_history {
|
|
2793 |
my ($self, $addition) = @_;
|
|
2790 |
sub get_history_snumbers {
|
|
2791 |
my ($self) = @_; |
|
2794 | 2792 |
|
2795 | 2793 |
my $number_type = $self->order->type =~ m{order} ? 'ordnumber' : 'quonumber'; |
2796 | 2794 |
my $snumbers = $number_type . '_' . $self->order->$number_type; |
2797 | 2795 |
|
2796 |
return $snumbers; |
|
2797 |
} |
|
2798 |
|
|
2799 |
sub save_history { |
|
2800 |
my ($self, $addition) = @_; |
|
2801 |
|
|
2798 | 2802 |
SL::DB::History->new( |
2799 | 2803 |
trans_id => $self->order->id, |
2800 | 2804 |
employee_id => SL::DB::Manager::Employee->current->id, |
2801 | 2805 |
what_done => $self->order->type, |
2802 |
snumbers => $snumbers,
|
|
2806 |
snumbers => $self->get_history_snumbers(),
|
|
2803 | 2807 |
addition => $addition, |
2804 | 2808 |
)->save; |
2805 | 2809 |
} |
Auch abrufbar als: Unified diff
Order-Controller: snumbers für History in eigener Routine zusammenbauen