Revision fa117c2d
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/Controller/EmailJournal.pm | ||
---|---|---|
use SL::DB::Employee;
|
||
use SL::DB::EmailJournal;
|
||
use SL::DB::EmailJournalAttachment;
|
||
use SL::DB::Order;
|
||
use SL::Helper::Flash;
|
||
use SL::Locale::String;
|
||
use SL::Locale::String qw(t8);
|
||
use SL::System::TaskServer;
|
||
use SL::Presenter::EmailJournal;
|
||
|
||
use SL::DB::Order;
|
||
use SL::DB::Order::TypeData;
|
||
use SL::DB::DeliveryOrder;
|
||
use SL::DB::DeliveryOrder::TypeData;
|
||
use SL::DB::Reclamation;
|
||
use SL::DB::Reclamation::TypeData;
|
||
use SL::DB::Invoice;
|
||
use SL::DB::PurchaseInvoice;
|
||
|
||
use SL::DB::Manager::Customer;
|
||
use SL::DB::Manager::Vendor;
|
||
|
||
use Rose::Object::MakeMethods::Generic
|
||
(
|
||
scalar => [ qw(entry) ],
|
||
... | ... | |
__PACKAGE__->run_before('add_js');
|
||
|
||
my %RECORD_TYPES_INFO = (
|
||
# Order
|
||
Order => {
|
||
controller => 'Order',
|
||
model => 'SL::DB::Order',
|
||
types => SL::DB::Order::TypeData->valid_types(),
|
||
},
|
||
DeliveryOrder => {
|
||
controller => 'DeliveryOrder',
|
||
model => 'SL::DB::DeliveryOrder',
|
||
types => SL::DB::DeliveryOrder::TypeData->valid_types(),
|
||
},
|
||
Reclamation => {
|
||
controller => 'Reclamation',
|
||
model => 'SL::DB::Reclamation',
|
||
types => SL::DB::Reclamation::TypeData->valid_types(),
|
||
},
|
||
Invoice => {
|
||
controller => 'ar.pl',
|
||
model => 'SL::DB::Invoice',
|
||
types => [
|
||
'ar_transaction',
|
||
'invoice',
|
||
'invoice_for_advance_payment',
|
||
'invoice_for_advance_payment_storno',
|
||
'final_invoice',
|
||
'invoice_storno',
|
||
'credit_note',
|
||
'credit_note_storno',
|
||
],
|
||
},
|
||
PurchaseInvoice => {
|
||
controller => 'ap.pl',
|
||
model => 'SL::DB::PurchaseInvoice',
|
||
types => [
|
||
'purchase_order',
|
||
'purchase_quotation_intake',
|
||
'request_quotation',
|
||
'sales_order',
|
||
'sales_order_intake',
|
||
'sales_quotation',
|
||
'ap_transaction',
|
||
'purchase_invoice',
|
||
'purchase_credit_note',
|
||
],
|
||
},
|
||
);
|
||
... | ... | |
$::form->error(t8('You do not have permission to access this entry.'));
|
||
}
|
||
|
||
my @record_types_with_info = ();
|
||
for my $record_class ('SL::DB::Order', 'SL::DB::DeliveryOrder', 'SL::DB::Reclamation') {
|
||
my $valid_types = "${record_class}::TypeData"->valid_types();
|
||
for my $type (@$valid_types) {
|
||
|
||
my $type_data = SL::DB::Helper::TypeDataProxy->new($record_class, $type);
|
||
push @record_types_with_info, {
|
||
record_type => $type,
|
||
customervendor => $type_data->properties('customervendor'),
|
||
text => $type_data->text('type'),
|
||
};
|
||
}
|
||
}
|
||
push @record_types_with_info, (
|
||
# invoice
|
||
{ record_type => 'ar_transaction' , customervendor => 'customer', text => t8('AR Transaction')},
|
||
{ record_type => 'invoice' , customervendor => 'customer', text => t8('Invoice') },
|
||
{ record_type => 'invoice_for_advance_payment' , customervendor => 'customer', text => t8('Invoice for Advance Payment')},
|
||
{ record_type => 'invoice_for_advance_payment_storno', customervendor => 'customer', text => t8('Storno Invoice for Advance Payment')},
|
||
{ record_type => 'final_invoice' , customervendor => 'customer', text => t8('Final Invoice')},
|
||
{ record_type => 'invoice_storno' , customervendor => 'customer', text => t8('Storno Invoice')},
|
||
{ record_type => 'credit_note' , customervendor => 'customer', text => t8('Credit Note')},
|
||
{ record_type => 'credit_note_storno' , customervendor => 'customer', text => t8('Storno Credit Note')},
|
||
# purchase invoice
|
||
{ record_type => 'ap_transaction' , customervendor => 'vendor', text => t8('AP Transaction')},
|
||
{ record_type => 'purchase_invoice' , customervendor => 'vendor', text => t8('Purchase Invoice')},
|
||
{ record_type => 'purchase_credit_note', customervendor => 'vendor', text => t8('Purchase Credit Note')},
|
||
);
|
||
|
||
my $customer_vendor = $self->find_customer_vendor_from_email($self->entry);
|
||
|
||
$self->setup_show_action_bar;
|
||
$self->render('email_journal/show',
|
||
title => $::locale->text('View email'),
|
||
back_to => $back_to);
|
||
$self->render(
|
||
'email_journal/show',
|
||
title => $::locale->text('View email'),
|
||
CUSTOMER_VENDOR => , $customer_vendor,
|
||
CV_TYPE_FOUND => $customer_vendor && $customer_vendor->is_vendor ? 'vendor' : 'customer',
|
||
RECORD_TYPES_WITH_INFO => \@record_types_with_info,
|
||
back_to => $back_to
|
||
);
|
||
}
|
||
|
||
sub action_show_attachment {
|
||
... | ... | |
|
||
sub action_apply_record_action {
|
||
my ($self) = @_;
|
||
my $email_journal_id = $::form->{email_journal_id};
|
||
my $attachment_id = $::form->{attachment_id};
|
||
my $record_action = $::form->{record_action};
|
||
my $vendor_id = $::form->{vendor_id};
|
||
my $customer_id = $::form->{customer_id};
|
||
|
||
if ( $record_action =~ s/^link_// ) { # remove prefix
|
||
|
||
# Load record
|
||
my $record_type = $record_action;
|
||
my $record_id = $::form->{$record_type . "_id"};
|
||
my $record_type_model = $RECORD_TYPE_TO_MODEL{$record_type};
|
||
my $record = $record_type_model->new(id => $record_id)->load;
|
||
my $email_journal = SL::DB::EmailJournal->new(id => $email_journal_id)->load;
|
||
|
||
if ($attachment_id) {
|
||
my $attachment = SL::DB::EmailJournalAttachment->new(id => $attachment_id)->load;
|
||
$attachment->add_file_to_record($record);
|
||
}
|
||
|
||
$email_journal->link_to_record($record);
|
||
|
||
return $self->js->flash('info', $::locale->text('Linked to e-mail ') . $record->displayable_name)->render();
|
||
my $email_journal_id = $::form->{email_journal_id};
|
||
my $attachment_id = $::form->{attachment_id};
|
||
my $customer_vendor = $::form->{customer_vendor_selection};
|
||
my $customer_vendor_id = $::form->{"${customer_vendor}_id"};
|
||
my $action = $::form->{action_selection};
|
||
my $record_type = $::form->{"${customer_vendor}_record_type_selection"};
|
||
my $record_id = $::form->{"${record_type}_id"};
|
||
|
||
if ($action eq 'linking') {
|
||
return $self->link_and_add_attachment_to_record({
|
||
email_journal_id => $email_journal_id,
|
||
attachment_id => $attachment_id,
|
||
record_type => $record_type,
|
||
record_id => $record_id,
|
||
});
|
||
}
|
||
|
||
my %additional_params = ();
|
||
if ( $record_action =~ s/^customer_// ) { # remove prefix
|
||
$additional_params{customer_id} = $customer_id;
|
||
} elsif ( $record_action =~ s/^vendor_// ) { # remove prefix
|
||
$additional_params{vendor_id} = $vendor_id;
|
||
if ($action eq 'create_new') {
|
||
$additional_params{action} = 'add_from_email_journal';
|
||
$additional_params{"${customer_vendor}_id"} = $customer_vendor_id;
|
||
} else {
|
||
$additional_params{action} = 'edit_from_email_journal';
|
||
$additional_params{id} = $record_id;
|
||
}
|
||
$additional_params{type} = $record_action;
|
||
$additional_params{controller} = $RECORD_TYPE_TO_CONTROLLER{$record_action};
|
||
|
||
$self->redirect_to(
|
||
action => 'add_from_email_journal',
|
||
controller => $RECORD_TYPE_TO_CONTROLLER{$record_type},
|
||
type => $record_type,
|
||
from_id => $email_journal_id,
|
||
from_type => 'email_journal',
|
||
email_attachment_id => $attachment_id,
|
||
... | ... | |
# helpers
|
||
#
|
||
|
||
sub find_cv_from_email {
|
||
my ($self, $cv_type, $email_journal) = @_;
|
||
sub link_and_add_attachment_to_record {
|
||
my ($self, $params) = @_;
|
||
|
||
my $email_journal_id = $params->{email_journal_id};
|
||
my $attachment_id = $params->{attachment_id};
|
||
my $record_type = $params->{record_type};
|
||
my $record_id = $params->{record_id};
|
||
|
||
my $record_type_model = $RECORD_TYPE_TO_MODEL{$record_type};
|
||
my $record = $record_type_model->new(id => $record_id)->load;
|
||
my $email_journal = SL::DB::EmailJournal->new(id => $email_journal_id)->load;
|
||
|
||
if ($attachment_id) {
|
||
my $attachment = SL::DB::EmailJournalAttachment->new(id => $attachment_id)->load;
|
||
$attachment->add_file_to_record($record);
|
||
}
|
||
|
||
$email_journal->link_to_record($record);
|
||
|
||
return $self->js->flash('info', $::locale->text('Linked e-mail and attachment to ') . $record->displayable_name)->render();
|
||
}
|
||
|
||
sub find_customer_vendor_from_email {
|
||
my ($self, $email_journal, $cv_type) = @_;
|
||
my $email_address = $email_journal->from;
|
||
$email_address =~ s/.*<(.*)>/$1/; # address can look like "name surname <email_address>"
|
||
|
||
# search for customer or vendor or both
|
||
my $customer;
|
||
my $vendor;
|
||
if ($cv_type ne 'vendor') {
|
||
$customer = SL::DB::Manager::Customer->get_first(
|
||
# Separate query otherwise cv without contacts and shipto is not found
|
||
my $customer_vendor;
|
||
foreach my $manager (qw(SL::DB::Manager::Customer SL::DB::Manager::Vendor)) {
|
||
$customer_vendor ||= $manager->get_first(
|
||
where => [
|
||
or => [
|
||
email => $email_address,
|
||
cc => $email_address,
|
||
bcc => $email_address,
|
||
'contacts.cp_email' => $email_address,
|
||
'contacts.cp_privatemail' => $email_address,
|
||
'shipto.shiptoemail' => $email_address,
|
||
],
|
||
],
|
||
with_objects => [ 'contacts', 'shipto' ],
|
||
);
|
||
} elsif ($cv_type ne 'customer') {
|
||
$vendor = SL::DB::Manager::Vendor->get_first(
|
||
$customer_vendor ||= $manager->get_first(
|
||
where => [
|
||
or => [
|
||
email => $email_address,
|
||
cc => $email_address,
|
||
bcc => $email_address,
|
||
'contacts.cp_email' => $email_address,
|
||
'contacts.cp_privatemail' => $email_address,
|
||
],
|
||
],
|
||
with_objects => [ 'contacts'],
|
||
);
|
||
$customer_vendor ||= $manager->get_first(
|
||
where => [
|
||
or => [
|
||
'shipto.shiptoemail' => $email_address,
|
||
],
|
||
],
|
||
with_objects => [ 'contacts', 'shipto' ],
|
||
with_objects => [ 'shipto' ],
|
||
);
|
||
}
|
||
|
||
return $customer || $vendor;
|
||
return $customer_vendor;
|
||
}
|
||
|
||
sub find_customer_from_email {
|
js/kivi.EmailJournal.js | ||
---|---|---|
$.post("controller.pl", data, kivi.eval_json_result);
|
||
}
|
||
|
||
ns.update_extra_div_selection = function() {
|
||
let record_action = $('#record_action').val();
|
||
if (record_action == undefined) { return; }
|
||
ns.update_customer_vendor_selection = function() {
|
||
let customer_vendor = $('#customer_vendor_selection').val();
|
||
|
||
$('#customer_div').hide();
|
||
$('#customer_record_types_div').hide();
|
||
$('#vendor_div').hide();
|
||
$('#vendor_record_types_div').hide();
|
||
|
||
$('#link_sales_quotation_div').hide();
|
||
$('#link_sales_order_intake_div').hide();
|
||
$('#link_sales_order_div').hide();
|
||
$('#link_request_quotation_div').hide();
|
||
$('#link_purchase_quotation_intake_div').hide();
|
||
$('#link_purchase_order_div').hide();
|
||
|
||
$('#placeholder_div').hide();
|
||
|
||
// customer vendor
|
||
if (record_action.match(/^customer/)) {
|
||
if (customer_vendor == 'customer') {
|
||
$('#customer_div').show();
|
||
} else if (record_action.match(/^vendor/)) {
|
||
$('#customer_record_types_div').show();
|
||
} else { // if (customer_vendor == 'vendor')
|
||
$('#vendor_div').show();
|
||
// link
|
||
} else if (record_action.match(/^link_/)) {
|
||
$('#'+record_action+'_div').show();
|
||
// placeholder
|
||
$('#vendor_record_types_div').show();
|
||
}
|
||
kivi.EmailJournal.update_record_type_selection(customer_vendor);
|
||
}
|
||
|
||
ns.update_action_selection = function() {
|
||
let record_action = $('#action_selection').val();
|
||
|
||
$('#record_type_div').hide();
|
||
$('#no_record_type_div').hide();
|
||
|
||
if (record_action == 'create_new') {
|
||
$('#no_record_type_div').show();
|
||
} else {
|
||
$('#placeholder_div').show();
|
||
$('#record_type_div').show();
|
||
}
|
||
}
|
||
|
||
ns.apply_record_action = function() {
|
||
let record_action = $('#record_action').val();
|
||
if (record_action == '') {
|
||
alert(kivi.t8('Please select an action.'));
|
||
return;
|
||
ns.update_record_type_selection = function(customer_vendor) {
|
||
let record_type = $('#' + customer_vendor + '_record_type_selection').val();
|
||
|
||
$('.record_type').hide();
|
||
if (record_type != '') {
|
||
$('#' + record_type + '_div').show();
|
||
} else {
|
||
$('#record_type_placeholder_div').show();
|
||
}
|
||
}
|
||
|
||
ns.apply_action_with_attachment = function() {
|
||
let data = $('#record_action_form').serializeArray();
|
||
data.push({ name: 'action', value: 'EmailJournal/apply_record_action' });
|
||
|
||
... | ... | |
|
||
$(function() {
|
||
kivi.EmailJournal.update_attachment_preview();
|
||
kivi.EmailJournal.update_extra_div_selection();
|
||
});
|
templates/design40_webpages/email_journal/show.html | ||
---|---|---|
[% USE P %]
|
||
[% USE T8 %]
|
||
|
||
[% BLOCK filter_toggle_panel # can't change name %]
|
||
<table id="email_journal_details" class="tbl-horizontal">
|
||
<tbody>
|
||
<tr>
|
||
<th>[% 'From' | $T8 %]</th>
|
||
<td>[% L.input_tag('from', SELF.entry.from, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Recipients' | $T8 %]</th>
|
||
<td>[% L.input_tag('recipients', SELF.entry.recipients, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Subject' | $T8 %]</th>
|
||
<td>[% L.input_tag('subject', SELF.entry.subject, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Sent on' | $T8 %]</th>
|
||
<td>[% L.input_tag('sent_on', SELF.entry.sent_on.to_lxoffice("precision" => "second"), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Status' | $T8 %]</th>
|
||
<td>[% L.input_tag('status', P.email_journal.entry_status(SELF.entry), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Extended status' | $T8 %]</th>
|
||
<td>
|
||
[% L.textarea_tag('extended_status', SELF.entry.extended_status, wrap="soft", style="color:black; height:25px", class="wi-verywide", disabled=1) %]
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Headers' | $T8 %]</th>
|
||
<td>
|
||
[% L.textarea_tag('headers', HTML.escape(SELF.entry.headers), wrap="soft", style="color:black; height:25px", class="wi-verywide", disabled=1) %]
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Body' | $T8 %]</th>
|
||
<td>
|
||
[% IF SELF.entry.headers.match('(?i)content-type:.*text/html') %]
|
||
<div style="border:1px solid black;">
|
||
[% P.restricted_html(SELF.entry.body) %]
|
||
</div>
|
||
[% ELSE %]
|
||
[% L.textarea_tag('body', SELF.entry.body, wrap="soft", style="color:black; height:200px", class="wi-verywide", disabled=1) %]
|
||
[% END %]
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
[% END %]
|
||
|
||
|
||
|
||
<h1>[% FORM.title %]</h1>
|
||
|
||
[% INCLUDE 'common/flash.html' %]
|
||
|
||
<div class="wrapper" id="wrapper-0">
|
||
<form>
|
||
<div class="tabwidget" id="email_tabs">
|
||
<ul>
|
||
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
|
||
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=EmailJournal&object_id=[% HTML.url(SELF.entry.id) %]">[% 'Linked Records' | $T8 %]</a></li>
|
||
</ul>
|
||
|
||
<div class="wrapper">
|
||
[%
|
||
display_status = 'open';
|
||
button_closed = LxERP.t8('Show Email');
|
||
button_open = LxERP.t8('Hide Email');
|
||
INCLUDE 'common/toggle_panel.html';
|
||
%]
|
||
</div><!-- /.wrapper -->
|
||
[% PROCESS "email_journal/tabs/basic_data.html" %]
|
||
</div> <!-- /.tabwidget -->
|
||
</form>
|
||
|
||
<div class="wrapper" id="wrapper-0">
|
||
|
||
[% SET attachments = SELF.entry.attachments_sorted %]
|
||
|
||
... | ... | |
%]
|
||
</div>
|
||
|
||
<div class="col">
|
||
[% L.select_tag('record_action',
|
||
# id has to start with customer_ or vendor_ for picker selection
|
||
<div id="customer_vendor_div" class="col">
|
||
[% L.select_tag('customer_vendor_selection',
|
||
[
|
||
[ LxERP.t8("Linking"), [
|
||
{id => "link_sales_quotation", name => LxERP.t8("Link to sales quotation")},
|
||
{id => "link_sales_order_intake", name => LxERP.t8("Link to sales order intake")},
|
||
{id => "link_sales_order", name => LxERP.t8("Link to sales order")},
|
||
{id => "link_request_quotation", name => LxERP.t8("Link to request quotation")},
|
||
{id => "link_purchase_quotation_intake", name => LxERP.t8("Link to purchase quotation intake")},
|
||
{id => "link_purchase_order", name => LxERP.t8("Link to purchase order")},
|
||
|
||
] ],
|
||
[ LxERP.t8("Sales"), [
|
||
{id => "customer_sales_order", name => LxERP.t8("Create sales order")},
|
||
{id => "customer_sales_order_intake", name => LxERP.t8("Create sales order intake")},
|
||
{id => "customer_sales_quotation", name => LxERP.t8("Create sales quotation")},
|
||
] ],
|
||
[ LxERP.t8("Purchase"), [
|
||
{id => "vendor_purchase_order", name => LxERP.t8("Create purchase order")},
|
||
{id => "vendor_purchase_quotation_intake", name => LxERP.t8("Create purchase quotation intake")},
|
||
{id => "vendor_request_quotation", name => LxERP.t8("Create request quotation")},
|
||
|
||
] ],
|
||
{value => "customer", name => LxERP.t8("Sales")},
|
||
{value => "vendor", name => LxERP.t8("Purchase")},
|
||
],
|
||
value_key='id', title_key='name',
|
||
with_empty=1, empty_value='', empty_title=LxERP.t8("No action"),
|
||
with_optgroups=1,
|
||
class="wi-normal",
|
||
onchange='kivi.EmailJournal.update_extra_div_selection();'
|
||
default = CV_TYPE_FOUND,
|
||
value_key='value', title_key='name',
|
||
class="wi-verysmall",
|
||
onchange='kivi.EmailJournal.update_customer_vendor_selection();'
|
||
) %]
|
||
</div>
|
||
|
||
[% FOREACH cv_type_name = [['customer', 'Customer'], ['vendor', 'Vendor']] %]
|
||
[% SET cv_type = cv_type_name.0 %]
|
||
[% SET cv_name = cv_type_name.1 %]
|
||
<div id="[% cv_type _ "_div" %]" class="col" style="display:none">
|
||
[% FOREACH cv_option = [
|
||
['customer', 'Customer', 1],
|
||
['vendor', 'Vendor', 0],
|
||
] %]
|
||
[% SET cv_type = cv_option.0 %]
|
||
[% SET cv_name = cv_option.1 %]
|
||
[% SET cv_is_cusotmer = cv_option.2 %]
|
||
<div
|
||
id="[% cv_type _ "_div" %]" class="col"
|
||
style=[% IF cv_type == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %]
|
||
>
|
||
[% P.customer_vendor.picker(
|
||
cv_type _ "_id", SELF.find_cv_from_email(cv_type, SELF.entry),
|
||
cv_type _ "_id",
|
||
CUSTOMER_VENDOR.is_customer == cv_is_cusotmer ? CUSTOMER_VENDOR : undef,
|
||
type=cv_type, class="wi-normal", placeholder=LxERP.t8(cv_name)
|
||
) %]
|
||
</div>
|
||
[% END %]
|
||
[% FOREACH record_type = [
|
||
'sales_quotation', 'sales_order_intake', 'sales_order',
|
||
'request_quotation', 'purchase_quotation_intake', 'purchase_order'
|
||
] %]
|
||
<div id="[% "link_" _ record_type _ "_div" %]" class="col" style="display:none">
|
||
[% L.input_tag(record_type _ "_id", '',
|
||
style="color:black", class="wi-normal",
|
||
placeholder=record_type _ " id") %]
|
||
|
||
<div id="action_div" class="col">
|
||
[% L.select_tag('action_selection',
|
||
[
|
||
{value => "workflow", name => LxERP.t8("Create from Workflow")},
|
||
{value => "linking", name => LxERP.t8("Linking to Record")},
|
||
{value => "create_new", name => LxERP.t8("Create new")},
|
||
],
|
||
value_key='value', title_key='name',
|
||
class="wi-normal",
|
||
onchange='kivi.EmailJournal.update_action_selection();'
|
||
) %]
|
||
</div>
|
||
|
||
[% FOREACH customer_vendor = ['customer', 'vendor'] %]
|
||
<div id="[% customer_vendor _ "_record_types_div" %]" class="col"
|
||
style=[% IF customer_vendor == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %]
|
||
>
|
||
|
||
[%
|
||
SET options = [];
|
||
FOREACH record_info = RECORD_TYPES_WITH_INFO;
|
||
IF (record_info.customervendor == customer_vendor);
|
||
options.push({value => record_info.record_type, name => record_info.text});
|
||
END;
|
||
END;
|
||
%]
|
||
[% L.select_tag(customer_vendor _ '_record_type_selection',
|
||
options,
|
||
value_key='value', title_key='name',
|
||
with_empty=1, empty_value='', empty_title=LxERP.t8("Select record type"),
|
||
class="wi-normal",
|
||
onchange='kivi.EmailJournal.update_record_type_selection("' _ customer_vendor _ '");'
|
||
) %]
|
||
</div>
|
||
[% END %]
|
||
<div id="placeholder_div" class="col" style="display:block">
|
||
|
||
<div id="record_type_div" class="col" style="display:block">
|
||
[% FOREACH record_info = RECORD_TYPES_WITH_INFO %]
|
||
<div id="[% record_info.record_type _ "_div" %]" class="col record_type" style="display:none">
|
||
[% L.input_tag(record_info.record_type _ "_id", '',
|
||
style="color:black", class="wi-normal",
|
||
placeholder=record_info.record_type _ " id") %]
|
||
</div>
|
||
[% END %]
|
||
<div id="record_type_placeholder_div" class="col record_type" style="display:block">
|
||
[% L.input_tag('cv_placeholder', '',
|
||
style="color:black", class="wi-normal", disabled=1,
|
||
placeholder=LxERP.t8("Select record type first"),
|
||
) %]
|
||
</div>
|
||
</div>
|
||
<div id="no_record_type_div" class="col" style="display:none">
|
||
[% L.input_tag('cv_placeholder', '',
|
||
style="color:black", class="wi-normal", disabled=1,
|
||
placeholder=LxERP.t8("Select action first"),
|
||
placeholder=LxERP.t8("No record needed"),
|
||
) %]
|
||
</div>
|
||
|
||
<div class="col">
|
||
[% L.button_tag('kivi.EmailJournal.apply_record_action();', LxERP.t8('Apply with Attachment')) %]
|
||
[% L.button_tag('kivi.EmailJournal.apply_action_with_attachment();', LxERP.t8('Apply with Attachment')) %]
|
||
</div>
|
||
</div> <!-- action_div -->
|
||
</form>
|
||
... | ... | |
<!-- kivi.EmailJournal.update_attachment_preview -->
|
||
<div id="attachment_preview"></div>
|
||
[% END %]
|
||
|
||
</div> <!-- wrapper-2 -->
|
||
|
||
</div> <!-- wrapper-0 -->
|
templates/design40_webpages/email_journal/tabs/basic_data.html | ||
---|---|---|
[% USE T8 %]
|
||
[% USE HTML %]
|
||
[% USE LxERP %]
|
||
[% USE L %]
|
||
[% USE P %]
|
||
|
||
<div id="ui-tabs-basic-data">
|
||
|
||
<div class="wrapper">
|
||
[% INCLUDE 'generic/toggle_wrapper.html' %]
|
||
|
||
<table id="email_journal_details" class="tbl-horizontal">
|
||
<caption>[% 'E-Mail Details' | $T8 %]</caption>
|
||
<tbody>
|
||
<tr>
|
||
<th>[% 'From' | $T8 %]</th>
|
||
<td>[% L.input_tag('from', SELF.entry.from, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Recipients' | $T8 %]</th>
|
||
<td>[% L.input_tag('recipients', SELF.entry.recipients, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Subject' | $T8 %]</th>
|
||
<td>[% L.input_tag('subject', SELF.entry.subject, style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Sent on' | $T8 %]</th>
|
||
<td>[% L.input_tag('sent_on', SELF.entry.sent_on.to_lxoffice("precision" => "second"), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Status' | $T8 %]</th>
|
||
<td>[% L.input_tag('status', P.email_journal.entry_status(SELF.entry), style="color:black", class="wi-verywide", disabled=1) %]</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Extended status' | $T8 %]</th>
|
||
<td>
|
||
[% L.textarea_tag('extended_status', SELF.entry.extended_status, wrap="soft", style="color:black; height:25px", class="wi-verywide", disabled=1) %]
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Headers' | $T8 %]</th>
|
||
<td>
|
||
[% L.textarea_tag('headers', HTML.escape(SELF.entry.headers), wrap="soft", style="color:black; height:25px", class="wi-verywide", disabled=1) %]
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>[% 'Body' | $T8 %]</th>
|
||
<td>
|
||
[% IF SELF.entry.headers.match('(?i)content-type:.*text/html') %]
|
||
<div style="border:1px solid black;">
|
||
[% P.restricted_html(SELF.entry.body) %]
|
||
</div>
|
||
[% ELSE %]
|
||
[% L.textarea_tag('body', SELF.entry.body, wrap="soft", style="color:black; height:200px", class="wi-verywide", disabled=1) %]
|
||
[% END %]
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div><!-- /.wrapper -->
|
||
|
||
</div><!-- /#ui-tabs-basic-data -->
|
templates/webpages/email_journal/show.html | ||
---|---|---|
[% USE HTML %][% USE L %][% USE LxERP %][%- USE P -%]
|
||
[% USE HTML %][% USE L %][% USE LxERP %][%- USE P -%] [% USE T8 %]
|
||
|
||
<h1>[% FORM.title %]</h1>
|
||
|
||
[%- INCLUDE 'common/flash.html' %]
|
||
|
||
<table id="email_journal_details" class="email_journal_details">
|
||
<tbody>
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("From") %]</th>
|
||
<td>[%- HTML.escape(SELF.entry.from) %]</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Recipients") %]</th>
|
||
<td>[%- HTML.escape(SELF.entry.recipients) %]</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Subject") %]</th>
|
||
<td>[%- HTML.escape(SELF.entry.subject) %]</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Sent on") %]</th>
|
||
<td>[%- HTML.escape(SELF.entry.sent_on.to_lxoffice("precision" => "second")) %]</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Status") %]</th>
|
||
<td>
|
||
[% P.email_journal.entry_status(SELF.entry) %]
|
||
</td>
|
||
</tr>
|
||
<div class="tabwidget" id="email_tabs">
|
||
<ul>
|
||
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
|
||
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=EmailJournal&object_id=[% HTML.url(SELF.entry.id) %]">[% 'Linked Records' | $T8 %]</a></li>
|
||
</ul>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Extended status") %]</th>
|
||
<td><pre>[%- HTML.escape(SELF.entry.extended_status) %]</pre></td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Headers") %]</th>
|
||
<td><pre>[% HTML.escape(SELF.entry.headers) %]</pre></td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Body") %]</th>
|
||
<td>
|
||
[%- IF SELF.entry.headers.match('(?i)content-type:.*text/html') %]
|
||
[% P.restricted_html(SELF.entry.body) %]
|
||
[%- ELSE %]
|
||
<pre>[% HTML.escape(SELF.entry.body) %]</pre>
|
||
[%- END %]
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
[% PROCESS "email_journal/tabs/basic_data.html" %]
|
||
</div> <!-- /.tabwidget -->
|
||
|
||
[% SET attachments = SELF.entry.attachments_sorted %]
|
||
<h2>[% LxERP.t8("Attachments") %]</h2>
|
||
... | ... | |
</td>
|
||
|
||
<td>
|
||
[% L.select_tag('record_action',
|
||
# id has to start with customer_ or vendor_ for picker selection
|
||
[% L.select_tag('customer_vendor_selection',
|
||
[
|
||
[ LxERP.t8("Linking"), [
|
||
{id => "link_sales_quotation", name => LxERP.t8("Link to sales quotation")},
|
||
{id => "link_sales_order_intake", name => LxERP.t8("Link to sales order intake")},
|
||
{id => "link_sales_order", name => LxERP.t8("Link to sales order")},
|
||
{id => "link_request_quotation", name => LxERP.t8("Link to request quotation")},
|
||
{id => "link_purchase_quotation_intake", name => LxERP.t8("Link to purchase quotation intake")},
|
||
{id => "link_purchase_order", name => LxERP.t8("Link to purchase order")},
|
||
|
||
] ],
|
||
[ LxERP.t8("Sales"), [
|
||
{id => "customer_sales_order", name => LxERP.t8("Create sales order")},
|
||
{id => "customer_sales_order_intake", name => LxERP.t8("Create sales order intake")},
|
||
{id => "customer_sales_quotation", name => LxERP.t8("Create sales quotation")},
|
||
] ],
|
||
[ LxERP.t8("Purchase"), [
|
||
{id => "vendor_purchase_order", name => LxERP.t8("Create purchase order")},
|
||
{id => "vendor_purchase_quotation_intake", name => LxERP.t8("Create purchase quotation intake")},
|
||
{id => "vendor_request_quotation", name => LxERP.t8("Create request quotation")},
|
||
|
||
] ],
|
||
{value => "customer", name => LxERP.t8("Sales")},
|
||
{value => "vendor", name => LxERP.t8("Purchase")},
|
||
],
|
||
value_key='id', title_key='name',
|
||
with_empty=1, empty_value='', empty_title=LxERP.t8("No action"),
|
||
with_optgroups=1,
|
||
class="wi-normal",
|
||
onchange='kivi.EmailJournal.update_extra_div_selection();'
|
||
default = CV_TYPE_FOUND,
|
||
value_key='value', title_key='name',
|
||
class="wi-verysmall",
|
||
onchange='kivi.EmailJournal.update_customer_vendor_selection();'
|
||
) %]
|
||
</td>
|
||
|
||
<td>
|
||
[% FOREACH cv_type_name = [['customer', 'Customer'], ['vendor', 'Vendor']] %]
|
||
[% SET cv_type = cv_type_name.0 %]
|
||
[% SET cv_name = cv_type_name.1 %]
|
||
<div id="[% cv_type _ "_div" %]" style="display:none">
|
||
[% FOREACH cv_option = [
|
||
['customer', 'Customer', 1],
|
||
['vendor', 'Vendor', 0],
|
||
] %]
|
||
[% SET cv_type = cv_option.0 %]
|
||
[% SET cv_name = cv_option.1 %]
|
||
[% SET cv_is_cusotmer = cv_option.2 %]
|
||
<div
|
||
id="[% cv_type _ "_div" %]" class="col"
|
||
style=[% IF cv_type == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %]
|
||
>
|
||
[% P.customer_vendor.picker(
|
||
cv_type _ "_id", SELF.find_cv_from_email(cv_type, SELF.entry),
|
||
cv_type _ "_id",
|
||
CUSTOMER_VENDOR.is_customer == cv_is_cusotmer ? CUSTOMER_VENDOR : undef,
|
||
type=cv_type, class="wi-normal", placeholder=LxERP.t8(cv_name)
|
||
) %]
|
||
</div>
|
||
[% END %]
|
||
[% FOREACH record_type = [
|
||
'sales_quotation', 'sales_order_intake', 'sales_order',
|
||
'request_quotation', 'purchase_quotation_intake', 'purchase_order'
|
||
] %]
|
||
<div id="[% "link_" _ record_type _ "_div" %]" style="display:none">
|
||
[% L.input_tag(record_type _ "_id", '',
|
||
style="color:black", class="wi-normal",
|
||
placeholder=record_type _ " id") %]
|
||
[% END %]
|
||
</td>
|
||
|
||
<td>
|
||
[% L.select_tag('action_selection',
|
||
[
|
||
{value => "workflow", name => LxERP.t8("Create from Workflow")},
|
||
{value => "linking", name => LxERP.t8("Linking to Record")},
|
||
{value => "create_new", name => LxERP.t8("Create new")},
|
||
],
|
||
value_key='value', title_key='name',
|
||
class="wi-normal",
|
||
onchange='kivi.EmailJournal.update_action_selection();'
|
||
) %]
|
||
</td>
|
||
|
||
<td>
|
||
[% FOREACH customer_vendor = ['customer', 'vendor'] %]
|
||
<div id="[% customer_vendor _ "_record_types_div" %]" class="col"
|
||
style=[% IF customer_vendor == CV_TYPE_FOUND %] "display:block" [% ELSE %] "display:none" [% END %]
|
||
>
|
||
|
||
[%
|
||
SET options = [];
|
||
FOREACH record_info = RECORD_TYPES_WITH_INFO;
|
||
IF (record_info.customervendor == customer_vendor);
|
||
options.push({value => record_info.record_type, name => record_info.text});
|
||
END;
|
||
END;
|
||
%]
|
||
[% L.select_tag(customer_vendor _ '_record_type_selection',
|
||
options,
|
||
value_key='value', title_key='name',
|
||
with_empty=1, empty_value='', empty_title=LxERP.t8("Select record type"),
|
||
class="wi-normal",
|
||
onchange='kivi.EmailJournal.update_record_type_selection("' _ customer_vendor _ '");'
|
||
) %]
|
||
</div>
|
||
[% END %]
|
||
<div id="placeholder_div" style="display:block">
|
||
</td>
|
||
|
||
<td>
|
||
<div id="record_type_div" class="col" style="display:block">
|
||
[% FOREACH record_info = RECORD_TYPES_WITH_INFO %]
|
||
<div id="[% record_info.record_type _ "_div" %]" class="col record_type" style="display:none">
|
||
[% L.input_tag(record_info.record_type _ "_id", '',
|
||
style="color:black", class="wi-normal",
|
||
placeholder=record_info.record_type _ " id") %]
|
||
</div>
|
||
[% END %]
|
||
<div id="record_type_placeholder_div" class="col record_type" style="display:block">
|
||
[% L.input_tag('cv_placeholder', '',
|
||
style="color:black", class="wi-normal", disabled=1,
|
||
placeholder=LxERP.t8("Select record type first"),
|
||
) %]
|
||
</div>
|
||
</div>
|
||
<div id="no_record_type_div" class="col" style="display:none">
|
||
[% L.input_tag('cv_placeholder', '',
|
||
style="color:black", class="wi-normal", disabled=1,
|
||
placeholder=LxERP.t8("Select action first"),
|
||
placeholder=LxERP.t8("No record needed"),
|
||
) %]
|
||
</div>
|
||
</td>
|
||
|
||
<td>
|
||
[% L.button_tag('kivi.EmailJournal.apply_record_action();', LxERP.t8('Apply with Attachment')) %]
|
||
[% L.button_tag('kivi.EmailJournal.apply_action_with_attachment();', LxERP.t8('Apply with Attachment')) %]
|
||
</td>
|
||
</tr> </table>
|
||
</form>
|
templates/webpages/email_journal/tabs/basic_data.html | ||
---|---|---|
[% USE HTML %][% USE L %][% USE LxERP %][%- USE P -%]
|
||
|
||
<div id="ui-tabs-basic-data">
|
||
|
||
<table id="email_journal_details" class="email_journal_details">
|
||
<tbody>
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("From") %]</th>
|
||
<td>[%- HTML.escape(SELF.entry.from) %]</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Recipients") %]</th>
|
||
<td>[%- HTML.escape(SELF.entry.recipients) %]</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Subject") %]</th>
|
||
<td>[%- HTML.escape(SELF.entry.subject) %]</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Sent on") %]</th>
|
||
<td>[%- HTML.escape(SELF.entry.sent_on.to_lxoffice("precision" => "second")) %]</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Status") %]</th>
|
||
<td>
|
||
[% P.email_journal.entry_status(SELF.entry) %]
|
||
</td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Extended status") %]</th>
|
||
<td><pre>[%- HTML.escape(SELF.entry.extended_status) %]</pre></td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Headers") %]</th>
|
||
<td><pre>[% HTML.escape(SELF.entry.headers) %]</pre></td>
|
||
</tr>
|
||
|
||
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Body") %]</th>
|
||
<td>
|
||
[%- IF SELF.entry.headers.match('(?i)content-type:.*text/html') %]
|
||
[% P.restricted_html(SELF.entry.body) %]
|
||
[%- ELSE %]
|
||
<pre>[% HTML.escape(SELF.entry.body) %]</pre>
|
||
[%- END %]
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
|
||
</div><!-- /#ui-tabs-basic-data -->
|
Auch abrufbar als: Unified diff
EmailJournal: Templates überarbeitet und Verknüpfte Belege hinzugefügt