Rechnungsmaske: "Browser-Zurück verhindern" konfigurierbar in Mandantenkonfig
[kivitendo-erp.git] / SL / DB / EmailJournal.pm
1 package SL::DB::EmailJournal;
2
3 use strict;
4
5 use SL::DB::MetaSetup::EmailJournal;
6 use SL::DB::Manager::EmailJournal;
7 use SL::DB::Helper::AttrSorted;
8
9 __PACKAGE__->meta->add_relationship(
10   attachments  => {
11     type       => 'one to many',
12     class      => 'SL::DB::EmailJournalAttachment',
13     column_map => { id => 'email_journal_id' },
14   },
15 );
16
17 __PACKAGE__->meta->initialize;
18
19 __PACKAGE__->attr_sorted('attachments');
20
21 sub compare_to {
22   my ($self, $other) = @_;
23
24   return -1 if  $self->sent_on && !$other->sent_on;
25   return  1 if !$self->sent_on &&  $other->sent_on;
26
27   my $result = 0;
28   $result    = $other->sent_on <=> $self->sent_on;
29   return $result || ($self->id <=> $other->id);
30 }
31
32 1;
33
34 __END__
35
36 =pod
37
38 =encoding utf8
39
40 =head1 NAME
41
42 SL::DB::EmailJournal - RDBO model for email journal
43
44 =head1 SYNOPSIS
45
46 This is a standard Rose::DB::Object based model and can be used as one.
47
48 =head1 METHODS
49
50 =over 4
51
52 =item C<compare_to $self, $other>
53
54 Compares C<$self> with C<$other> and returns the newer entry.
55
56 =back
57
58 =cut
59