Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6896a6ed

Von Werner Hahn vor 5 Monaten hinzugefügt

  • ID 6896a6edb009739fabb7d6ae80eab1cc63afb988
  • Vorgänger 6670c15e
  • Nachfolger b3a94438

DeliveryOrder: Print flash auf flash_later und redirect auf gespeichertes Objekt

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
299 299

  
300 300
  # only pdf and opendocument by now
301 301
  if (none { $format eq $_ } qw(pdf opendocument opendocument_pdf)) {
302
    return $self->js->flash('error',
303
      t8('Format \'#1\' is not supported yet/anymore.', $format)
304
    )->render;
302
    flash_later('error', t8('Format \'#1\' is not supported yet/anymore.', $format));
303
    return $self->js->redirect_to($redirect_url)->render;
305 304
  }
306 305

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

  
314 312
  # create a form for generate_attachment_filename
......
329 327
      groupitems => $groupitems
330 328
    });
331 329
  if (scalar @errors) {
332
    return $self->js->flash('error',
333
      t8('Conversion to PDF failed: #1', $errors[0])
334
    )->render;
330
    flash_later('error', t8('Generating the document failed: #1', $errors[0]));
331
    return $self->js->redirect_to($redirect_url)->render;
335 332
  }
336 333

  
337 334
  if ($media eq 'screen') {
338 335
    # screen/download
339
    $self->js->flash('info', t8('The PDF has been created'));
336
    flash_later('info', t8('The document has been created.'));
340 337
    $self->send_file(
341 338
      \$pdf,
342 339
      type         => SL::MIME->mime_type_from_ext($pdf_filename),
......
352 349
      content => $pdf,
353 350
    );
354 351

  
355
    $self->js->flash('info', t8('The PDF has been printed'));
352
    flash_later('info', t8('The document has been printed.'));
356 353
  }
357 354

  
358 355
  my @warnings = store_pdf_to_webdav_and_filemanagement(
359 356
    $self->order, $pdf, $pdf_filename
360 357
  );
361 358
  if (scalar @warnings) {
362
    $self->js->flash('warning', $_) for @warnings;
359
    flash_later('warning', $_) for @warnings;
363 360
  }
364 361

  
365 362
  $self->save_history('PRINTED');
366 363

  
367 364
  $self->js->redirect_to($redirect_url)->render;
368 365
}
366

  
369 367
sub action_preview_pdf {
370 368
  my ($self) = @_;
371 369

  

Auch abrufbar als: Unified diff