Revision 9badeafc
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) { |
templates/design40_webpages/order/form.html | ||
---|---|---|
2 | 2 |
[% USE LxERP %] |
3 | 3 |
[% USE L %] |
4 | 4 |
[% USE HTML %] |
5 |
|
|
6 |
[% IF FORM.workflow_email_journal_id %] |
|
7 |
[% SET FORM.title = LxERP.t8("Email Journal Workflow") _ " - " _ FORM.title %] |
|
8 |
[% END %] |
|
5 | 9 |
<h1>[% FORM.title %] <span id='nr_in_title'>[% SELF.order.number %]</span></h1> |
6 | 10 |
|
7 | 11 |
<div id="print_options" style="display:none"> |
... | ... | |
22 | 26 |
[% L.hidden_tag('type', FORM.type) %] |
23 | 27 |
[% L.hidden_tag('id', SELF.order.id) %] |
24 | 28 |
[% L.hidden_tag('converted_from_record_type_ref', SELF.order.converted_from_record_type_ref) %] |
25 |
[% L.hidden_tag('converted_from_record_id', SELF.order.converted_from_record_id) %] |
|
26 |
[% L.hidden_tag('email_attachment_id' , SELF.email_attachment_id) %] |
|
29 |
[% L.hidden_tag('converted_from_record_id', SELF.order.converted_from_record_id) %] |
|
30 |
[% L.hidden_tag('email_journal_id', FORM.email_journal_id) %] |
|
31 |
[% L.hidden_tag('email_attachment_id', FORM.email_attachment_id) %] |
|
32 |
[% L.hidden_tag('workflow_email_journal_id', FORM.workflow_email_journal_id) %] |
|
33 |
[% L.hidden_tag('workflow_email_attachment_id', FORM.workflow_email_attachment_id) %] |
|
27 | 34 |
|
28 | 35 |
[% IF !SELF.order.id %] |
29 | 36 |
[% L.hidden_tag('form_validity_token', FORM.form_validity_token) %] |
... | ... | |
35 | 42 |
|
36 | 43 |
<ul> |
37 | 44 |
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li> |
38 |
[% IF SELF.email_attachment_id %]
|
|
39 |
<li><a href="#ui-tabs-email-attachment-preview">[% 'Email Attachment Preview' | $T8 %]</a></li>
|
|
45 |
[% IF FORM.email_attachment_id || FORM.workflow_email_attachment_id %]
|
|
46 |
<li><a href="controller.pl?action=EmailJournal/attachment_preview&attachment_id=[% HTML.url(FORM.email_attachment_id || FORM.workflow_email_attachment_id) %]">[% 'Email Attachment Preview' | $T8 %]</a></li>
|
|
40 | 47 |
[% END %] |
41 | 48 |
[% IF INSTANCE_CONF.get_webdav %] |
42 | 49 |
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li> |
... | ... | |
70 | 77 |
cvars=SELF.order.custom_shipto.cvars_by_config |
71 | 78 |
id_selector='#order_shipto_id' %] |
72 | 79 |
</div> |
73 |
[% IF SELF.email_attachment_id %] |
|
74 |
<div id="ui-tabs-email-attachment-preview"> |
|
75 |
<div class="wrapper" id="email_attachment_wrapper"> |
|
76 |
[% P.email_journal.attachment_preview( |
|
77 |
SELF.email_attachment_id, |
|
78 |
style="height: 1800px" |
|
79 |
); |
|
80 |
%] |
|
81 |
</div><!-- /.wrapper --> |
|
82 |
</div><!-- /#ui-tabs-attachment-preview --> |
|
83 |
[% END %] |
|
84 |
|
|
85 | 80 |
|
86 | 81 |
</div><!-- /.tabwidget --> |
87 | 82 |
</form> |
templates/design40_webpages/order/tabs/basic_data.html | ||
---|---|---|
9 | 9 |
<div id="ui-tabs-basic-data"> |
10 | 10 |
<!-- PENDENT: EXPERIMENTELL --> |
11 | 11 |
|
12 |
[% IF SELF.email_attachment_id %]
|
|
12 |
[% IF FORM.email_attachment_id || FORM.workflow_email_attachment_id%]
|
|
13 | 13 |
<div class="wrapper" id="email_attachment_wrapper"> |
14 | 14 |
[% |
15 | 15 |
BLOCK panel_1; |
16 | 16 |
P.email_journal.attachment_preview( |
17 |
SELF.email_attachment_id,
|
|
17 |
FORM.email_attachment_id || FORM.workflow_email_attachment_id,
|
|
18 | 18 |
style="height:600px" |
19 | 19 |
); |
20 | 20 |
END; |
templates/webpages/order/form.html | ||
---|---|---|
2 | 2 |
[%- USE LxERP %] |
3 | 3 |
[%- USE L %] |
4 | 4 |
[%- USE HTML %] |
5 |
|
|
6 |
[% IF FORM.workflow_email_journal_id %] |
|
7 |
[% SET FORM.title = LxERP.t8("Email Journal Workflow") _ " - " _ FORM.title %] |
|
8 |
[% END %] |
|
5 | 9 |
<h1>[% FORM.title %] <span id='nr_in_title'>[%- SELF.order.number -%]</span></h1> |
6 | 10 |
|
7 | 11 |
<div id="print_options" style="display:none"> |
... | ... | |
22 | 26 |
[% L.hidden_tag('type', FORM.type) %] |
23 | 27 |
[% L.hidden_tag('id', SELF.order.id) %] |
24 | 28 |
[% L.hidden_tag('converted_from_record_type_ref', SELF.order.converted_from_record_type_ref) %] |
25 |
[% L.hidden_tag('converted_from_record_id', SELF.order.converted_from_record_id) %] |
|
26 |
[% L.hidden_tag('email_attachment_id' , SELF.email_attachment_id) %] |
|
29 |
[% L.hidden_tag('converted_from_record_id', SELF.order.converted_from_record_id) %] |
|
30 |
[% L.hidden_tag('email_journal_id', FORM.email_journal_id) %] |
|
31 |
[% L.hidden_tag('email_attachment_id', FORM.email_attachment_id) %] |
|
32 |
[% L.hidden_tag('workflow_email_journal_id', FORM.workflow_email_journal_id) %] |
|
33 |
[% L.hidden_tag('workflow_email_attachment_id', FORM.workflow_email_attachment_id) %] |
|
27 | 34 |
|
28 | 35 |
[% IF !SELF.order.id %] |
29 | 36 |
[% L.hidden_tag('form_validity_token', FORM.form_validity_token) %] |
... | ... | |
34 | 41 |
<div class="tabwidget" id="order_tabs"> |
35 | 42 |
<ul> |
36 | 43 |
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li> |
37 |
[% IF SELF.email_attachment_id %]
|
|
38 |
<li><a href="#ui-tabs-email-attachment-preview">[% 'Email Attachment Preview' | $T8 %]</a></li>
|
|
44 |
[% IF FORM.email_attachment_id || FORM.workflow_email_attachment_id %]
|
|
45 |
<li><a href="controller.pl?action=EmailJournal/attachment_preview&attachment_id=[% HTML.url(FORM.email_attachment_id || FORM.workflow_email_attachment_id) %]">[% 'Email Attachment Preview' | $T8 %]</a></li>
|
|
39 | 46 |
[% END %] |
40 | 47 |
[%- IF INSTANCE_CONF.get_webdav %] |
41 | 48 |
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li> |
... | ... | |
69 | 76 |
cvars=SELF.order.custom_shipto.cvars_by_config |
70 | 77 |
id_selector='#order_shipto_id' %] |
71 | 78 |
</div> |
72 |
[% IF SELF.email_attachment_id %] |
|
73 |
<div id="ui-tabs-email-attachment-preview"> |
|
74 |
<div class="wrapper" id="email_attachment_wrapper"> |
|
75 |
[% P.email_journal.attachment_preview( |
|
76 |
SELF.email_attachment_id, |
|
77 |
style="height: 1800px" |
|
78 |
); |
|
79 |
%] |
|
80 |
</div><!-- /.wrapper --> |
|
81 |
</div><!-- /#ui-tabs-attachment-preview --> |
|
82 |
[% END %] |
|
83 | 79 |
|
84 | 80 |
</div> |
85 | 81 |
</form> |
Auch abrufbar als: Unified diff
Workflow: E-Mail → Angebot/Auftrag überarbeitet