Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 08c9ef5b

Von Bernd Bleßmann vor 4 Monaten hinzugefügt

  • ID 08c9ef5b951bc247eda38e50b128d3353d867a57
  • Vorgänger f4d955b9
  • Nachfolger b3475b4f

Auftragsbericht: Umwandeln in LS: Fehler abfangen

Unterschiede anzeigen:

bin/mozilla/oe.pl
35 35

  
36 36
use Carp;
37 37
use POSIX qw(strftime);
38
use Try::Tiny;
38 39

  
39 40
use SL::DB::Order;
40 41
use SL::DB::OrderItem;
......
267 268
  } grep { $_ =~ m{^multi_id_\d+$} } keys %$::form;
268 269

  
269 270
  # make new delivery orders from given orders
270
  my @orders          = map { SL::DB::Order->new(id => $_)->load } @multi_ids;
271
  my @delivery_orders = map { $_->convert_to_delivery_order() }    @orders;
272

  
273
  my @do_ids = map { $_->id } @delivery_orders;
271
  my @orders = map { SL::DB::Order->new(id => $_)->load } @multi_ids;
272
  my @do_ids;
273
  my @failed;
274
  foreach my $order (@orders) {
275
    my $delivery_order;
276
    try {
277
      $delivery_order = $order->convert_to_delivery_order();
278
    } catch {
279
      push @failed, {ordnumber => $order->ordnumber, error => $_};
280
    };
281
    push @do_ids, $delivery_order->id if $delivery_order;
282
  }
274 283

  
275 284
  require "bin/mozilla/do.pl";
276 285
  $::form->{script}        = 'do.pl';
......
279 288
  $::form->{"l_$_"}        = 'Y' for qw(donumber ordnumber cusordnumber transdate reqdate name employee);
280 289
  $::form->{top_info_text} = $::locale->text('Converted delivery orders');
281 290

  
282
  flash('info', t8('#1 salses orders were converted to #2 delivery orders', scalar @orders, scalar @delivery_orders));
291
  flash('info', t8('#1 salses orders were converted to #2 delivery orders', scalar @orders, scalar @do_ids));
292
  if (@failed) {
293
    flash('error', t8('The following orders could not be converted to delivery orders:'));
294
    flash('error', $_->{ordnumber} . ': ' . $_->{error}) for @failed;
295
  }
283 296

  
284 297
  orders();
285 298
}

Auch abrufbar als: Unified diff