Revision d1b98276
Von Bernd Bleßmann vor fast 2 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
2025 | 2025 |
} |
2026 | 2026 |
} |
2027 | 2027 |
|
2028 |
# save the order
|
|
2028 |
# check for new or updated phone notes
|
|
2029 | 2029 |
# |
2030 |
# And delete items that are deleted in the form.
|
|
2031 |
sub save {
|
|
2030 |
# And put them into the order object.
|
|
2031 |
sub handle_phone_note {
|
|
2032 | 2032 |
my ($self) = @_; |
2033 | 2033 |
|
2034 |
# check for new or updated phone note |
|
2035 | 2034 |
if ($::form->{phone_note}->{subject} || $::form->{phone_note}->{body}) { |
2036 | 2035 |
if (!$::form->{phone_note}->{subject} || !$::form->{phone_note}->{body}) { |
2037 |
return [t8('Phone note needs a subject and a body.')];
|
|
2036 |
die t8('Phone note needs a subject and a body.');
|
|
2038 | 2037 |
} |
2039 | 2038 |
|
2040 | 2039 |
my $phone_note; |
2041 | 2040 |
if ($::form->{phone_note}->{id}) { |
2042 | 2041 |
$phone_note = first { $_->id == $::form->{phone_note}->{id} } @{$self->order->phone_notes}; |
2043 |
return [t8('Phone note not found for this order.')] if !$phone_note;
|
|
2042 |
die t8('Phone note not found for this order.') if !$phone_note;
|
|
2044 | 2043 |
} |
2045 | 2044 |
|
2046 | 2045 |
$phone_note = SL::DB::Note->new() if !$phone_note; |
... | ... | |
2053 | 2052 |
|
2054 | 2053 |
$self->order->add_phone_notes($phone_note) if $is_new; |
2055 | 2054 |
} |
2055 |
} |
|
2056 |
|
|
2057 |
# save the order |
|
2058 |
# |
|
2059 |
# And delete items that are deleted in the form. |
|
2060 |
sub save { |
|
2061 |
my ($self) = @_; |
|
2062 |
|
|
2063 |
$self->handle_phone_note; |
|
2056 | 2064 |
|
2057 | 2065 |
# create first version if none exists |
2058 | 2066 |
$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