Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3a35d09f

Von Bernd Bleßmann vor etwa 6 Jahren hinzugefügt

  • ID 3a35d09fe5d6dbba593d2560888e7c44421c59e4
  • Vorgänger 9bfa364b
  • Nachfolger d19171d1

Auftrags-Controller: Beleg vor drucken und E-mailen speichern.

Das nur bei "speichern" auch gespeichert wird, ist vielleicht konsequent, aber
im Alltag eher unpraktisch. Viele Anwender hatten damit ein Problem, dass die
verschickte oder gedruckte Version des Belegs anders ist, als die gespeicherte,
weil oft nicht daran gedacht wurde, nach der letzten Änderung und nach dem
Drucken/versenden nochmals zu speichern.

Deshalb wird jetzt beim Drucken und E-Mailen immer gespeichert.

Unterschiede anzeigen:

SL/Controller/Order.pm
210 210
sub action_print {
211 211
  my ($self) = @_;
212 212

  
213
  my $errors = $self->save();
214

  
215
  if (scalar @{ $errors }) {
216
    $self->js->flash('error', $_) foreach @{ $errors };
217
    return $self->js->render();
218
  }
219

  
220
  $self->js->val('#id', $self->order->id)
221
           ->val('#order_' . $self->nr_key(), $self->order->number);
222

  
213 223
  my $format      = $::form->{print_options}->{format};
214 224
  my $media       = $::form->{print_options}->{media};
215 225
  my $formname    = $::form->{print_options}->{formname};
......
370 380
sub action_send_email {
371 381
  my ($self) = @_;
372 382

  
383
  my $errors = $self->save();
384

  
385
  if (scalar @{ $errors }) {
386
    $self->js->run('kivi.Order.close_email_dialog');
387
    $self->js->flash('error', $_) foreach @{ $errors };
388
    return $self->js->render();
389
  }
390

  
391
  $self->js->val('#id', $self->order->id)
392
           ->val('#order_' . $self->nr_key(), $self->order->number);
393

  
373 394
  my $email_form  = delete $::form->{email_form};
374 395
  my %field_names = (to => 'email');
375 396

  
......
417 438
  $intnotes   .= t8('Subject')    . ": " . $::form->{subject}                                                         . "\n\n";
418 439
  $intnotes   .= t8('Message')    . ": " . $::form->{message};
419 440

  
441
  $self->order->update_attributes(intnotes => $intnotes);
442

  
420 443
  $self->js
421 444
      ->val('#order_intnotes', $intnotes)
422 445
      ->run('kivi.Order.close_email_dialog')
......
1565 1588
          t8('Export'),
1566 1589
        ],
1567 1590
        action => [
1568
          t8('Print'),
1569
          call => [ 'kivi.Order.show_print_options' ],
1591
          t8('Save and print'),
1592
          call => [ 'kivi.Order.show_print_options', $::instance_conf->get_order_warn_duplicate_parts ],
1570 1593
        ],
1571 1594
        action => [
1572
          t8('E-mail'),
1573
          call => [ 'kivi.Order.email' ],
1595
          t8('Save and E-mail'),
1596
          call => [ 'kivi.Order.email', $::instance_conf->get_order_warn_duplicate_parts ],
1574 1597
        ],
1575 1598
        action => [
1576 1599
          t8('Download attachments of all parts'),
......
1790 1813

  
1791 1814
=item *
1792 1815

  
1793
Save order only on "save" (and "save and delivery order"-workflow). No
1794
hidden save on "print" or "email".
1795

  
1796
=item *
1797

  
1798 1816
Item list in a scrollable area, so that the workflow buttons stay at
1799 1817
the bottom.
1800 1818

  
js/kivi.Order.js
14 14
    return true;
15 15
  };
16 16

  
17
  ns.check_save_duplicate_parts = function() {
17
  ns.check_duplicate_parts = function(question) {
18 18
    var id_arr = $('[name="order.orderitems[].parts_id"]').map(function() { return this.value; }).get();
19 19

  
20 20
    var i, obj = {}, pos = [];
......
28 28
    }
29 29

  
30 30
    if (pos.length > 0) {
31
      question = question || kivi.t8("Do you really want to save?");
31 32
      return confirm(kivi.t8("There are duplicate parts at positions") + "\n"
32 33
                     + pos.join(', ') + "\n"
33
                     + kivi.t8("Do you really want to save?"));
34
                     + question);
34 35
    }
35 36
    return true;
36 37
  };
......
46 47

  
47 48
  ns.save = function(action, warn_on_duplicates, warn_on_reqdate) {
48 49
    if (!ns.check_cv()) return;
49
    if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
50
    if (warn_on_reqdate    && !ns.check_valid_reqdate())        return;
50
    if (warn_on_duplicates && !ns.check_duplicate_parts()) return;
51
    if (warn_on_reqdate    && !ns.check_valid_reqdate())   return;
51 52

  
52 53
    var data = $('#order_form').serializeArray();
53 54
    data.push({ name: 'action', value: 'Order/' + action });
......
62 63
    $.post("controller.pl", data, kivi.eval_json_result);
63 64
  };
