Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 95a9f8b9

Von Tamino Steinert vor mehr als 2 Jahren hinzugefügt

  • ID 95a9f8b99d7ef7c3150f1b7ebb3c66704ff3565e
  • Vorgänger bd92ddf5
  • Nachfolger 468eee22

Workflow: order ↔ reclamation

Unterschiede anzeigen:

SL/Controller/Order.pm
62 62
                        except => [ qw(edit show_customer_vendor_details_dialog price_popup load_second_rows) ]);
63 63

  
64 64
__PACKAGE__->run_before('recalc',
65
                        only => [ qw(save save_as_new save_and_delivery_order save_and_invoice save_and_invoice_for_advance_payment save_and_final_invoice save_and_ap_transaction
65
                        only => [ qw(save save_as_new
66
                                     save_and_delivery_order
67
                                     save_and_reclamation
68
                                     save_and_invoice save_and_invoice_for_advance_payment save_and_final_invoice save_and_ap_transaction
66 69
                                     print send_email) ]);
67 70

  
68 71
__PACKAGE__->run_before('get_unalterable_data',
69
                        only => [ qw(save save_as_new save_and_delivery_order save_and_invoice save_and_invoice_for_advance_payment save_and_final_invoice save_and_ap_transaction
72
                        only => [ qw(save save_as_new
73
                                     save_and_delivery_order
74
                                     save_and_reclamation
75
                                     save_and_invoice save_and_invoice_for_advance_payment save_and_final_invoice save_and_ap_transaction
70 76
                                     print send_email) ]);
71 77

  
72 78
#
......
96 102
  );
97 103
}
98 104

  
105
sub action_add_from_reclamation {
106
  my ($self) = @_;
107

  
108
  require SL::DB::Reclamation;
109
  my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load;
110
  my $order = $reclamation->convert_to_order();
111

  
112
  $self->order($order);
113

  
114
  $self->recalc();
115
  $self->pre_render();
116
  $self->render(
117
    'order/form',
118
    title => $self->get_title_for('edit'),
119
    %{$self->{template_args}}
120
  );
121
}
122

  
99 123
# edit an existing order
100 124
sub action_edit {
101 125
  my ($self) = @_;
......
740 764
  );
741 765
}
742 766

  
767
# save the order and redirect to the frontend subroutine for a new reclamation
768
sub action_save_and_reclamation {
769
  my ($self) = @_;
770

  
771
  # cann't use save_and_redirect_to, because id is set!
772
  my $errors = $self->save();
773
  if (scalar @{ $errors }) {
774
    $self->js->flash('error', $_) foreach @{ $errors };
775
    return $self->js->render();
776
  }
777

  
778
  my $to_type = $self->order->is_sales ? 'sales_reclamation'
779
                                       : 'purchase_reclamation';
780
  $self->redirect_to(
781
    controller => 'Reclamation',
782
    action     => 'add_from_order',
783
    type       => $to_type,
784
    from_id    => $self->order->id,
785
  );
786
}
787

  
743 788
# save the order and redirect to the frontend subroutine for a new
744 789
# invoice
745 790
sub action_save_and_invoice {
......
2247 2292
          only_if   => (any { $self->type eq $_ } (purchase_order_type())),
2248 2293
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2249 2294
        ],
2295
        action => [
2296
          t8('Save and Reclamation'),
2297
          call      => [ 'kivi.Order.save', 'save_and_reclamation', $::instance_conf->get_order_warn_duplicate_parts ],
2298
          only_if   => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type()))
2299
        ],
2250 2300
        action => [
2251 2301
          t8('Save and Invoice'),
2252 2302
          call      => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],

Auch abrufbar als: Unified diff