Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b4a40a3c

Von Tamino Steinert vor 2 Monaten hinzugefügt

  • ID b4a40a3c36d9856ca5fd15a54122634feb90d3fa
  • Vorgänger 3ac8bdc7
  • Nachfolger 31d1d9af

EmailJournal: Verarbeitet-Status von Anhängen per Button ändern

Unterschiede anzeigen:

SL/Controller/EmailJournal.pm
551 551
  return;
552 552
}
553 553

  
554
sub action_toggle_attachment_processed {
555
  my ($self) = @_;
556

  
557
  $::auth->assert('email_journal');
558

  
559
  my $attachment = SL::DB::EmailJournalAttachment->new(
560
    id => $::form->{attachment_id}
561
  )->load();
562
  $self->entry($attachment->email_journal);
563

  
564
  if (!$self->can_view_all && ($self->entry->sender_id != SL::DB::Manager::Employee->current->id)) {
565
    $::form->error(t8('You do not have permission to access this entry.'));
566
  }
567

  
568
  $attachment->processed(!$attachment->processed);
569
  $attachment->save;
570

  
571
  $self->js
572
  ->html('#processed_' . $attachment->id, $attachment->processed_as_bool_yn)
573
  ->flash('info',
574
    $attachment->processed ?
575
      t8('Attachment \'#1\' set to processed.', $attachment->name)
576
    : t8('Attachment \'#1\' set to unprocessed.', $attachment->name)
577
  )->render();
578

  
579
  return;
580
}
581

  
554 582
#
555 583
# filters
556 584
#
js/kivi.EmailJournal.js
72 72

  
73 73
    $.post("controller.pl", data, kivi.eval_json_result);
74 74
  }
75

  
76
  ns.toggle_attachment_processed = function(attachment_id) {
77
    let data = $('#record_action_form').serializeArray();
78
    data.push({ name: 'action', value: 'EmailJournal/toggle_attachment_processed' });
79
    data.push({ name: 'attachment_id', value: attachment_id });
80

  
81
    $.post("controller.pl", data, kivi.eval_json_result);
82
  }
75 83
});
locale/de/all
447 447
  'Attach PDF:'                 => 'PDF anhängen',
448 448
  'Attached Filename'           => 'Name des Dateianhangs',
449 449
  'Attachment'                  => 'als Anhang',
450
  'Attachment \'#1\' set to processed.' => 'Anhang \'#1\' auf verarbeitet gesetzt.',
451
  'Attachment \'#1\' set to unprocessed.' => 'Anhang \'#1\' auf nicht verarbeitet gesetzt.',
450 452
  'Attachment name'             => 'Name des Anhangs',
451 453
  'Attachments'                 => 'Dateianhänge',
452 454
  'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.',
......
4537 4539
  'To user login'               => 'Zum Benutzerlogin',
4538 4540
  'Today'                       => 'heute',
4539 4541
  'Toggle marker'               => 'Markierung umschalten',
4542
  'Toggle processed'            => 'Verarbeitet-Status umschalten',
4540 4543
  'Toggle selection'            => 'Auswahl umkehren',
4541 4544
  'Too many results (#1 from #2).' => 'Zu viele Artikel (#1 von #2)',
4542 4545
  'Too much recursions in assembly tree (>100)' => 'Zu tiefe Verschachtelung (>100) des Erzeugnisbaum',
locale/en/all
447 447
  'Attach PDF:'                 => '',
448 448
  'Attached Filename'           => '',
449 449
  'Attachment'                  => '',
450
  'Attachment \'#1\' set to processed.' => '',
451
  'Attachment \'#1\' set to unprocessed.' => '',
450 452
  'Attachment name'             => '',
451 453
  'Attachments'                 => '',
452 454
  'Attempt to call an undefined sub named \'%s\'' => '',
......
4535 4537
  'To user login'               => '',
4536 4538
  'Today'                       => '',
4537 4539
  'Toggle marker'               => '',
4540
  'Toggle processed'            => '',
4538 4541
  'Toggle selection'            => '',
4539 4542
  'Too many results (#1 from #2).' => '',
4540 4543
  'Too much recursions in assembly tree (>100)' => '',
templates/design40_webpages/email_journal/show.html
34 34
        <th>[% 'MIME type' | $T8 %]</th>
35 35
        <th>[% 'Size' | $T8 %]</th>
36 36
        <th>[% 'Processed' | $T8 %]</th>
37
        <th>[% 'Action' | $T8 %]</th>
37 38
      </tr>
38 39
    </thead>
39 40
    <tbody>
......
42 43
        <td>[% L.link(SELF.url_for(action="download_attachment", id=attachment.id), attachment.name) %]</td>
43 44
        <td>[% HTML.escape(attachment.mime_type) %]</td>
44 45
        <td>[% HTML.escape(LxERP.format_amount(attachment.content.length, 0)) %]</td>
45
        <td>[% HTML.escape(attachment.processed_as_bool_yn) %]</td>
46
        <td id="[% "processed_" _ attachment.id %]">
47
          [% HTML.escape(attachment.processed_as_bool_yn) %]
48
        </td>
49
        <td> [% L.button_tag(
50
            "kivi.EmailJournal.toggle_attachment_processed(" _ attachment.id _ ")",
51
            LxERP.t8("Toggle processed")
52
            ) %]
53
        </td>
46 54
      </tr>
47 55
      [% END %]
48 56
    </tbody>
templates/webpages/email_journal/show.html
24 24
     <th>[% LxERP.t8("MIME type") %]</th>
25 25
     <th>[% LxERP.t8("Size") %]</th>
26 26
     <th>[% LxERP.t8("Processed") %]</th>
27
     <th>[% 'Action' | $T8 %]</th>
27 28
    </tr>
28 29
   </thead>
29 30

  
......
33 34
      <td>[% L.link(SELF.url_for(action="download_attachment", id=attachment.id), attachment.name) %]</td>
34 35
      <td>[% HTML.escape(attachment.mime_type) %]</td>
35 36
      <td>[% HTML.escape(LxERP.format_amount(attachment.content.length, 0)) %]</td>
36
      <td>[% HTML.escape(attachment.processed_as_bool_yn) %]</td>
37
      <td id="[% "processed_" _ attachment.id %]">
38
        [% HTML.escape(attachment.processed_as_bool_yn) %]
39
      </td>
40
      <td> [% L.button_tag(
41
          "kivi.EmailJournal.toggle_attachment_processed(" _ attachment.id _ ")",
42
          LxERP.t8("Toggle processed")
43
          ) %]
44
      </td>
37 45
     </tr>
38 46
    [% END %]
39 47
   </tbody>

Auch abrufbar als: Unified diff