Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b55ff8df

Von Tamino Steinert vor 9 Monaten hinzugefügt

  • ID b55ff8df9140b9b71658ebb3028538a399e8dab9
  • Vorgänger 7138b173
  • Nachfolger bf0cbcd2

EmailJournal: Report um Obsolete, Belegtype und Verknüpft erweitert

Unterschiede anzeigen:

SL/Controller/EmailJournal.pm
209 209
      ($_->{customervendor} eq $customer_vendor_type)
210 210
      && ($action eq 'workflow_record' ? $_->{can_workflow} : 1)
211 211
      && ($action eq 'create_new'      ? $_->{workflow_needed} : 1)
212
      && ($action eq 'linking_record'  ? $_->{record_type} !~ /_template$/ : 1)
213
      && ($action eq 'template_record' ? $_->{record_type} =~ /_template$/ : 1)
212
      && ($action eq 'linking_record'  ? !$_->{is_template} : 1)
213
      && ($action eq 'template_record' ? $_->{is_template} : 1)
214 214
    }
215 215
    $self->get_record_types_with_info()
216 216
  ];
......
224 224
  my ($self) = @_;
225 225

  
226 226
  $::auth->assert('email_journal');
227
  # default filter
228
  $::form->{filter} ||= {"obsolete:eq_ignore_empty" => 0};
227 229

  
228 230
  if ( $::instance_conf->get_email_journal == 0 ) {
229 231
    flash('info',  $::locale->text('Storing the emails in the journal is currently disabled in the client configuration.'));
230 232
  }
231 233
  $self->setup_list_action_bar;
234
  my @record_types_with_info = $self->get_record_types_with_info();
232 235
  $self->render('email_journal/list',
233 236
                title   => $::locale->text('Email journal'),
234 237
                ENTRIES => $self->models->get,
235
                MODELS  => $self->models);
238
                MODELS  => $self->models,
239
                RECORD_TYPES_WITH_INFO => \@record_types_with_info,
240
              );
236 241
}
237 242

  
238 243
sub action_show {
......
626 631
      sent_on         => t8('Sent on'),
627 632
      status          => t8('Status'),
628 633
      extended_status => t8('Extended status'),
634
      record_type     => t8('Record Type'),
635
      obsolete        => t8('Obsolete'),
629 636
      linked_to       => t8('Linked to'),
630 637
    },
631 638
  );
......
650 657
    send_failed     => $::locale->text('send failed'),
651 658
    sent            => $::locale->text('sent'),
652 659
    imported        => $::locale->text('imported'),
653
    record_imported => $::locale->text('record imported'),
654 660
  );
655 661
  push @filter_strings, $status{ $filter->{'status:eq_ignore_empty'} } if $filter->{'status:eq_ignore_empty'};
656 662

  
663

  
664
  my %record_type = map { $_->{record_type} => $_->{text} } $self->get_record_types_with_info();
665
  push @filter_strings, $record_type{ $filter->{'record_type:eq_ignore_empty'} } if $filter->{'record_type:eq_ignore_empty'};
666

  
667
  push @filter_strings, $::locale->text('Obsolete')     if $filter->{'obsolete:eq_ignore_empty'} eq '1';
668
  push @filter_strings, $::locale->text('Not obsolete') if $filter->{'obsolete:eq_ignore_empty'} eq '0';
669

  
670
  push @filter_strings, $::locale->text('Linked')       if $filter->{'linked_to:eq_ignore_empty'} eq '1';
671
  push @filter_strings, $::locale->text('Not linked')   if $filter->{'linked_to:eq_ignore_empty'} eq '0';
672

  
657 673
  return join ', ', @filter_strings;
