Revision c19e3e76
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Controller/EmailJournal.pm | ||
---|---|---|
8 | 8 |
use SL::DB::Employee; |
9 | 9 |
use SL::DB::EmailJournal; |
10 | 10 |
use SL::DB::EmailJournalAttachment; |
11 |
use SL::DB::Order; |
|
11 | 12 |
use SL::Helper::Flash; |
12 | 13 |
use SL::Locale::String; |
13 | 14 |
use SL::System::TaskServer; |
... | ... | |
22 | 23 |
__PACKAGE__->run_before('add_stylesheet'); |
23 | 24 |
__PACKAGE__->run_before('add_js'); |
24 | 25 |
|
26 |
my %RECORD_TYPES_INFO = ( |
|
27 |
# Order |
|
28 |
Order => { |
|
29 |
controller => 'Order', |
|
30 |
model => 'SL::DB::Order', |
|
31 |
types => [ |
|
32 |
'purchase_order', |
|
33 |
'purchase_quotation_intake', |
|
34 |
'request_quotation', |
|
35 |
'sales_order', |
|
36 |
'sales_order_intake', |
|
37 |
'sales_quotation', |
|
38 |
], |
|
39 |
}, |
|
40 |
); |
|
41 |
my %RECORD_TYPE_TO_CONTROLLER = |
|
42 |
map { |
|
43 |
my $controller = $RECORD_TYPES_INFO{$_}->{controller}; |
|
44 |
map { $_ => $controller } @{ $RECORD_TYPES_INFO{$_}->{types} } |
|
45 |
} keys %RECORD_TYPES_INFO; |
|
46 |
my %RECORD_TYPE_TO_MODEL = |
|
47 |
map { |
|
48 |
my $model = $RECORD_TYPES_INFO{$_}->{model}; |
|
49 |
map { $_ => $model } @{ $RECORD_TYPES_INFO{$_}->{types} } |
|
50 |
} keys %RECORD_TYPES_INFO; |
|
51 |
|
|
25 | 52 |
# |
26 | 53 |
# actions |
27 | 54 |
# |
... | ... | |
56 | 83 |
|
57 | 84 |
$self->setup_show_action_bar; |
58 | 85 |
$self->render('email_journal/show', |
59 |
title => $::locale->text('View sent email'),
|
|
86 |
title => $::locale->text('View email'), |
|
60 | 87 |
back_to => $back_to); |
61 | 88 |
} |
62 | 89 |
|
... | ... | |
78 | 105 |
$self->send_file($ref, name => $attachment->name, type => $attachment->mime_type); |
79 | 106 |
} |
80 | 107 |
|
108 |
sub action_apply_record_action { |
|
109 |
my ($self) = @_; |
|
110 |
my $email_journal_id = $::form->{email_journal_id}; |
|
111 |
my $attachment_id = $::form->{attachment_id}; |
|
112 |
my $record_action = $::form->{record_action}; |
|
113 |
my $vendor_id = $::form->{vendor_id}; |
|
114 |
my $customer_id = $::form->{customer_id}; |
|
115 |
|
|
116 |
if ( $record_action =~ s/^link_// ) { # remove prefix |
|
117 |
|
|
118 |
# Load record |
|
119 |
my $record_type = $record_action; |
|
120 |
my $record_id = $::form->{$record_type . "_id"}; |
|
121 |
my $record_type_model = $RECORD_TYPE_TO_MODEL{$record_type}; |
|
122 |
my $record = $record_type_model->new(id => $record_id)->load; |
|
123 |
my $email_journal = SL::DB::EmailJournal->new(id => $email_journal_id)->load; |
|
124 |
|
|
125 |
if ($attachment_id) { |
|
126 |
my $attachment = SL::DB::EmailJournalAttachment->new(id => $attachment_id)->load; |
|
127 |
$attachment->add_file_to_record($record); |
|
128 |
} |
|
129 |
|
|
130 |
$email_journal->link_to_record($record); |
|
131 |
|
|
132 |
return $self->js->flash('info', $::locale->text('Linked to e-mail ') . $record->displayable_name)->render(); |
|
133 |
} |
|
134 |
|
|
135 |
my %additional_params = (); |
|
136 |
if ( $record_action =~ s/^customer_// ) { # remove prefix |
|
137 |
$additional_params{customer_id} = $customer_id; |
|
138 |
} elsif ( $record_action =~ s/^vendor_// ) { # remove prefix |
|
139 |
$additional_params{vendor_id} = $vendor_id; |
|
140 |
} |
|
141 |
$additional_params{type} = $record_action; |
|
142 |
$additional_params{controller} = $RECORD_TYPE_TO_CONTROLLER{$record_action}; |
|
143 |
|
|
144 |
$self->redirect_to( |
|
145 |
action => 'add', |
|
146 |
email_journal_id => $email_journal_id, |
|
147 |
attachment_id => $attachment_id, |
|
148 |
%additional_params, |
|
149 |
); |
|
150 |
} |
|
151 |
|
|
81 | 152 |
sub action_update_attachment_preview { |
82 | 153 |
my ($self) = @_; |
83 | 154 |
$::auth->assert('email_journal'); |
... | ... | |
92 | 163 |
->replaceWith('#attachment_preview', |
93 | 164 |
SL::Presenter::EmailJournal::attachment_preview( |
94 | 165 |
$attachment, |
95 |
style => "width:489px;border:1px solid black;margin:9px"
|
|
166 |
style => "width:655px;border:1px solid black;margin:9px"
|
|
96 | 167 |
) |
97 | 168 |
) |
98 | 169 |
->render(); |
... | ... | |
110 | 181 |
# helpers |
111 | 182 |
# |
112 | 183 |
|
184 |
sub find_cv_from_email { |
|
185 |
my ($self, $cv_type, $email_journal) = @_; |
|
186 |
my $email_address = $email_journal->from; |
|
187 |
|
|
188 |
# search for customer or vendor or both |
|
189 |
my $customer; |
|
190 |
my $vendor; |
|
191 |
if ($cv_type ne 'vendor') { |
|
192 |
$customer = SL::DB::Manager::Customer->get_first( |
|
193 |
where => [ |
|
194 |
or => [ |
|
195 |
email => $email_address, |
|
196 |
cc => $email_address, |
|
197 |
bcc => $email_address, |
|
198 |
'contacts.cp_email' => $email_address, |
|
199 |
'contacts.cp_privatemail' => $email_address, |
|
200 |
'shipto.shiptoemail' => $email_address, |
|
201 |
], |
|
202 |
], |
|
203 |
with_objects => [ 'contacts', 'shipto' ], |
|
204 |
); |
|
205 |
} elsif ($cv_type ne 'customer') { |
|
206 |
$vendor = SL::DB::Manager::Vendor->get_first( |
|
207 |
where => [ |
|
208 |
or => [ |
|
209 |
email => $email_address, |
|
210 |
cc => $email_address, |
|
211 |
bcc => $email_address, |
|
212 |
'contacts.cp_email' => $email_address, |
|
213 |
'contacts.cp_privatemail' => $email_address, |
|
214 |
'shipto.shiptoemail' => $email_address, |
|
215 |
], |
|
216 |
], |
|
217 |
with_objects => [ 'contacts', 'shipto' ], |
|
218 |
); |
|
219 |
} |
|
220 |
|
|
221 |
return $customer || $vendor; |
|
222 |
} |
|
223 |
|
|
224 |
sub find_customer_from_email { |
|
225 |
my ($self, $email_journal) = @_; |
|
226 |
my $email_address = $email_journal->from; |
|
227 |
|
|
228 |
my $customer = SL::DB::Manager::Customer->get_first( |
|
229 |
where => [ |
|
230 |
or => [ |
|
231 |
email => $email_address, |
|
232 |
cc => $email_address, |
|
233 |
bcc => $email_address, |
|
234 |
'contacts.cp_email' => $email_address, |
|
235 |
'contacts.cp_privatemail' => $email_address, |
|
236 |
'shipto.shiptoemail' => $email_address, |
|
237 |
], |
|
238 |
], |
|
239 |
with_objects => [ 'contacts', 'shipto' ], |
|
240 |
); |
|
241 |
|
|
242 |
return $customer; |
|
243 |
} |
|
244 |
|
|
113 | 245 |
sub add_js { |
114 | 246 |
$::request->{layout}->use_javascript("${_}.js") for qw( |
115 | 247 |
kivi.EmailJournal |
js/kivi.EmailJournal.js | ||
---|---|---|
2 | 2 |
'use strict'; |
3 | 3 |
|
4 | 4 |
ns.update_attachment_preview = function() { |
5 |
let $form = $('#attachment_form');
|
|
5 |
let $form = $('#record_action_form');
|
|
6 | 6 |
if ($form == undefined) { return; } |
7 | 7 |
|
8 | 8 |
let data = $form.serializeArray(); |
... | ... | |
10 | 10 |
|
11 | 11 |
$.post("controller.pl", data, kivi.eval_json_result); |
12 | 12 |
} |
13 |
|
|
14 |
ns.update_extra_div_selection = function() { |
|
15 |
let record_action = $('#record_action').val(); |
|
16 |
if (record_action == undefined) { return; } |
|
17 |
|
|
18 |
$('#customer_div').hide(); |
|
19 |
$('#vendor_div').hide(); |
|
20 |
|
|
21 |
$('#link_sales_quotation_div').hide(); |
|
22 |
$('#link_sales_order_intake_div').hide(); |
|
23 |
$('#link_sales_order_div').hide(); |
|
24 |
$('#link_request_quotation_div').hide(); |
|
25 |
$('#link_purchase_quotation_intake_div').hide(); |
|
26 |
$('#link_purchase_order_div').hide(); |
|
27 |
|
|
28 |
$('#placeholder_div').hide(); |
|
29 |
|
|
30 |
// customer vendor |
|
31 |
if (record_action.match(/^customer/)) { |
|
32 |
$('#customer_div').show(); |
|
33 |
} else if (record_action.match(/^vendor/)) { |
|
34 |
$('#vendor_div').show(); |
|
35 |
// link |
|
36 |
} else if (record_action.match(/^link_/)) { |
|
37 |
$('#'+record_action+'_div').show(); |
|
38 |
// placeholder |
|
39 |
} else { |
|
40 |
$('#placeholder_div').show(); |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
ns.apply_record_action = function() { |
|
45 |
let record_action = $('#record_action').val(); |
|
46 |
if (record_action == '') { |
|
47 |
alert(kivi.t8('Please select an action.')); |
|
48 |
return; |
|
49 |
} |
|
50 |
|
|
51 |
let data = $('#record_action_form').serializeArray(); |
|
52 |
data.push({ name: 'action', value: 'EmailJournal/apply_record_action' }); |
|
53 |
|
|
54 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
55 |
} |
|
56 |
}); |
|
57 |
|
|
58 |
$(function() { |
|
59 |
kivi.EmailJournal.update_attachment_preview(); |
|
60 |
kivi.EmailJournal.update_extra_div_selection(); |
|
13 | 61 |
}); |
templates/design40_webpages/email_journal/show.html | ||
---|---|---|
2 | 2 |
[% USE L %] |
3 | 3 |
[% USE LxERP %] |
4 | 4 |
[% USE P %] |
5 |
[% USE T8 %] |
|
5 | 6 |
|
6 |
<h1>[% FORM.title %]</h1> |
|
7 |
|
|
8 |
[% INCLUDE 'common/flash.html' %] |
|
9 |
|
|
10 |
<div class="wrapper" id="wrapper-0"> |
|
11 |
|
|
12 |
<div class="input-panel" style="vertical-align:top;" id="wrapper-1"> |
|
13 |
|
|
7 |
[% BLOCK filter_toggle_panel # can't change name %] |
|
14 | 8 |
<table id="email_journal_details" class="tbl-horizontal"> |
15 | 9 |
<tbody> |
16 | 10 |
<tr> |
17 |
<th>[% LxERP.t8("From") %]</th>
|
|
18 |
<td>[% L.input_tag('from', HTML.escape(SELF.entry.from), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
|
11 |
<th>[% 'From' | $T8 %]</th>
|
|
12 |
<td>[% L.input_tag('from', SELF.entry.from, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
|
19 | 13 |
</tr> |
20 | 14 |
<tr> |
21 |
<th>[% LxERP.t8("Recipients") %]</th>
|
|
22 |
<td>[% L.input_tag('recipients', HTML.escape(SELF.entry.recipients), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
|
15 |
<th>[% 'Recipients' | $T8 %]</th>
|
|
16 |
<td>[% L.input_tag('recipients', SELF.entry.recipients, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
|
23 | 17 |
</tr> |
24 | 18 |
<tr> |
25 |
<th>[% LxERP.t8("Subject") %]</th>
|
|
26 |
<td>[% L.input_tag('subject', HTML.escape(SELF.entry.subject), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
|
19 |
<th>[% 'Subject' | $T8 %]</th>
|
|
20 |
<td>[% L.input_tag('subject', SELF.entry.subject, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
|
27 | 21 |
</tr> |
28 | 22 |
<tr> |
29 |
<th>[% LxERP.t8("Sent on") %]</th>
|
|
30 |
<td>[% L.input_tag('sent_on', HTML.escape(SELF.entry.sent_on.to_lxoffice("precision" => "second")), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
|
23 |
<th>[% 'Sent on' | $T8 %]</th>
|
|
24 |
<td>[% L.input_tag('sent_on', SELF.entry.sent_on.to_lxoffice("precision" => "second"), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
|
31 | 25 |
</tr> |
32 | 26 |
<tr> |
33 |
<th>[% LxERP.t8("Status") %]</th>
|
|
27 |
<th>[% 'Status' | $T8 %]</th>
|
|
34 | 28 |
<td>[% L.input_tag('status', P.email_journal.entry_status(SELF.entry), style="color:black", class="wi-verywide", disabled=1) %]</td> |
35 | 29 |
</tr> |
36 | 30 |
<tr> |
37 |
<th>[% LxERP.t8("Extended status") %]</th>
|
|
31 |
<th>[% 'Extended status' | $T8 %]</th>
|
|
38 | 32 |
<td> |
39 |
[% L.textarea_tag('extended_status', HTML.escape(SELF.entry.extended_status), wrap="soft", style="color:black; height:25px", class="wi-verywide", disabled=1) %]
|
|
33 |
[% L.textarea_tag('extended_status', SELF.entry.extended_status, wrap="soft", style="color:black; height:25px", class="wi-verywide", disabled=1) %]
|
|
40 | 34 |
</td> |
41 | 35 |
</tr> |
42 | 36 |
<tr> |
43 |
<th>[% LxERP.t8("Headers") %]</th>
|
|
37 |
<th>[% 'Headers' | $T8 %]</th>
|
|
44 | 38 |
<td> |
45 | 39 |
[% L.textarea_tag('headers', HTML.escape(SELF.entry.headers), wrap="soft", style="color:black; height:25px", class="wi-verywide", disabled=1) %] |
46 | 40 |
</td> |
47 | 41 |
</tr> |
48 | 42 |
<tr> |
49 |
<th>[% LxERP.t8("Body") %]</th>
|
|
43 |
<th>[% 'Body' | $T8 %]</th>
|
|
50 | 44 |
<td> |
51 | 45 |
[% IF SELF.entry.headers.match('(?i)content-type:.*text/html') %] |
52 | 46 |
<div style="border:1px solid black;"> |
53 | 47 |
[% P.restricted_html(SELF.entry.body) %] |
54 | 48 |
</div> |
55 | 49 |
[% ELSE %] |
56 |
[% L.textarea_tag('body', HTML.escape(SELF.entry.body), wrap="soft", style="color:black; height:200px", class="wi-verywide", disabled=1) %]
|
|
50 |
[% L.textarea_tag('body', SELF.entry.body, wrap="soft", style="color:black; height:200px", class="wi-verywide", disabled=1) %]
|
|
57 | 51 |
[% END %] |
58 | 52 |
</td> |
59 | 53 |
</tr> |
60 | 54 |
</tbody> |
61 | 55 |
</table> |
56 |
[% END %] |
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
<h1>[% FORM.title %]</h1> |
|
61 |
|
|
62 |
[% INCLUDE 'common/flash.html' %] |
|
63 |
|
|
64 |
<div class="wrapper" id="wrapper-0"> |
|
65 |
|
|
66 |
<div class="wrapper"> |
|
67 |
[% |
|
68 |
display_status = 'open'; |
|
69 |
button_closed = LxERP.t8('Show Email'); |
|
70 |
button_open = LxERP.t8('Hide Email'); |
|
71 |
INCLUDE 'common/toggle_panel.html'; |
|
72 |
%] |
|
73 |
</div><!-- /.wrapper --> |
|
62 | 74 |
|
63 |
</div> <!-- wrapper-1 --> |
|
64 | 75 |
|
65 | 76 |
[% SET attachments = SELF.entry.attachments_sorted %] |
66 | 77 |
|
... | ... | |
68 | 79 |
|
69 | 80 |
[% IF attachments.size %] |
70 | 81 |
<table id="email_journal_details" class="tbl-list"> |
71 |
<caption>[% LxERP.t8("Attachments") %]</caption>
|
|
82 |
<caption>[% 'Attachments' | $T8 %]</caption>
|
|
72 | 83 |
<thead> |
73 | 84 |
<tr> |
74 |
<th>[% LxERP.t8("Attachment name") %]</th>
|
|
75 |
<th>[% LxERP.t8("MIME type") %]</th>
|
|
76 |
<th>[% LxERP.t8("Size") %]</th>
|
|
85 |
<th>[% 'Attachment name' | $T8 %]</th>
|
|
86 |
<th>[% 'MIME type' | $T8 %]</th>
|
|
87 |
<th>[% 'Size' | $T8 %]</th>
|
|
77 | 88 |
</tr> |
78 | 89 |
</thead> |
79 | 90 |
<tbody> |
... | ... | |
88 | 99 |
</table> |
89 | 100 |
[% END %] |
90 | 101 |
|
91 |
<form method="post" action="controller.pl" id="attachment_form"> |
|
92 |
[% L.hidden_tag('id', SELF.entry.id) %] |
|
93 |
[% L.select_tag('attachment_id', |
|
94 |
attachments, value_key='id', title_key='name', |
|
95 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"), |
|
96 |
'data-title'=LxERP.t8("Attachment"), class="wi-normal", |
|
97 |
onchange='kivi.EmailJournal.update_attachment_preview();' |
|
98 |
) |
|
99 |
%] |
|
100 |
[% L.select_tag('record_type', [ ["value", "Name"] ], class="wi-normal") %] |
|
101 |
|
|
102 |
[% L.button_tag('kivi.EmailJournal.create_record();', LxERP.t8('Create Record with Attachment')) %] |
|
102 |
[% IF SELF.entry.status == 'imported' || SELF.entry.status == 'record_imported' %] |
|
103 |
<form method="post" action="controller.pl" id="record_action_form"> |
|
104 |
[% L.hidden_tag('email_journal_id', SELF.entry.id) %] |
|
105 |
|
|
106 |
<div id="action_div" class="input-panel"> |
|
107 |
|
|
108 |
<div class="col"> |
|
109 |
[% L.select_tag('attachment_id', |
|
110 |
attachments, value_key='id', title_key='name', |
|
111 |
default = attachments.0.id, |
|
112 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"), |
|
113 |
'data-title'=LxERP.t8("Attachment"), class="wi-normal", |
|
114 |
onchange='kivi.EmailJournal.update_attachment_preview();' |
|
115 |
) |
|
116 |
%] |
|
117 |
</div> |
|
118 |
|
|
119 |
<div class="col"> |
|
120 |
[% L.select_tag('record_action', |
|
121 |
# id has to start with customer_ or vendor_ for picker selection |
|
122 |
[ |
|
123 |
[ LxERP.t8("Hard linking"), [ |
|
124 |
{id => "link_sales_quotation", name => LxERP.t8("Link to sales quotation")}, |
|
125 |
{id => "link_sales_order_intake", name => LxERP.t8("Link to sales order intake")}, |
|
126 |
{id => "link_sales_order", name => LxERP.t8("Link to sales order")}, |
|
127 |
{id => "link_request_quotation", name => LxERP.t8("Link to request quotation")}, |
|
128 |
{id => "link_purchase_quotation_intake", name => LxERP.t8("Link to purchase quotation intake")}, |
|
129 |
{id => "link_purchase_order", name => LxERP.t8("Link to purchase order")}, |
|
130 |
|
|
131 |
] ], |
|
132 |
[ LxERP.t8("Sales"), [ |
|
133 |
{id => "customer_sales_order", name => LxERP.t8("Create sales order")}, |
|
134 |
{id => "customer_sales_order_intake", name => LxERP.t8("Create sales order intake")}, |
|
135 |
{id => "customer_sales_quotation", name => LxERP.t8("Create sales quotation")}, |
|
136 |
] ], |
|
137 |
[ LxERP.t8("Purchase"), [ |
|
138 |
{id => "vendor_purchase_order", name => LxERP.t8("Create purchase order")}, |
|
139 |
{id => "vendor_purchase_quotation_intake", name => LxERP.t8("Create purchase quotation intake")}, |
|
140 |
{id => "vendor_request_quotation", name => LxERP.t8("Create request quotation")}, |
|
141 |
|
|
142 |
] ], |
|
143 |
], |
|
144 |
value_key='id', title_key='name', |
|
145 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No action"), |
|
146 |
with_optgroups=1, |
|
147 |
class="wi-normal", |
|
148 |
onchange='kivi.EmailJournal.update_extra_div_selection();' |
|
149 |
) %] |
|
150 |
</div> |
|
151 |
|
|
152 |
[% FOREACH cv_type_name = [['customer', 'Customer'], ['vendor', 'Vendor']] %] |
|
153 |
[% SET cv_type = cv_type_name.0 %] |
|
154 |
[% SET cv_name = cv_type_name.1 %] |
|
155 |
<div id="[% cv_type _ "_div" %]" class="col" style="display:none"> |
|
156 |
[% P.customer_vendor.picker( |
|
157 |
cv_type _ "_id", SELF.find_cv_from_email(cv_type, SELF.entry), |
|
158 |
type=cv_type, class="wi-normal", placeholder=LxERP.t8(cv_name) |
|
159 |
) %] |
|
160 |
</div> |
|
161 |
[% END %] |
|
162 |
[% FOREACH record_type = [ |
|
163 |
'sales_quotation', 'sales_order_intake', 'sales_order', |
|
164 |
'request_quotation', 'purchase_quotation_intake', 'purchase_order' |
|
165 |
] %] |
|
166 |
<div id="[% "link_" _ record_type _ "_div" %]" class="col" style="display:none"> |
|
167 |
[% L.input_tag(record_type _ "_id", '', |
|
168 |
style="color:black", class="wi-normal", |
|
169 |
placeholder=record_type _ " id") %] |
|
170 |
</div> |
|
171 |
[% END %] |
|
172 |
<div id="placeholder_div" class="col" style="display:block"> |
|
173 |
[% L.input_tag('cv_placeholder', '', |
|
174 |
style="color:black", class="wi-normal", disabled=1, |
|
175 |
placeholder=LxERP.t8("Select action first"), |
|
176 |
) %] |
|
177 |
</div> |
|
178 |
|
|
179 |
<div class="col"> |
|
180 |
[% L.button_tag('kivi.EmailJournal.apply_record_action();', LxERP.t8('Apply with Attachment')) %] |
|
181 |
</div> |
|
182 |
</div> <!-- action_div --> |
|
103 | 183 |
</form> |
104 | 184 |
|
105 |
<!-- <div id="attachment_preview"> -->
|
|
106 |
[% P.email_journal.attachment_preview(attachments.0,
|
|
107 |
style="width:489px;border:1px solid black;margin:9px") %]
|
|
185 |
<!-- kivi.EmailJournal.update_attachment_preview -->
|
|
186 |
<div id="attachment_preview"></div>
|
|
187 |
[% END %]
|
|
108 | 188 |
|
109 | 189 |
</div> <!-- wrapper-2 --> |
110 | 190 |
|
templates/webpages/email_journal/show.html | ||
---|---|---|
79 | 79 |
</tbody> |
80 | 80 |
</table> |
81 | 81 |
[% END %] |
82 |
<div> |
|
83 |
<form method="post" action="controller.pl" id="attachment_form"> |
|
84 |
[% L.hidden_tag('id', SELF.entry.id) %] |
|
85 |
[% L.select_tag('attachment_id', |
|
86 |
attachments, value_key='id', title_key='name', |
|
87 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"), |
|
88 |
'data-title'=LxERP.t8("Attachment"), class="wi-normal", |
|
89 |
onchange='kivi.EmailJournal.update_attachment_preview();' |
|
90 |
) |
|
91 |
%] |
|
92 |
[% L.select_tag('record_type', [ ["value", "Name"] ], class="wi-normal") %] |
|
93 |
|
|
94 |
[% L.button_tag('kivi.EmailJournal.create_record();', LxERP.t8('Create Record with Attachment')) %] |
|
95 |
</form> |
|
96 |
|
|
97 |
<!-- <div id="attachment_preview"> --> |
|
98 |
[% P.email_journal.attachment_preview(attachments.0, |
|
99 |
style="width:489px;border:1px solid black;margin:9px") %] |
|
100 |
</div> |
|
82 |
|
|
83 |
[% IF SELF.entry.status == 'imported' || SELF.entry.status == 'record_imported' %] |
|
84 |
<form method="post" action="controller.pl" id="record_action_form"> |
|
85 |
[% L.hidden_tag('email_journal_id', SELF.entry.id) %] |
|
86 |
|
|
87 |
<table> <tr> |
|
88 |
<td> |
|
89 |
[% L.select_tag('attachment_id', |
|
90 |
attachments, value_key='id', title_key='name', |
|
91 |
default = attachments.0.id, |
|
92 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"), |
|
93 |
'data-title'=LxERP.t8("Attachment"), class="wi-normal", |
|
94 |
onchange='kivi.EmailJournal.update_attachment_preview();' |
|
95 |
) |
|
96 |
%] |
|
97 |
</td> |
|
98 |
|
|
99 |
<td> |
|
100 |
[% L.select_tag('record_action', |
|
101 |
# id has to start with customer_ or vendor_ for picker selection |
|
102 |
[ |
|
103 |
[ LxERP.t8("Hard linking"), [ |
|
104 |
{id => "link_sales_quotation", name => LxERP.t8("Link to sales quotation")}, |
|
105 |
{id => "link_sales_order_intake", name => LxERP.t8("Link to sales order intake")}, |
|
106 |
{id => "link_sales_order", name => LxERP.t8("Link to sales order")}, |
|
107 |
{id => "link_request_quotation", name => LxERP.t8("Link to request quotation")}, |
|
108 |
{id => "link_purchase_quotation_intake", name => LxERP.t8("Link to purchase quotation intake")}, |
|
109 |
{id => "link_purchase_order", name => LxERP.t8("Link to purchase order")}, |
|
110 |
|
|
111 |
] ], |
|
112 |
[ LxERP.t8("Sales"), [ |
|
113 |
{id => "customer_sales_order", name => LxERP.t8("Create sales order")}, |
|
114 |
{id => "customer_sales_order_intake", name => LxERP.t8("Create sales order intake")}, |
|
115 |
{id => "customer_sales_quotation", name => LxERP.t8("Create sales quotation")}, |
|
116 |
] ], |
|
117 |
[ LxERP.t8("Purchase"), [ |
|
118 |
{id => "vendor_purchase_order", name => LxERP.t8("Create purchase order")}, |
|
119 |
{id => "vendor_purchase_quotation_intake", name => LxERP.t8("Create purchase quotation intake")}, |
|
120 |
{id => "vendor_request_quotation", name => LxERP.t8("Create request quotation")}, |
|
121 |
|
|
122 |
] ], |
|
123 |
], |
|
124 |
value_key='id', title_key='name', |
|
125 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No action"), |
|
126 |
with_optgroups=1, |
|
127 |
class="wi-normal", |
|
128 |
onchange='kivi.EmailJournal.update_extra_div_selection();' |
|
129 |
) %] |
|
130 |
</td> |
|
131 |
|
|
132 |
<td> |
|
133 |
[% FOREACH cv_type_name = [['customer', 'Customer'], ['vendor', 'Vendor']] %] |
|
134 |
[% SET cv_type = cv_type_name.0 %] |
|
135 |
[% SET cv_name = cv_type_name.1 %] |
|
136 |
<div id="[% cv_type _ "_div" %]" style="display:none"> |
|
137 |
[% P.customer_vendor.picker( |
|
138 |
cv_type _ "_id", SELF.find_cv_from_email(cv_type, SELF.entry), |
|
139 |
type=cv_type, class="wi-normal", placeholder=LxERP.t8(cv_name) |
|
140 |
) %] |
|
141 |
</div> |
|
142 |
[% END %] |
|
143 |
[% FOREACH record_type = [ |
|
144 |
'sales_quotation', 'sales_order_intake', 'sales_order', |
|
145 |
'request_quotation', 'purchase_quotation_intake', 'purchase_order' |
|
146 |
] %] |
|
147 |
<div id="[% "link_" _ record_type _ "_div" %]" style="display:none"> |
|
148 |
[% L.input_tag(record_type _ "_id", '', |
|
149 |
style="color:black", class="wi-normal", |
|
150 |
placeholder=record_type _ " id") %] |
|
151 |
</div> |
|
152 |
[% END %] |
|
153 |
<div id="placeholder_div" style="display:block"> |
|
154 |
[% L.input_tag('cv_placeholder', '', |
|
155 |
style="color:black", class="wi-normal", disabled=1, |
|
156 |
placeholder=LxERP.t8("Select action first"), |
|
157 |
) %] |
|
158 |
</div> |
|
159 |
</td> |
|
160 |
|
|
161 |
<td> |
|
162 |
[% L.button_tag('kivi.EmailJournal.apply_record_action();', LxERP.t8('Apply with Attachment')) %] |
|
163 |
</td> |
|
164 |
</tr> </table> |
|
165 |
</form> |
|
166 |
|
|
167 |
<!-- kivi.EmailJournal.update_attachment_preview --> |
|
168 |
<div id="attachment_preview"></div> |
|
169 |
[% END %] |
Auch abrufbar als: Unified diff
EmailJournal: Basisfunktionalität fürs Verlinken und Neu erstellen von Belegen