Revision 22bcb6b1
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
bin/mozilla/io.pl | ||
---|---|---|
53 | 53 |
use SL::File; |
54 | 54 |
use SL::PriceSource; |
55 | 55 |
|
56 |
use SL::DB::Contact; |
|
56 | 57 |
use SL::DB::Customer; |
57 | 58 |
use SL::DB::Default; |
58 | 59 |
use SL::DB::Language; |
... | ... | |
60 | 61 |
use SL::DB::Vendor; |
61 | 62 |
use SL::Helper::CreatePDF; |
62 | 63 |
use SL::Helper::Flash; |
64 |
use SL::Helper::PrintOptions; |
|
63 | 65 |
|
64 | 66 |
require "bin/mozilla/common.pl"; |
65 | 67 |
|
... | ... | |
2026 | 2028 |
|
2027 | 2029 |
return $obj; |
2028 | 2030 |
} |
2031 |
|
|
2032 |
sub setup_sales_purchase_print_options { |
|
2033 |
my $print_form = Form->new(''); |
|
2034 |
$print_form->{printers} = SL::DB::Manager::Printer->get_all_sorted; |
|
2035 |
$print_form->{languages} = SL::DB::Manager::Language->get_all_sorted; |
|
2036 |
|
|
2037 |
$print_form->{$_} = $::form->{$_} for qw(type media language_id printer_id); |
|
2038 |
|
|
2039 |
return SL::Helper::PrintOptions->get_print_options( |
|
2040 |
form => $print_form, |
|
2041 |
options => { |
|
2042 |
show_headers => 1, |
|
2043 |
}, |
|
2044 |
); |
|
2045 |
} |
|
2046 |
|
|
2047 |
sub show_sales_purchase_email_dialog { |
|
2048 |
my $contact = $::form->{cp_id} ? SL::DB::Contact->load_cached($::form->{cp_id}) : undef; |
|
2049 |
my $email_form = { |
|
2050 |
to => $contact ? $contact->cp_email : '', |
|
2051 |
subject => $::form->generate_email_subject, |
|
2052 |
attachment_filename => $::form->generate_attachment_filename, |
|
2053 |
}; |
|
2054 |
|
|
2055 |
my $html = $::form->parse_html_template("common/_send_email_dialog", { |
|
2056 |
email_form => $email_form, |
|
2057 |
show_bcc => $::auth->assert('email_bcc', 'may fail'), |
|
2058 |
}); |
|
2059 |
|
|
2060 |
print $::form->ajax_response_header, $html; |
|
2061 |
} |
|
2062 |
|
|
2063 |
sub send_sales_purchase_email { |
|
2064 |
my $type = $::form->{type}; |
|
2065 |
my $id = $::form->{id}; |
|
2066 |
my $script = $type =~ m{sales_order|purchase_order|quotation} ? 'oe.pl' |
|
2067 |
: $type =~ m{delivery_} ? 'do.pl' |
|
2068 |
: 'is.pl'; |
|
2069 |
|
|
2070 |
my $email_form = delete $::form->{email_form}; |
|
2071 |
my %field_names = (to => 'email'); |
|
2072 |
|
|
2073 |
$::form->{ $field_names{$_} // $_ } = $email_form->{$_} for keys %{ $email_form }; |
|
2074 |
|
|
2075 |
$::form->{media} = 'email'; |
|
2076 |
|
|
2077 |
print_form("return"); |
|
2078 |
Common->save_email_status(\%::myconfig, $::form); |
|
2079 |
|
|
2080 |
flash_later('info', $::locale->text('The email has been sent.')); |
|
2081 |
|
|
2082 |
print $::form->redirect_header($script . '?action=edit&id=' . $::form->escape($id) . '&type=' . $::form->escape($type)); |
|
2083 |
} |
bin/mozilla/oe.pl | ||
---|---|---|
399 | 399 |
], |
400 | 400 |
action => [ |
401 | 401 |
t8('E Mail'), |
402 |
submit => [ '#form', { action_print => 1 } ],
|
|
402 |
call => [ 'kivi.SalesPurchase.show_email_dialog' ],
|
|
403 | 403 |
checks => [ @req_trans_desc ], |
404 | 404 |
], |
405 | 405 |
], #end of combobox "Export" |
... | ... | |
593 | 593 |
push @custom_hiddens, map { "shiptocvar_" . $_->name } @{ SL::DB::Manager::CustomVariableConfig->get_all(where => [ module => 'ShipTo' ]) }; |
594 | 594 |
|
595 | 595 |
$TMPL_VAR{HIDDENS} = [ map { name => $_, value => $form->{$_} }, |
596 |
qw(id action type vc formname media format proforma queued printed emailed
|
|
596 |
qw(id type vc proforma queued printed emailed
|
|
597 | 597 |
title creditlimit creditremaining tradediscount business |
598 | 598 |
max_dunning_level dunning_amount |
599 | 599 |
CFDD_shipto CFDD_shipto_id |
600 |
message email subject cc bcc taxpart taxservice taxaccounts cursor_fokus
|
|
600 |
taxpart taxservice taxaccounts cursor_fokus |
|
601 | 601 |
show_details useasnew), |
602 | 602 |
@custom_hiddens, |
603 | 603 |
map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} ]; # deleted: discount |
... | ... | |
684 | 684 |
|
685 | 685 |
$TMPL_VAR{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted(); |
686 | 686 |
|
687 |
my $print_options_html = setup_sales_purchase_print_options(); |
|
688 |
|
|
687 | 689 |
print $form->parse_html_template("oe/form_footer", { |
688 | 690 |
%TMPL_VAR, |
689 |
print_options => print_options(inline => 1),
|
|
691 |
print_options => $print_options_html,
|
|
690 | 692 |
is_sales => scalar ($form->{type} =~ /^sales_/), # these vars are exported, so that the template |
691 | 693 |
is_order => scalar ($form->{type} =~ /_order$/), # may determine what to show |
692 | 694 |
is_sales_quo => scalar ($form->{type} =~ /sales_quotation$/), |
js/kivi.SalesPurchase.js | ||
---|---|---|
208 | 208 |
} |
209 | 209 |
}); |
210 | 210 |
}; |
211 |
|
|
212 |
this.show_print_options_elements = function(elements, show) { |
|
213 |
$(elements).each(function(idx, elt) { |
|
214 |
var $elements = $('#print_options_header_' + elt + ',#print_options_input_' + elt); |
|
215 |
if (show) |
|
216 |
$elements.show(); |
|
217 |
else |
|
218 |
$elements.hide(); |
|
219 |
}); |
|
220 |
}; |
|
221 |
|
|
222 |
this.show_all_print_options_elements = function() { |
|
223 |
kivi.SalesPurchase.show_print_options_elements([ 'formname', 'language_id', 'format', 'sendmode', 'media', 'printer_id', 'copies', 'groupitems', 'remove_draft' ], true); |
|
224 |
}; |
|
225 |
|
|
226 |
// Sending records via email. |
|
227 |
this.send_email = function() { |
|
228 |
var unset = $('#email_form_to,#email_form_subject,#email_form_message').filter(function(idx, elt) { |
|
229 |
return $(elt).val() === ''; |
|
230 |
}); |
|
231 |
|
|
232 |
if (unset.length > 0) { |
|
233 |
alert(kivi.t8("The recipient, subject or body is missing.")); |
|
234 |
$(unset[0]).focus(); |
|
235 |
|
|
236 |
return false; |
|
237 |
} |
|
238 |
|
|
239 |
$('#send_email_dialog').children().remove().appendTo('#email_inputs'); |
|
240 |
$('#send_email_dialog').dialog('close'); |
|
241 |
|
|
242 |
$('#action').val('send_sales_purchase_email'); |
|
243 |
$('#form').submit(); |
|
244 |
|
|
245 |
return true; |
|
246 |
}; |
|
247 |
|
|
248 |
this.setup_send_email_dialog = function() { |
|
249 |
kivi.SalesPurchase.show_all_print_options_elements(); |
|
250 |
kivi.SalesPurchase.show_print_options_elements([ 'sendmode', 'media', 'copies', 'remove_draft' ], false); |
|
251 |
|
|
252 |
$('#print_options').children().remove().appendTo('#email_form_print_options'); |
|
253 |
|
|
254 |
var to_focus = $('#email_form_to').val() === '' ? 'to' : 'subject'; |
|
255 |
$('#email_form_' + to_focus).focus(); |
|
256 |
}; |
|
257 |
|
|
258 |
this.finish_send_email_dialog = function() { |
|
259 |
$('#email_form_print_options').children().remove().appendTo('#print_options'); |
|
260 |
return true; |
|
261 |
}; |
|
262 |
|
|
263 |
this.show_email_dialog = function() { |
|
264 |
kivi.popup_dialog({ |
|
265 |
id: 'send_email_dialog', |
|
266 |
url: 'io.pl', |
|
267 |
load: kivi.SalesPurchase.setup_send_email_dialog, |
|
268 |
data: { |
|
269 |
action: 'show_sales_purchase_email_dialog', |
|
270 |
type: $('#type').val(), |
|
271 |
formname: $('#formname').val(), |
|
272 |
format: $('#format').val(), |
|
273 |
media: 'email', |
|
274 |
ordnumber: $('#ordnumber').val(), |
|
275 |
donumber: $('#donumber').val(), |
|
276 |
invnumber: $('#invnumber').val(), |
|
277 |
quonumber: $('#quonumber').val(), |
|
278 |
cp_id: $('#cp_id').val(), |
|
279 |
language_id: $('#language_id').val(), |
|
280 |
}, |
|
281 |
dialog: { |
|
282 |
height: 600, |
|
283 |
title: kivi.t8('Send email'), |
|
284 |
beforeClose: kivi.SalesPurchase.finish_send_email_dialog |
|
285 |
} |
|
286 |
}); |
|
287 |
|
|
288 |
return true; |
|
289 |
}; |
|
211 | 290 |
}); |
js/locale/de.js | ||
---|---|---|
90 | 90 |
"Save and keep open":"Speichern und geöffnet lassen", |
91 | 91 |
"Section/Function block actions":"Abschnitts-/Funktionsblockaktionen", |
92 | 92 |
"Select template to paste":"Einzufügende Vorlage auswählen", |
93 |
"Send email":"E-Mail verschicken", |
|
93 | 94 |
"Set all source and memo fields":"Alle Beleg-/Memo-Felder setzen", |
94 | 95 |
"Show all details":"Alle Details anzeigen", |
95 | 96 |
"Show details":"Details anzeigen", |
locale/de/all | ||
---|---|---|
2586 | 2586 |
'Semicolon' => 'Semikolon', |
2587 | 2587 |
'Send a BCC to logged in user?' => 'BCC an eingeloggten Benutzer?', |
2588 | 2588 |
'Send a blind copy of all outgoing emails to current user\'s email address?' => 'Eine blinde Kopie aller ausgehenden E-Mails wird an den angemeldeten Nutzer geschickt', |
2589 |
'Send email' => 'E-Mail verschicken', |
|
2589 | 2590 |
'Send invoice via email' => 'Rechnung via E-Mail verschicken', |
2590 | 2591 |
'Send letter via e-mail' => 'Brief via E-Mail verschicken', |
2591 | 2592 |
'Sender' => 'AbsenderIn', |
templates/webpages/common/_send_email_dialog.html | ||
---|---|---|
1 |
[%- USE HTML %][%- USE LxERP -%][%- USE L -%] |
|
2 |
|
|
3 |
<table> |
|
4 |
<tbody> |
|
5 |
<tr> |
|
6 |
<th align="right" nowrap>[% LxERP.t8("To") %]</th> |
|
7 |
<td>[% L.input_tag("email_form.to", email_form.to, size="80") %]</td> |
|
8 |
</tr> |
|
9 |
|
|
10 |
<tr> |
|
11 |
<th align="right" nowrap>[% LxERP.t8("Cc") %]</th> |
|
12 |
<td>[% L.input_tag("email_form.cc", email_form.cc, size="80") %]</td> |
|
13 |
</tr> |
|
14 |
|
|
15 |
[%- IF show_bcc %] |
|
16 |
<tr> |
|
17 |
<th align="right" nowrap>[% LxERP.t8("Bcc") %]</th> |
|
18 |
<td>[% L.input_tag("email_form.bcc", email_form.bcc, size="80") %]</td> |
|
19 |
</tr> |
|
20 |
[%- END %] |
|
21 |
|
|
22 |
<tr> |
|
23 |
<th align="right" nowrap>[% LxERP.t8("Subject") %]</th> |
|
24 |
<td>[% L.input_tag("email_form.subject", email_form.subject, size="80") %]</td> |
|
25 |
</tr> |
|
26 |
|
|
27 |
<tr> |
|
28 |
<th align="right" nowrap>[% LxERP.t8("Attachment name") %]</th> |
|
29 |
<td>[% L.input_tag("email_form.attachment_filename", email_form.attachment_filename, size="80") %]</td> |
|
30 |
</tr> |
|
31 |
|
|
32 |
<tr valign="top"> |
|
33 |
<th align="right" nowrap>[% LxERP.t8("Message") %]</th> |
|
34 |
<td>[% L.textarea_tag("email_form.message", email_form.message, rows="15" cols="80" wrap="soft") %]</td> |
|
35 |
</tr> |
|
36 |
</tbody> |
|
37 |
</table> |
|
38 |
|
|
39 |
<div id="email_form_print_options"></div> |
|
40 |
|
|
41 |
<p> |
|
42 |
[% L.button_tag("kivi.SalesPurchase.send_email()", LxERP.t8("Send email")) %] |
|
43 |
[% L.button_tag("\$('#send_email_dialog').dialog('close');", LxERP.t8("Abort")) %] |
|
44 |
</p> |
templates/webpages/generic/print_options.html | ||
---|---|---|
9 | 9 |
<tr> |
10 | 10 |
[%- FOREACH row = SELECTS %] |
11 | 11 |
[%- IF row.show %] |
12 |
<th align="left">[%- row.hname %]</th> |
|
12 |
<th align="left" id="print_options_header_[% row.sname %]">[%- row.hname %]</th>
|
|
13 | 13 |
[%- END %] |
14 | 14 |
[%- END %] |
15 | 15 |
[%- IF display_copies %] |
16 |
<th align="left">[% 'Copies' | $T8 %]</th> |
|
16 |
<th align="left" id="print_options_header_copies">[% 'Copies' | $T8 %]</th>
|
|
17 | 17 |
[%- END %] |
18 | 18 |
[%- IF display_groupitems %] |
19 |
<th align="left">[% 'Group Items' | $T8 %]</th> |
|
19 |
<th align="left" id="print_options_header_groupitems">[% 'Group Items' | $T8 %]</th>
|
|
20 | 20 |
[%- END %] |
21 | 21 |
[%- IF display_remove_draft %] |
22 |
<th align="left">[% 'Remove Draft' | $T8 %]</th> |
|
22 |
<th align="left" id="print_options_header_remove_draft">[% 'Remove Draft' | $T8 %]</th>
|
|
23 | 23 |
[%- END %] |
24 | 24 |
</tr> |
25 | 25 |
[%- END %] |
26 | 26 |
<tr> |
27 | 27 |
[%- FOREACH row = SELECTS %] |
28 | 28 |
[%- IF row.show %] |
29 |
<td> |
|
30 |
<select name="[%- name_prefix %][%- row.sname %]"> |
|
29 |
<td id="print_options_input_[% row.sname %]">
|
|
30 |
<select name="[%- name_prefix %][%- row.sname %]" id="[%- id_prefix %][%- row.sname %]">
|
|
31 | 31 |
[%- FOREACH data = row.DATA %] |
32 | 32 |
<option value="[% data.value %]" [% data.selected %]>[% data.oname %]</option> |
33 | 33 |
[%- END %] |
... | ... | |
36 | 36 |
[%- END %] |
37 | 37 |
[%- END %] |
38 | 38 |
[%- IF display_copies %] |
39 |
<td>[%- IF !show_headers %][%- 'Copies' | $T8 %][%- END %]<input name="[%- name_prefix %]copies" size="2" value="[% HTML.escape(copies) %]"></td>
|
|
39 |
<td id="print_options_input_copies">[%- IF !show_headers %][%- 'Copies' | $T8 %][%- END %]<input name="[%- name_prefix %]copies" id="[% id_prefix %]copies" size="2" value="[% HTML.escape(copies) %]"></td>
|
|
40 | 40 |
[%- END %] |
41 | 41 |
[%- IF display_groupitems %] |
42 |
<td>[%- IF !show_headers %][% 'Group Items' | $T8 %][%- END %] |
|
43 |
<input name="[%- name_prefix %]groupitems" type="checkbox" class="checkbox" [% groupitems_checked %]> |
|
42 |
<td id="print_options_input_groupitems">[%- IF !show_headers %][% 'Group Items' | $T8 %][%- END %]
|
|
43 |
<input name="[%- name_prefix %]groupitems" id="[% id_prefix %]groupitems" type="checkbox" class="checkbox" [% groupitems_checked %]>
|
|
44 | 44 |
</td> |
45 | 45 |
[%- END %] |
46 | 46 |
[%- IF display_remove_draft %] |
47 |
<td>[%- IF !show_headers %][% 'Remove Draft' | $T8 %][%- END %] |
|
48 |
<input name="[%- name_prefix %]remove_draft" type="checkbox" class="checkbox" [% remove_draft_checked %]> |
|
47 |
<td id="print_options_input_remove_draft">[%- IF !show_headers %][% 'Remove Draft' | $T8 %][%- END %]
|
|
48 |
<input name="[%- name_prefix %]remove_draft" id="[% id_prefix %]remove_draft" type="checkbox" class="checkbox" [% remove_draft_checked %]>
|
|
49 | 49 |
</td> |
50 | 50 |
[%- END %] |
51 | 51 |
</tr> |
templates/webpages/oe/form_footer.html | ||
---|---|---|
129 | 129 |
</div> |
130 | 130 |
</div> |
131 | 131 |
|
132 |
<hr size="3" noshade> |
|
133 |
|
|
134 |
<p>[% print_options %]</p> |
|
135 |
|
|
136 |
<input type="hidden" name="action" value="dispatcher"> |
|
132 |
<input type="hidden" name="action" id="action" value="dispatcher"> |
|
137 | 133 |
<input type="hidden" name="saved_xyznumber" value="[% HTML.escape(saved_xyznumber) %]"> |
138 | 134 |
[% L.hidden_tag("rowcount", rowcount) %] |
139 | 135 |
<input type="hidden" name="callback" value="[% callback | html %]"> |
... | ... | |
146 | 142 |
<div id="shipto_inputs" class="hidden"> |
147 | 143 |
[%- PROCESS 'common/_ship_to_dialog.html' %] |
148 | 144 |
</div> |
145 |
|
|
146 |
<div id="email_inputs" class="hidden"></div> |
|
147 |
|
|
148 |
<div id="print_options" class="hidden"> |
|
149 |
[% print_options %] |
|
150 |
</div> |
|
149 | 151 |
</form> |
150 | 152 |
|
151 | 153 |
<div id="shipto_dialog" class="hidden"></div> |
templates/webpages/oe/form_header.html | ||
---|---|---|
16 | 16 |
[%- END %] |
17 | 17 |
|
18 | 18 |
[%- FOREACH row = HIDDENS %] |
19 |
<input type="hidden" name="[% HTML.escape(row.name) %]" value="[% HTML.escape(row.value) %]" > |
|
19 |
<input type="hidden" name="[% HTML.escape(row.name) %]" id="[% HTML.escape(row.name) %]" value="[% HTML.escape(row.value) %]" >
|
|
20 | 20 |
[%- END %] |
21 | 21 |
|
22 | 22 |
<input type="hidden" name="convert_from_oe_ids" value="[% HTML.escape(convert_from_oe_ids) %]"> |
... | ... | |
190 | 190 |
[%- IF is_order %] |
191 | 191 |
<tr> |
192 | 192 |
<th width="70%" align="right" nowrap>[% 'Order Number' | $T8 %]</th> |
193 |
<td><input name="ordnumber" size="11" value="[% HTML.escape(ordnumber) %]"></td> |
|
193 |
<td><input name="ordnumber" id="ordnumber" size="11" value="[% HTML.escape(ordnumber) %]"></td>
|
|
194 | 194 |
</tr> |
195 | 195 |
[%- END %] |
196 | 196 |
<tr> |
197 | 197 |
<th width="70%" align="right" nowrap>[% IF is_req_quo %][% 'RFQ Number' | $T8 %][% ELSE %][% 'Quotation Number' | $T8 %][% END %]</th> |
198 |
<td><input name="quonumber" size="11" value="[% HTML.escape(quonumber) %]"></td> |
|
198 |
<td><input name="quonumber" id="quonumber" size="11" value="[% HTML.escape(quonumber) %]"></td>
|
|
199 | 199 |
</tr> |
200 | 200 |
[%- IF is_order %] |
201 | 201 |
<tr> |
202 | 202 |
<th width="70%" align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th> |
203 |
<td><input name="cusordnumber" size="11" value="[% HTML.escape(cusordnumber) %]"></td> |
|
203 |
<td><input name="cusordnumber" id="cusordnumber" size="11" value="[% HTML.escape(cusordnumber) %]"></td>
|
|
204 | 204 |
</tr> |
205 | 205 |
[%- END %] |
206 | 206 |
<tr> |
Auch abrufbar als: Unified diff
ActionBar: Angebote/Aufträge: E-Mail-Versand über Dialog implementiert