Revision c1808a62
Von Tamino Steinert vor mehr als 2 Jahren hinzugefügt
| SL/Controller/Reclamation.pm | ||
|---|---|---|
|                           save save_as_new print preview_pdf send_email
 | ||
|                           save_and_show_email_dialog
 | ||
|                           workflow_save_and_sales_or_purchase_reclamation
 | ||
|                           save_and_order
 | ||
|                        )]);
 | ||
|  | ||
| __PACKAGE__->run_before('get_unalterable_data',
 | ||
| ... | ... | |
|                           save save_as_new print preview_pdf send_email
 | ||
|                           save_and_show_email_dialog
 | ||
|                           workflow_save_and_sales_or_purchase_reclamation
 | ||
|                           save_and_order
 | ||
|                         )]);
 | ||
|  | ||
| #
 | ||
| ... | ... | |
|   );
 | ||
| }
 | ||
|  | ||
| sub action_add_from_order {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   unless ($::form->{from_id}) {
 | ||
|     $self->js->flash('error', t8("Can't create new reclamation. No 'from_id' was given."));
 | ||
|     return $self->js->render();
 | ||
|   }
 | ||
|  | ||
|   require SL::DB::Order;
 | ||
|   my $order = SL::DB::Order->new(id => $::form->{from_id})->load;
 | ||
|   my $reclamation = $order->convert_to_reclamation();
 | ||
|  | ||
|   $self->reclamation($reclamation);
 | ||
|  | ||
|   $self->reinit_after_new_reclamation();
 | ||
|  | ||
|   $self->render(
 | ||
|     'reclamation/form',
 | ||
|     title => $self->get_title_for('add'),
 | ||
|     %{$self->{template_args}},
 | ||
|   );
 | ||
| }
 | ||
|  | ||
| # edit an existing reclamation
 | ||
| sub action_edit {
 | ||
|   my ($self) = @_;
 | ||
| ... | ... | |
|   $self->redirect_to(@redirect_params);
 | ||
| }
 | ||
|  | ||
| sub action_save_and_order {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   my $to_type = $self->reclamation->is_sales ? 'sales_order'
 | ||
|                                              : 'purchase_order';
 | ||
|   $self->save_and_redirect_to(
 | ||
|     controller => 'Order',
 | ||
|     action     => 'add_from_reclamation',
 | ||
|     type       => $to_type,
 | ||
|     from_id    => $self->reclamation->id,
 | ||
|   );
 | ||
| }
 | ||
|  | ||
| # workflow from purchase to sales reclamation
 | ||
| sub action_save_and_sales_reclamation {
 | ||
|   $_[0]->workflow_save_and_sales_or_purchase_reclamation();
 | ||
| ... | ... | |
|   my ($self) = @_;
 | ||
|   my %allowed_linked_records = map {$_ => 1} qw(
 | ||
|     SL::DB::Reclamation
 | ||
|     SL::DB::Order
 | ||
|   );
 | ||
|   my %allowed_linked_record_items = map {$_ => 1} qw(
 | ||
|     SL::DB::ReclamationItem
 | ||
|     SL::DB::OrderItem
 | ||
|   );
 | ||
|  | ||
|   my $from_record_id = delete $::form->{converted_from_record_id};
 | ||
| ... | ... | |
|           call      => [ 'kivi.Reclamation.purchase_reclamation_check_for_direct_delivery' ],
 | ||
|           only_if   => (any { $self->type eq $_ } (sales_reclamation_type())),
 | ||
|         ],
 | ||
|         action => [
 | ||
|           t8('Save and Order'),
 | ||
|           call      => [
 | ||
|             'kivi.Reclamation.save', 'save_and_order',
 | ||
|             $::instance_conf->get_reclamation_warn_duplicate_parts,
 | ||
|             $::instance_conf->get_reclamation_warn_no_reqdate,
 | ||
|           ],
 | ||
|         ],
 | ||
|       ], # end of combobox "Workflow"
 | ||
|  | ||
|       combobox => [
 | ||
Auch abrufbar als: Unified diff
Workflow: order ↔ reclamation