Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 98c122d1

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 98c122d147b54a07bb98f4c4d9d3f85fd1b8b767
  • Vorgänger 523f5cd0
  • Nachfolger 0e3929a6

Model::Record: new_from_workflow implementiert

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
34 34

  
35 35
use SL::Controller::Helper::GetModels;
36 36

  
37
use SL::DB::Order;
38
use SL::DB::DeliveryOrder;
39
use SL::DB::Invoice;
40
use SL::Model::Record;
41

  
37 42
use List::Util qw(first sum0);
38 43
use List::UtilsBy qw(sort_by uniq_by);
39 44
use List::MoreUtils qw(any none pairwise first_index);
......
116 121
    return $self->js->render();
117 122
  }
118 123

  
119
  require SL::DB::Order;
120 124
  my $order = SL::DB::Order->new(id => $::form->{from_id})->load;
121
  my $reclamation = $order->convert_to_reclamation();
125
  my $target_type = $order->is_sales ? 'sales_reclamation'
126
                                     : 'purchase_reclamation';
127
  my $reclamation = SL::Model::Record->new_from_workflow($order, $target_type);
122 128

  
123 129
  $self->reclamation($reclamation);
124 130

  
......
143 149
    return $self->js->render();
144 150
  }
145 151

  
146
  require SL::DB::DeliveryOrder;
147 152
  my $delivery_order = SL::DB::DeliveryOrder->new(id => $::form->{from_id})->load;
148
  my $reclamation = $delivery_order->convert_to_reclamation();
153
  my $target_type = $delivery_order->is_sales ? 'sales_reclamation'
154
                                              : 'purchase_reclamation';
155
  my $reclamation = SL::Model::Record->new_from_workflow($delivery_order, $target_type);
149 156

  
150 157
  $self->reclamation($reclamation);
151 158

  
......
170 177
    return $self->js->render();
171 178
  }
172 179

  
173
  require SL::DB::Invoice;
174 180
  my $invoice = SL::DB::Invoice->new(id => $::form->{from_id})->load;
175
  my $reclamation = $invoice->convert_to_reclamation();
181
  my $target_type = 'sales_reclamation';
182
  my $reclamation = SL::Model::Record->new_from_workflow($invoice, $target_type);
176 183

  
177 184
  $self->reclamation($reclamation);
178 185

  
......
200 207
  require SL::DB::PurchaseInvoice;
201 208
  my $invoice = SL::DB::PurchaseInvoice->new(id => $::form->{from_id})->load;
202 209
  $invoice->{type} = $invoice->invoice_type; #can't add type → invoice_type in SL/DB/PurchaseInvoice
203
  my $reclamation = $invoice->convert_to_reclamation();
210
  my $target_type = 'purchase_reclamation';
211
  my $reclamation = SL::Model::Record->new_from_workflow($invoice, $target_type);
204 212

  
205 213
  $self->reclamation($reclamation);
206 214

  

Auch abrufbar als: Unified diff