Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fc9829b3

Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt

  • ID fc9829b3ee7076be97b2b9511994d18b0c6d4b84
  • Vorgänger 1268bf67
  • Nachfolger 35c8a113

Auftrags-Controller: Beleg neu laden nach "Speichern und drucken" auch bei Fehler

Wenn nach dem Speichern ein Fehler auftritt, Beleg neu laden mit redirect.
Gleiche Problematik/Begründung wie in commit
1268bf670c06f5a66ad78a75e41ad6c15061d9bc

Unterschiede anzeigen:

SL/Controller/Order.pm
291 291

  
292 292
  $self->js_reset_order_and_item_ids_after_save;
293 293

  
294
  my $redirect_url = $self->url_for(
295
    action => 'edit',
296
    type   => $self->type,
297
    id     => $self->order->id,
298
  );
299

  
294 300
  my $format      = $::form->{print_options}->{format};
295 301
  my $media       = $::form->{print_options}->{media};
296 302
  my $formname    = $::form->{print_options}->{formname};
......
300 306

  
301 307
  # only PDF, OpenDocument & HTML for now
302 308
  if (none { $format eq $_ } qw(pdf opendocument opendocument_pdf html)) {
303
    return $self->js->flash('error', t8('Format \'#1\' is not supported yet/anymore.', $format))->render;
309
    flash_later('error', t8('Format \'#1\' is not supported yet/anymore.', $format));
310
    return $self->js->redirect_to($redirect_url)->render;
304 311
  }
305 312

  
306 313
  # only screen or printer by now
307 314
  if (none { $media eq $_ } qw(screen printer)) {
308
    return $self->js->flash('error', t8('Media \'#1\' is not supported yet/anymore.', $media))->render;
315
    flash_later('error', t8('Media \'#1\' is not supported yet/anymore.', $media));
316
    return $self->js->redirect_to($redirect_url)->render;
309 317
  }
310 318

  
311 319
  # create a form for generate_attachment_filename
......
325 333
                                            printer_id => $printer_id,
326 334
                                            groupitems => $groupitems });
327 335
  if (scalar @errors) {
328
    return $self->js->flash('error', t8('Generating the document failed: #1', $errors[0]))->render;
336
    flash_later('error', t8('Generating the document failed: #1', $errors[0]));
337
    return $self->js->redirect_to($redirect_url)->render;
329 338
  }
330 339

  
331 340
  if ($media eq 'screen') {
......
356 365

  
357 366
  $self->save_history('PRINTED');
358 367

  
359
  my @redirect_params = (
360
    action => 'edit',
361
    type   => $self->type,
362
    id     => $self->order->id,
363
  );
364
  $self->js->redirect_to($self->url_for(@redirect_params))->render;
368
  $self->js->redirect_to($redirect_url)->render;
365 369
}
366 370

  
367 371
sub action_preview_pdf {
......
375 379

  
376 380
  $self->js_reset_order_and_item_ids_after_save;
377 381

  
382
  my $redirect_url = $self->url_for(
383
    action => 'edit',
384
    type   => $self->type,
385
    id     => $self->order->id,
386
  );
387

  
378 388
  my $format      = 'pdf';
379 389
  my $media       = 'screen';
380 390
  my $formname    = $self->type;
......
396 406
                                            language   => $self->order->language,
397 407
                                          });
398 408
  if (scalar @errors) {
399
    return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render;
409
    flash_later('error', t8('Conversion to PDF failed: #1', $errors[0]));
410
    return $self->js->redirect_to($redirect_url)->render;
400 411
  }
412

  
401 413
  $self->save_history('PREVIEWED');
414

  
402 415
  flash_later('info', t8('The PDF has been previewed'));
416

  
403 417
  # screen/download
404 418
  $self->send_file(
405 419
    \$pdf,
......
408 422
    js_no_render => 1,
409 423
  );
410 424

  
411
  my @redirect_params = (
412
    action => 'edit',
413
    type   => $self->type,
414
    id     => $self->order->id,
415
  );
416
  $self->js->redirect_to($self->url_for(@redirect_params))->render;
425
  $self->js->redirect_to($redirect_url)->render;
417 426
}
418 427

  
419 428
# open the email dialog

Auch abrufbar als: Unified diff