658 674
}
659 675

  
SL/DB/Manager/EmailJournal.pm
6 6

  
7 7
use SL::DB::Helper::Paginated;
8 8
use SL::DB::Helper::Sorted;
9
use SL::DB::Helper::Filtered;
9 10

  
10 11
sub object_class { 'SL::DB::EmailJournal' }
11 12

  
12 13
__PACKAGE__->make_manager_methods;
13 14

  
15
__PACKAGE__->add_filter_specs(
16
  linked_to => sub {
17
    my ($key, $value, $prefix) = @_;
18

  
19
    # if $value is truish, we want at least one link otherwise we want none
20
    my $comp = !!$value ? '>' : '=';
21

  
22
    # table emial_journal is aliased as t1
23
    return
24
      \qq{(
25
        SELECT CASE WHEN count(*) $comp 0 THEN TRUE ELSE FALSE END
26
        FROM record_links
27
        WHERE (
28
            (record_links.from_table = 'email_journal'::varchar(50))
29
            AND record_links.from_id = t1.id
30
          ) OR (
31
            (record_links.to_table = 'email_journal'::varchar(50))
32
            AND record_links.to_id = t1.id
33
          )
34
        )} => \'TRUE';
35
  },
36
);
37

  
14 38
sub _sort_spec {
15 39
  return (
16 40
    default => [ 'sent_on', 0 ],
......
18 42
      SIMPLE => 'ALL',
19 43
      sender => 'sender.name',
20 44
      linked_to => qq{(
21
        SELECT count(*) from record_links where
45
        SELECT count(*)
46
        FROM record_links
47
        WHERE
22 48
          ( record_links.from_table = 'email_journal'::varchar(50)
23 49
            AND record_links.from_id = email_journal.id
24 50
          ) OR (
locale/de/all
2230 2230
  'Link to'                     => 'Verknüpfen mit',
2231 2231
  'Link to invoice'             => 'Beleglink',
2232 2232
  'Link to the following project:' => 'Mit dem folgenden Projekt verknüpfen:',
2233
  'Linked'                      => 'Verknüpft',
2233 2234
  'Linked Records'              => 'Verknüpfte Belege',
2234 2235
  'Linked email and attachment to ' => 'E-Mail und Anhang verknüpft mit ',
2235 2236
  'Linked invoices'             => 'Verknüpfte Rechnungen',
......
2580 2581
  'Not done yet'                => 'Noch nicht fertig',
2581 2582
  'Not enough in stock for the serial number #1' => 'Nicht genug auf Lager von der Seriennummer #1',
2582 2583
  'Not implemented yet!'        => 'Noch nicht implementiert!',
2584
  'Not linked'                  => 'Nicht verknüpft',
2583 2585
  'Not obsolete'                => 'Gültig',
2584 2586
  'Not yet implemented'         => 'Noch nicht implementiert',
2585 2587
  'Note'                        => 'Hinweis',
locale/en/all
2229 2229
  'Link to'                     => '',
2230 2230
  'Link to invoice'             => '',
2231 2231
  'Link to the following project:' => '',
2232
  'Linked'                      => '',
2232 2233
  'Linked Records'              => '',
2233 2234
  'Linked email and attachment to ' => '',
2234 2235
  'Linked invoices'             => '',
......
2580 2581
  'Not done yet'                => '',
2581 2582
  'Not enough in stock for the serial number #1' => '',
2582 2583
  'Not implemented yet!'        => '',
2584
  'Not linked'                  => '',
2583 2585
  'Not obsolete'                => '',
2584 2586
  'Not yet implemented'         => '',
2585 2587
  'Note'                        => '',
templates/design40_webpages/email_journal/_filter.html
30 30
               ], default=filter.status_eq_ignore_empty) %]
31 31
      </td>
32 32
    </tr>
33
    <tr>
34
      <th>[% LxERP.t8("Record Type") %]</th>
35
      <td>
36
        [%
37
          SET record_type_options = [];
38
          FOREACH record_info = RECORD_TYPES_WITH_INFO;
39
            IF (!record_info.is_template);
40
              record_type_options.push(record_info);
41
            END;
42
          END;
43
        %]
44
        [% L.select_tag("filter.record_type:eq_ignore_empty",
45
             record_type_options,
46
             title_key = 'text', value_key = 'record_type',
47
             with_empty=1, default=filter.record_type_eq_ignore_empty) %]
48
      </td>
49
    </tr>
50
    <tr>
51
      <th>[% LxERP.t8("Obsolete") %]</th>
52
      <td>[% L.yes_no_tag("filter.obsolete:eq_ignore_empty",
53
            filter.obsolete, with_empty=1,
54
            default=filter.obsolete_eq_ignore_empty
55
            ) %]
56
      </td>
57
    </tr>
58
    <tr>
59
      <th>[% LxERP.t8("Linked") %]</th>
60
      <td>[% L.yes_no_tag("filter.linked_to:eq_ignore_empty",
61
            filter.linked_to, with_empty=1,
62
            default=filter.linked_to_eq_ignore_empty
63
            ) %]
64
      </td>
65
    </tr>
33 66
    </tbody>
34 67
  </table>
35 68
  [% L.hidden_tag("sort_by", FORM.sort_by) %]
templates/design40_webpages/email_journal/list.html
25 25
      <th>[% L.sortable_table_header("sent_on") %]</th>
26 26
      <th>[% L.sortable_table_header("status") %]</th>
27 27
      <th>[% L.sortable_table_header("extended_status") %]</th>
28
      <th>[% L.sortable_table_header("record_type") %]</th>
29
      <th>[% L.sortable_table_header("obsolete") %]</th>
28 30
      <th>[% L.sortable_table_header("linked_to") %]</th>
29 31
    </tr>
30 32
  </thead>
......
40 42
      <td>[% HTML.escape(entry.sent_on.to_lxoffice('precision' => 'second')) %]</td>
41 43
      <td> [% P.email_journal.entry_status(entry) %] </td>
42 44
      <td>[% HTML.escape(entry.extended_status) %]</td>
45
      <td>[% HTML.escape(entry.record_type) %]</td>
46
      <td>[% HTML.escape(entry.obsolete_as_bool_yn) %]</td>
43 47
      <td>
44 48
        [% P.record.simple_grouped_record_list(entry.linked_records) %]
45 49
      </td>

Auch abrufbar als: Unified diff