Part Controller - falschen Code aus kivi.Order.js wieder entfernt
[kivitendo-erp.git] / SL / DB / LetterDraft.pm
1 package SL::DB::LetterDraft;
2
3 use strict;
4
5 use SL::DB::Helper::AttrHTML;
6 use SL::DB::MetaSetup::LetterDraft;
7
8 __PACKAGE__->meta->initialize;
9
10 __PACKAGE__->attr_html('body');
11
12 # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
13 __PACKAGE__->meta->make_manager_class;
14
15 sub new_from_letter {
16   my ($class, $letter) = @_;
17
18   my $self = $class->new;
19
20   if (!ref $letter) {
21     require SL::DB::Draft;
22     $letter = SL::DB::Draft->new(id => $letter)->load;
23   }
24
25   $self->assign_attributes(map { $_ => $letter->$_ } $letter->meta->columns);
26
27   $self->id(undef);
28
29   $self;
30 }
31
32 1;