Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5198bac4

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

  • ID 5198bac4711f0231ba26f017fac8955f874b4fef
  • Vorgänger c77980a4
  • Nachfolger 09696cb9

Unterversionen: E-Mails finaler/gesperrter Versionen neu verschicken können

Unterschiede anzeigen:

SL/Controller/Order.pm
451 451
sub action_save_and_show_email_dialog {
452 452
  my ($self) = @_;
453 453

  
454
  my $errors = $self->save();
454
  my $is_final_version = $::instance_conf->get_lock_oe_subversions    ?  # conf enabled
455
                         $self->order->id                             ?  # is saved
456
                         $self->order->is_final_version               :  # is final
457
                         undef                                        :  # is not final
458
                         undef;                                          # conf disabled
455 459

  
456
  if (scalar @{ $errors }) {
457
    $self->js->flash('error', $_) foreach @{ $errors };
458
    return $self->js->render();
459
  }
460
  if (!$is_final_version) {
461
    my $errors = $self->save();
460 462

  
461
  $self->js_reset_order_and_item_ids_after_save;
463
    if (scalar @{ $errors }) {
464
      $self->js->flash('error', $_) foreach @{ $errors };
465
      return $self->js->render();
466
    }
467

  
468
    $self->js_reset_order_and_item_ids_after_save;
469
  }
462 470

  
463 471
  my $cv_method = $self->cv;
464 472

  
......
506 514
                                  is_customer   => $self->cv eq 'customer',
507 515
                                  ALL_EMPLOYEES => \@employees_with_email,
508 516
                                  ALL_PARTNER_EMAIL_ADDRESSES => $all_partner_email_addresses,
517
                                  is_final_version => $is_final_version,
509 518
  );
510 519

  
511 520
  $self->js
......
518 527
sub action_send_email {
519 528
  my ($self) = @_;
520 529

  
521
  my $errors = $self->save();
530
  my $is_final_version = $::instance_conf->get_lock_oe_subversions    ?  # conf enabled
531
                         $self->order->id                             ?  # is saved
532
                         $self->order->is_final_version               :  # is final
533
                         undef                                        :  # is not final
534
                         undef;                                          # conf disabled
522 535

  
523
  if (scalar @{ $errors }) {
524
    $self->js->run('kivi.Order.close_email_dialog');
525
    $self->js->flash('error', $_) foreach @{ $errors };
526
    return $self->js->render();
527
  }
536
  if (!$is_final_version) {
537
    my $errors = $self->save();
528 538

  
529
  $self->js_reset_order_and_item_ids_after_save;
539
    if (scalar @{ $errors }) {
540
      $self->js->run('kivi.Order.close_email_dialog');
541
      $self->js->flash('error', $_) foreach @{ $errors };
542
      return $self->js->render();
543
    }
544

  
545
    $self->js_reset_order_and_item_ids_after_save;
546
  }
530 547

  
531 548
  my @redirect_params = (
532 549
    action => 'edit',
......
575 592
                                 print_variant => $::form->{formname});
576 593
  }
