Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bcdeb6ec

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID bcdeb6ecdf8f6bdd981167ffb0a3dafcc4408eb5
  • Vorgänger a6c54e9f
  • Nachfolger c389a0e6

Workflow: (sales/purchase) invoice → reclamation

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
146 146
  );
147 147
}
148 148

  
149
sub action_add_from_sales_invoice {
150
  my ($self) = @_;
151

  
152
  unless ($::form->{from_id}) {
153
    $self->js->flash('error', t8("Can't create new reclamation. No 'from_id' was given."));
154
    return $self->js->render();
155
  }
156

  
157
  require SL::DB::Invoice;
158
  my $invoice = SL::DB::Invoice->new(id => $::form->{from_id})->load;
159
  my $reclamation = $invoice->convert_to_reclamation();
160

  
161
  $self->reclamation($reclamation);
162

  
163
  $self->reinit_after_new_reclamation();
164

  
165
  $self->render(
166
    'reclamation/form',
167
    title => $self->get_title_for('add'),
168
    %{$self->{template_args}},
169
  );
170
}
171

  
172
sub action_add_from_purchase_invoice {
173
  my ($self) = @_;
174

  
175
  unless ($::form->{from_id}) {
176
    $self->js->flash('error', t8("Can't create new reclamation. No 'from_id' was given."));
177
    return $self->js->render();
178
  }
179

  
180
  require SL::DB::PurchaseInvoice;
181
  my $invoice = SL::DB::PurchaseInvoice->new(id => $::form->{from_id})->load;
182
  $invoice->{type} = $invoice->invoice_type; #can't add type → invoice_type in SL/DB/PurchaseInvoice
183
  my $reclamation = $invoice->convert_to_reclamation();
184

  
185
  $self->reclamation($reclamation);
186

  
187
  $self->reinit_after_new_reclamation();
188

  
189
  $self->render(
190
    'reclamation/form',
191
    title => $self->get_title_for('add'),
192
    %{$self->{template_args}},
193
  );
194
}
195

  
149 196
# edit an existing reclamation
150 197
sub action_edit {
151 198
  my ($self) = @_;
......
1658 1705
    SL::DB::Reclamation
1659 1706
    SL::DB::Order
1660 1707
    SL::DB::DeliveryOrder
1708
    SL::DB::Invoice
1709
    SL::DB::PurchaseInvoice
1661 1710
  );
1662 1711
  my %allowed_linked_record_items = map {$_ => 1} qw(
1663 1712
    SL::DB::ReclamationItem
1664 1713
    SL::DB::OrderItem
1665 1714
    SL::DB::DeliveryOrderItem
1715
    SL::DB::InvoiceItem
1666 1716
  );
1667 1717

  
1668 1718
  my $from_record_id = delete $::form->{converted_from_record_id};

Auch abrufbar als: Unified diff