Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 92edc424

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID 92edc4245f357138855785df8f55e6c428ac4607
  • Vorgänger 4a2df34e
  • Nachfolger a6c54e9f

Workflow: order ↔ reclamation

Unterschiede anzeigen:

SL/Controller/Order.pm
92 92
  );
93 93
}
94 94

  
95
sub action_add_from_reclamation {
96
  my ($self) = @_;
97

  
98
  require SL::DB::Reclamation;
99
  my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load;
100
  my $order = $reclamation->convert_to_order();
101

  
102
  $self->order($order);
103

  
104
  $self->recalc();
105
  $self->pre_render();
106
  $self->render(
107
    'order/form',
108
    title => $self->get_title_for('edit'),
109
    %{$self->{template_args}}
110
  );
111
}
112

  
95 113
# edit an existing order
96 114
sub action_edit {
97 115
  my ($self) = @_;
......
791 809
  );
792 810
}
793 811

  
812
# save the order and redirect to the frontend subroutine for a new reclamation
813
sub action_save_and_reclamation {
814
  my ($self) = @_;
815

  
816
  # cann't use save_and_redirect_to, because id is set!
817
  my $errors = $self->save();
818
  if (scalar @{ $errors }) {
819
    $self->js->flash('error', $_) foreach @{ $errors };
820
    return $self->js->render();
821
  }
822

  
823
  my $to_type = $self->order->is_sales ? 'sales_reclamation'
824
                                       : 'purchase_reclamation';
825
  $self->redirect_to(
826
    controller => 'Reclamation',
827
    action     => 'add_from_order',
828
    type       => $to_type,
829
    from_id    => $self->order->id,
830
  );
831
}
832

  
794 833
# save the order and redirect to the frontend subroutine for a new
795 834
# invoice
796 835
sub action_save_and_invoice {
......
2339 2378
          only_if   => (any { $self->type eq $_ } (purchase_order_type())),
2340 2379
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2341 2380
        ],
2381
        action => [
2382
          t8('Save and Reclamation'),
2383
          call      => [ 'kivi.Order.save', 'save_and_reclamation', $::instance_conf->get_order_warn_duplicate_parts ],
2384
          only_if   => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type()))
2385
        ],
2342 2386
        action => [
2343 2387
          t8('Save and Invoice'),
2344 2388
          call      => [ 'kivi.Order.save', { action             => 'save_and_invoice',

Auch abrufbar als: Unified diff