577 594

  
578
  if ($::form->{attachment_policy} ne 'no_file' && !($::form->{attachment_policy} eq 'old_file' && $attfile)) {
595
  if ($is_final_version && $::form->{attachment_policy} eq 'old_file' && !$attfile) {
596
    $::form->error(t8('Re-sending a final version was requested, but the latest version of the document could not be found'));
597
  }
598

  
599
  if (!$is_final_version && $::form->{attachment_policy} ne 'no_file' && !($::form->{attachment_policy} eq 'old_file' && $attfile)) {
579 600
    my $doc;
580 601
    my @errors = $self->generate_doc(\$doc, {media      => $::form->{media},
581 602
                                             format     => $::form->{print_options}->{format},
......
620 641
    $self->order->update_attributes(intnotes => $intnotes);
621 642
  }
622 643

  
623
  if ($::instance_conf->get_lock_oe_subversions) {
644
  if ($::instance_conf->get_lock_oe_subversions && !$is_final_version) {
624 645
    my $file_id;
625 646
    if ($::instance_conf->get_doc_storage && $::form->{attachment_policy} ne 'no_file') {
626 647
      # self is generated on the fly. form is a file from the dms
......
2403 2424
                    : $is_final_version ? t8('This record is the final version. Please create a new sub-version') : undef,
2404 2425
        ],
2405 2426
        action => [
2406
          t8('Save and E-mail'),
2427
          ($is_final_version ? t8('E-mail') : t8('Save and E-mail')),
2407 2428
          id       => 'save_and_email_action',
2408 2429
          call     => [ 'kivi.Order.save', { action             => 'save_and_show_email_dialog',
2409 2430
                                             warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
......
2411 2432
          ],
2412 2433
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
2413 2434
                    : !$self->order->id ? t8('This object has not been saved yet.')
2414
                    : $is_final_version ? t8('This record is the final version. Please create a new sub-version') : undef,
2435
                    : undef,
2415 2436
        ],
2416 2437
        action => [
2417 2438
          t8('Download attachments of all parts'),
locale/de/all
2826 2826
  'Ranges of numbers'           => 'Nummernkreise',
2827 2827
  'Re-numbering all sections and function blocks in the order they are currently shown cannot be undone.' => 'Das Neu-Nummerieren aller Abschnitte und Funktionsblöcke kann nicht rückgängig gemacht werden.',
2828 2828
  'Re-run analysis'             => 'Analyse wiederholen',
2829
  'Re-sending a final version was requested, but the latest version of the document could not be found' => 'Erneutes Senden einer finalen Version wurde gewünscht, aber die letzte Version des Belegausdrucks konnte nicht gefunden werden',
2829 2830
  'Read all employee e-mails'   => 'Ansehen der E-Mails aller Mitarbeiter',
2830 2831
  'Really cancel link?'         => 'Verknüpfung wirklich aufheben?',
2831 2832
  'Realm'                       => 'Realm',
......
3117 3118
  'Send invoice via email'      => 'Rechnung via E-Mail verschicken',
3118 3119
  'Send printout of record'     => 'Belegausdruck mitschicken',
3119 3120
  'Send the last or create the first version for this record' => 'Den zuletzt erstellten oder neuen Belegausdruck verschicken',
3121
  'Send the last version for this record' => 'Den zuletzt erstellten Belegausdruck verschicken',
3120 3122
  'Sender'                      => 'AbsenderIn',
3121 3123
  'Sent emails can be optionally stored in the database with or without their attachments.' => 'Gesendete E-Mails können optional mit oder ohne ihre Anhänge in der Datenbank gespeichert werden.',
3122 3124
  'Sent on'                     => 'Verschickt am',
......
3940 3942
  'This record has not been saved yet.' => 'Der Beleg wurde noch nicht gespeichert.',
3941 3943
  'This record has not been stocked in. Proceed?' => 'Dieser Beleg wurde noch nicht eingelagert. Fortfahren?',
3942 3944
  'This record has not been stocked out. Proceed?' => 'Dieser Beleg wurde noch nicht ausgelagert. Fortfahren?',
3945
  'This record is the final version. Changes have not been saved' => 'Dies ist eine finale Version des Dokuments. Änderungen wurden nicht gespeichert',
3943 3946
  'This record is the final version. Please create a new sub-version' => 'Diese Version ist nicht mehr bearbeitbar. Bitte erstellen Sie eine neue Unterversion',
3944 3947
  'This requirement spec is currently linked to the following project:' => 'Dieses Pflichtenheft ist mit dem folgenden Projekt verknüpft:',
3945 3948
  'This requirement spec is currently not linked to a project.' => 'Dieses Pflichtenheft ist noch nicht mit einem Projekt verknüpft.',
locale/en/all
2826 2826
  'Ranges of numbers'           => '',
2827 2827
  'Re-numbering all sections and function blocks in the order they are currently shown cannot be undone.' => '',
2828 2828
  'Re-run analysis'             => '',
2829
  'Re-sending a final version was requested, but the latest version of the document could not be found' => '',
2829 2830
  'Read all employee e-mails'   => '',
2830 2831
  'Really cancel link?'         => '',
2831 2832
  'Realm'                       => '',
......
3117 3118
  'Send invoice via email'      => '',
3118 3119
  'Send printout of record'     => '',
3119 3120
  'Send the last or create the first version for this record' => '',
3121
  'Send the last version for this record' => '',
3120 3122
  'Sender'                      => '',
3121 3123
  'Sent emails can be optionally stored in the database with or without their attachments.' => '',
3122 3124
  'Sent on'                     => '',
......
3939 3941
  'This record has not been saved yet.' => '',
3940 3942
  'This record has not been stocked in. Proceed?' => '',
3941 3943
  'This record has not been stocked out. Proceed?' => '',
3944
  'This record is the final version. Changes have not been saved' => '',
3942 3945
  'This record is the final version. Please create a new sub-version' => '',
3943 3946
  'This requirement spec is currently linked to the following project:' => '',
3944 3947
  'This requirement spec is currently not linked to a project.' => '',
templates/webpages/common/_send_email_dialog.html
23 23
  [% END %]
24 24
[% END %]
25 25

  
26
[%- IF is_final_version %]
27
  <div class="flash_message_warning">[% LxERP.t8('This record is the final version. Changes have not been saved') %]</div>
28
[%- END %]
29

  
26 30
<table>
27 31
 <tbody>
28 32
  <tr>
......
90 94
  <tr>
91 95
   <th align="right" nowrap>[% LxERP.t8("Send printout of record") %]</th>
92 96
   <td>
93
    [% SET no_file_label = have_files ? LxERP.t8("Don't include a printout of the record with the email, only selected files") : LxERP.t8("Don't include a printout of the record with the email") ;
94
           options       = [
97
    [% SET no_file_label = have_files ? LxERP.t8("Don't include a printout of the record with the email, only selected files") : LxERP.t8("Don't include a printout of the record with the email") %]
98
      [%- IF is_final_version %]
99
        [% options       = [
100
             [ "old_file", LxERP.t8("Send the last version for this record") ],
101
             [ "no_file",  no_file_label ],
102
           ] %]
103
      [%- ELSE %]
104
        [% options       = [
95 105
             [ "old_file", LxERP.t8("Send the last or create the first version for this record") ],
96 106
             [ "normal",   LxERP.t8("Create and send a new printout for this record") ],
97 107
             [ "no_file",  no_file_label ],
98
           ] ;
99
       L.select_tag("email_form.attachment_policy", options, onchange="kivi.SalesPurchase.activate_send_email_actions_regarding_printout()") %]
108
           ] %]
109
      [%- END %]
110
      [% L.select_tag("email_form.attachment_policy", options, onchange="kivi.SalesPurchase.activate_send_email_actions_regarding_printout()") %]
100 111
   </td>
101 112
  </tr>
102 113
[% END %]

Auch abrufbar als: Unified diff