64 65

  
65
  ns.show_print_options = function() {
66
  ns.show_print_options = function(warn_on_duplicates) {
66 67
    if (!ns.check_cv()) return;
68
    if (warn_on_duplicates && !ns.check_duplicate_parts(kivi.t8("Do you really want to print?"))) return;
67 69

  
68 70
    kivi.popup_dialog({
69 71
      id: 'print_options',
......
93 95
    $.download("controller.pl", data);
94 96
  };
95 97

  
96
  ns.email = function() {
98
  ns.email = function(warn_on_duplicates) {
99
    if (warn_on_duplicates && !ns.check_duplicate_parts(kivi.t8("Do you really want to send by mail?"))) return;
97 100
    if (!ns.check_cv()) return;
101

  
98 102
    var data = $('#order_form').serializeArray();
99 103
    data.push({ name: 'action', value: 'Order/show_email_dialog' });
100 104

  
js/locale/de.js
43 43
"Do you really want to delete the selected documents?":"Möchten Sie wirklich diese Dateien löschen?",
44 44
"Do you really want to delete this draft?":"Möchten Sie diesen Entwurf wirklich löschen?",
45 45
"Do you really want to delete this record template?":"Möchten Sie diese Belegvorlage wirklich löschen?",
46
"Do you really want to print?":"Wollen Sie wirklich drucken?",
46 47
"Do you really want to revert to this version?":"Möchten Sie wirklich auf diese Version zurücksetzen?",
47 48
"Do you really want to save?":"Möchten Sie wirklich speichern?",
49
"Do you really want to send by mail?":"Wollen Sie den Beleg wirklich per Mail verschicken?",
48 50
"Do you really want to unimport the selected documents?":"Möchten Sie wirklich diese Dateien an die Quelle zurückgeben?",
49 51
"Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"Soll die Kontonummer \"#1\" zu \"#2\" und den Name \"#3\" zu \"#4\" geändert werden?",
50 52
"Download picture":"Bild herunterladen",
js/locale/en.js
43 43
"Do you really want to delete the selected documents?":"",
44 44
"Do you really want to delete this draft?":"",
45 45
"Do you really want to delete this record template?":"",
46
"Do you really want to print?":"",
46 47
"Do you really want to revert to this version?":"",
47 48
"Do you really want to save?":"",
49
"Do you really want to send by mail?":"",
48 50
"Do you really want to unimport the selected documents?":"",
49 51
"Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"",
50 52
"Download picture":"",
locale/de/all
1033 1033
  'Do you really want to delete this draft?' => 'Möchten Sie diesen Entwurf wirklich löschen?',
1034 1034
  'Do you really want to delete this object?' => 'Möchten Sie dieses Objekt wirklich löschen?',
1035 1035
  'Do you really want to delete this record template?' => 'Möchten Sie diese Belegvorlage wirklich löschen?',
1036
  'Do you really want to print?' => 'Wollen Sie wirklich drucken?',
1036 1037
  'Do you really want to revert to this version?' => 'Möchten Sie wirklich auf diese Version zurücksetzen?',
1037 1038
  'Do you really want to save?' => 'Möchten Sie wirklich speichern?',
1039
  'Do you really want to send by mail?' => 'Wollen Sie den Beleg wirklich per Mail verschicken?',
1038 1040
  'Do you really want to undo the selected SEPA exports? You have to reassign the export again.' => 'Möchten Sie wirklich die ausgewählten SEPA-Exports rückgängig machen? Der Export muss anschließend neu erzeugt werden.',
1039 1041
  'Do you really want to unimport the selected documents?' => 'Möchten Sie wirklich diese Dateien an die Quelle zurückgeben?',
1040 1042
  'Do you want to <b>limit</b> your search?' => 'Möchten Sie Ihre Suche <b>spezialisieren</b>?',
......
2703 2705
  'Save and AR Transaction'     => 'Speichern und Debitorenbuchung erfassen',
2704 2706
  'Save and Close'              => 'Speichern und schließen',
2705 2707
  'Save and Delivery Order'     => 'Speichern und Lieferschein',
2708
  'Save and E-mail'             => 'Speichern und E-Mail',
2706 2709
  'Save and Invoice'            => 'Speichern und Rechnung erfassen',
2707 2710
  'Save and Order'              => 'Speichern und Auftrag erfassen',
2708 2711
  'Save and Quotation'          => 'Speichern und Angebot',
......
2710 2713
  'Save and close'              => 'Speichern und schließen',
2711 2714
  'Save and execute'            => 'Speichern und ausführen',
2712 2715
  'Save and keep open'          => 'Speichern und geöffnet lassen',
2716
  'Save and print'              => 'Speichern und drucken',
2713 2717
  'Save as a new draft.'        => 'Als neuen Entwurf speichern',
2714 2718
  'Save as new'                 => 'Als neu speichern',
2715 2719
  'Save document in WebDAV repository' => 'Dokument in WebDAV-Ablage speichern',
locale/en/all
1033 1033
  'Do you really want to delete this draft?' => '',
1034 1034
  'Do you really want to delete this object?' => '',
1035 1035
  'Do you really want to delete this record template?' => '',
1036
  'Do you really want to print?' => '',
1036 1037
  'Do you really want to revert to this version?' => '',
1037 1038
  'Do you really want to save?' => '',
1039
  'Do you really want to send by mail?' => '',
1038 1040
  'Do you really want to undo the selected SEPA exports? You have to reassign the export again.' => '',
1039 1041
  'Do you really want to unimport the selected documents?' => '',
1040 1042
  'Do you want to <b>limit</b> your search?' => '',
......
2700 2702
  'Save and AR Transaction'     => '',
2701 2703
  'Save and Close'              => '',
2702 2704
  'Save and Delivery Order'     => '',
2705
  'Save and E-mail'             => '',
2703 2706
  'Save and Invoice'            => '',
2704 2707
  'Save and Order'              => '',
2705 2708
  'Save and Quotation'          => '',
......
2707 2710
  'Save and close'              => '',
2708 2711
  'Save and execute'            => '',
2709 2712
  'Save and keep open'          => '',
2713
  'Save and print'              => '',
2710 2714
  'Save as a new draft.'        => '',
2711 2715
  'Save as new'                 => '',
2712 2716
  'Save document in WebDAV repository' => '',

Auch abrufbar als: Unified diff