Revision 916911d2
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
33 | 33 |
use SL::DB::Shipto; |
34 | 34 |
use SL::DB::Translation; |
35 | 35 |
use SL::DB::EmailJournal; |
36 |
use SL::DB::EmailJournalAttachment; |
|
37 | 36 |
use SL::DB::ValidityToken; |
38 | 37 |
use SL::DB::Helper::RecordLink qw(set_record_link_conversions RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF); |
39 | 38 |
use SL::DB::Helper::TypeDataProxy; |
... | ... | |
160 | 159 |
|
161 | 160 |
sub action_add_from_email_journal { |
162 | 161 |
my ($self) = @_; |
163 |
my $email_journal_id = $::form->{from_id}; |
|
164 |
my $email_attachment_id = $::form->{email_attachment_id}; |
|
165 |
|
|
166 |
$self->order->{RECORD_ID()} = $email_journal_id; |
|
167 |
$self->order->{RECORD_TYPE_REF()} = 'SL::DB::EmailJournal'; |
|
168 |
$self->{email_attachment_id} = $email_attachment_id; |
|
162 |
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id}); |
|
169 | 163 |
|
170 | 164 |
$self->action_add(); |
171 | 165 |
} |
172 | 166 |
|
167 |
sub action_edit_with_email_journal_workflow { |
|
168 |
my ($self) = @_; |
|
169 |
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id}); |
|
170 |
$::form->{workflow_email_journal_id} = delete $::form->{email_journal_id}; |
|
171 |
$::form->{workflow_email_attachment_id} = delete $::form->{email_attachment_id}; |
|
172 |
|
|
173 |
$self->action_edit(); |
|
174 |
} |
|
175 |
|
|
173 | 176 |
# edit an existing order |
174 | 177 |
sub action_edit { |
175 | 178 |
my ($self) = @_; |
... | ... | |
824 | 827 |
type => $to_type, |
825 | 828 |
from_id => $self->order->id, |
826 | 829 |
from_type => $self->order->type, |
830 |
email_journal_id => $::form->{workflow_email_journal_id}, |
|
831 |
email_attachment_id => $::form->{workflow_email_attachment_id}, |
|
827 | 832 |
%additional_params, |
828 | 833 |
); |
829 | 834 |
} |
... | ... | |
836 | 841 |
$self->save_and_redirect_to( |
837 | 842 |
controller => 'oe.pl', |
838 | 843 |
action => 'oe_invoice_from_order', |
844 |
email_journal_id => $::form->{workflow_email_journal_id}, |
|
845 |
email_attachment_id => $::form->{workflow_email_attachment_id}, |
|
839 | 846 |
); |
840 | 847 |
} |
841 | 848 |
|
... | ... | |
846 | 853 |
controller => 'oe.pl', |
847 | 854 |
action => 'oe_invoice_from_order', |
848 | 855 |
new_invoice_type => 'invoice_for_advance_payment', |
856 |
email_journal_id => $::form->{workflow_email_journal_id}, |
|
857 |
email_attachment_id => $::form->{workflow_email_attachment_id}, |
|
849 | 858 |
); |
850 | 859 |
} |
851 | 860 |
|
... | ... | |
856 | 865 |
controller => 'oe.pl', |
857 | 866 |
action => 'oe_invoice_from_order', |
858 | 867 |
new_invoice_type => 'final_invoice', |
868 |
email_journal_id => $::form->{workflow_email_journal_id}, |
|
869 |
email_attachment_id => $::form->{workflow_email_attachment_id}, |
|
859 | 870 |
); |
860 | 871 |
} |
861 | 872 |
|
... | ... | |
866 | 877 |
type => $_[0]->type, |
867 | 878 |
to_type => $::form->{to_type}, |
868 | 879 |
use_shipto => $::form->{use_shipto}, |
880 |
email_journal_id => $::form->{workflow_email_journal_id}, |
|
881 |
email_attachment_id => $::form->{workflow_email_attachment_id}, |
|
869 | 882 |
); |
870 | 883 |
} |
871 | 884 |
|
... | ... | |
876 | 889 |
$self->save_and_redirect_to( |
877 | 890 |
controller => 'ap.pl', |
878 | 891 |
action => 'add_from_purchase_order', |
892 |
email_journal_id => $::form->{workflow_email_journal_id}, |
|
893 |
email_attachment_id => $::form->{workflow_email_attachment_id}, |
|
879 | 894 |
); |
880 | 895 |
} |
881 | 896 |
|
... | ... | |
2163 | 2178 |
set_project_in_linked_requirement_specs => 1, |
2164 | 2179 |
); |
2165 | 2180 |
|
2166 |
if ($::form->{email_attachment_id}) { |
|
2167 |
my $attachment = SL::DB::EmailJournalAttachment->new(id => $::form->{email_attachment_id})->load; |
|
2168 |
$attachment->add_file_to_record($self->order); |
|
2181 |
if ($::form->{email_journal_id}) { |
|
2182 |
my $email_journal = SL::DB::EmailJournal->new( |
|
2183 |
id => delete $::form->{email_journal_id} |
|
2184 |
)->load; |
|
2185 |
$email_journal->link_to_record_with_attachment( |
|
2186 |
$self->order, |
|
2187 |
delete $::form->{email_attachment_id} |
|
2188 |
); |
|
2169 | 2189 |
} |
2170 | 2190 |
|
2171 | 2191 |
if ($is_new && $self->order->is_sales) { |
Auch abrufbar als: Unified diff
Workflow: E-Mail → Angebot/Auftrag überarbeitet