Revision 8d987d28
Von Bernd Bleßmann vor mehr als 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
2065 | 2065 |
} |
2066 | 2066 |
} |
2067 | 2067 |
|
2068 |
# save the order
|
|
2068 |
# check for new or updated phone notes
|
|
2069 | 2069 |
# |
2070 |
# And delete items that are deleted in the form.
|
|
2071 |
sub save {
|
|
2070 |
# And put them into the order object.
|
|
2071 |
sub handle_phone_note {
|
|
2072 | 2072 |
my ($self) = @_; |
2073 | 2073 |
|
2074 |
# check for new or updated phone note |
|
2075 | 2074 |
if ($::form->{phone_note}->{subject} || $::form->{phone_note}->{body}) { |
2076 | 2075 |
if (!$::form->{phone_note}->{subject} || !$::form->{phone_note}->{body}) { |
2077 |
return [t8('Phone note needs a subject and a body.')];
|
|
2076 |
die t8('Phone note needs a subject and a body.');
|
|
2078 | 2077 |
} |
2079 | 2078 |
|
2080 | 2079 |
my $phone_note; |
2081 | 2080 |
if ($::form->{phone_note}->{id}) { |
2082 | 2081 |
$phone_note = first { $_->id == $::form->{phone_note}->{id} } @{$self->order->phone_notes}; |
2083 |
return [t8('Phone note not found for this order.')] if !$phone_note;
|
|
2082 |
die t8('Phone note not found for this order.') if !$phone_note;
|
|
2084 | 2083 |
} |
2085 | 2084 |
|
2086 | 2085 |
$phone_note = SL::DB::Note->new() if !$phone_note; |
... | ... | |
2093 | 2092 |
|
2094 | 2093 |
$self->order->add_phone_notes($phone_note) if $is_new; |
2095 | 2094 |
} |
2095 |
} |
|
2096 |
|
|
2097 |
# save the order |
|
2098 |
# |
|
2099 |
# And delete items that are deleted in the form. |
|
2100 |
sub save { |
|
2101 |
my ($self) = @_; |
|
2102 |
|
|
2103 |
$self->handle_phone_note; |
|
2096 | 2104 |
|
2097 | 2105 |
# create first version if none exists |
2098 | 2106 |
$self->order->add_order_version(SL::DB::OrderVersion->new(version => 1)) if !$self->order->order_version; |
Auch abrufbar als: Unified diff
Order-Controller: Behandlung von Telefonnotizen beim Speichern in sub ausgelagert