Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c1ed1e91

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID c1ed1e9171b8b02604c95ed378204c9202f0e641
  • Vorgänger 40c2f024
  • Nachfolger 77f30228

Workflow: order ↔ reclamation

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
68 68
                          save save_as_new print preview_pdf send_email
69 69
                          save_and_show_email_dialog
70 70
                          workflow_save_and_sales_or_purchase_reclamation
71
                          save_and_order
71 72
                       )]);
72 73

  
73 74
__PACKAGE__->run_before('get_unalterable_data',
......
75 76
                          save save_as_new print preview_pdf send_email
76 77
                          save_and_show_email_dialog
77 78
                          workflow_save_and_sales_or_purchase_reclamation
79
                          save_and_order
78 80
                        )]);
79 81

  
80 82
#
......
96 98
  );
97 99
}
98 100

  
101
sub action_add_from_order {
102
  my ($self) = @_;
103

  
104
  unless ($::form->{from_id}) {
105
    $self->js->flash('error', t8("Can't create new reclamation. No 'from_id' was given."));
106
    return $self->js->render();
107
  }
108

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

  
113
  $self->reclamation($reclamation);
114

  
115
  $self->reinit_after_new_reclamation();
116

  
117
  $self->render(
118
    'reclamation/form',
119
    title => $self->get_title_for('add'),
120
    %{$self->{template_args}},
121
  );
122
}
123

  
99 124
# edit an existing reclamation
100 125
sub action_edit {
101 126
  my ($self) = @_;
......
467 492
  $self->redirect_to(@redirect_params);
468 493
}
469 494

  
495
sub action_save_and_order {
496
  my ($self) = @_;
497

  
498
  my $to_type = $self->reclamation->is_sales ? 'sales_order'
499
                                             : 'purchase_order';
500
  $self->save_and_redirect_to(
501
    controller => 'Order',
502
    action     => 'add_from_reclamation',
503
    type       => $to_type,
504
    from_id    => $self->reclamation->id,
505
  );
506
}
507

  
470 508
# workflow from purchase to sales reclamation
471 509
sub action_save_and_sales_reclamation {
472 510
  $_[0]->workflow_save_and_sales_or_purchase_reclamation();
......
1578 1616
  my ($self) = @_;
1579 1617
  my %allowed_linked_records = map {$_ => 1} qw(
1580 1618
    SL::DB::Reclamation
1619
    SL::DB::Order
1581 1620
  );
1582 1621
  my %allowed_linked_record_items = map {$_ => 1} qw(
1583 1622
    SL::DB::ReclamationItem
1623
    SL::DB::OrderItem
1584 1624
  );
1585 1625

  
1586 1626
  my $from_record_id = delete $::form->{converted_from_record_id};
......
2085 2125
          call      => [ 'kivi.Reclamation.purchase_reclamation_check_for_direct_delivery' ],
2086 2126
          only_if   => (any { $self->type eq $_ } (sales_reclamation_type())),
2087 2127
        ],
2128
        action => [
2129
          t8('Save and Order'),
2130
          call      => [
2131
            'kivi.Reclamation.save', 'save_and_order',
2132
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2133
            $::instance_conf->get_reclamation_warn_no_reqdate,
2134
          ],
2135
        ],
2088 2136
      ], # end of combobox "Workflow"
2089 2137

  
2090 2138
      combobox => [

Auch abrufbar als: Unified diff