Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5e0c45f8

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 5e0c45f829a3b3e8c2b1d6f6b2a77dee8e0294af
  • Vorgänger 1ae384cf
  • Nachfolger 5b44ba35

Belegvorlagen + Dialogbuchung: Workflow von EmailJournal aus umgesetzt

Unterschiede anzeigen:

SL/AP.pm
)->load;
$email_journal->link_to_record_with_attachment(
$ap_transaction_storno,
delete $::form->{email_attachment_id}
delete $::form->{workflow_email_attachment_id}
);
}
SL/AR.pm
)->load;
$email_journal->link_to_record_with_attachment(
$ar_transaction_storno,
delete $::form->{email_attachment_id}
delete $::form->{workflow_email_attachment_id}
);
}
SL/Controller/EmailJournal.pm
class => 'Reclamation',
types => SL::DB::Reclamation::TypeData->valid_types(),
},
GlTransaction => {
controller => 'gl.pl',
class => 'GLTransaction',
types => [
'gl_transaction',
],
},
ArTransaction => {
controller => 'ar.pl',
class => 'Invoice',
......
'purchase_credit_note',
],
},
RecordTemplate => {
controller => '',
GlRecordTemplate => {
controller => 'gl.pl',
class => 'RecordTemplate',
types => [
'gl_transaction_template',
],
},
ArRecordTemplate => {
controller => 'ar.pl',
class => 'RecordTemplate',
types => [
'ar_transaction_template',
],
},
ApRecordTemplate => {
controller => 'ap.pl',
class => 'RecordTemplate',
types => [
'ap_transaction_template',
],
}
},
);
my %RECORD_TYPE_TO_CONTROLLER =
map {
......
$_ => 'invnumber';
} elsif (any {$model eq $_} qw(SL::DB::RecordTemplate)) {
$_ => 'template_name';
} elsif (any {$model eq $_} qw(SL::DB::GLTransaction)) {
$_ => 'reference';
} else {
my $type_data = SL::DB::Helper::TypeDataProxy->new($model, $_);
$_ => $type_data->properties('nr_key');
......
{ record_type => 'purchase_invoice', customervendor => 'vendor', workflow_needed => 0, can_workflow => 1, text => t8('Purchase Invoice')},
{ record_type => 'purchase_credit_note', customervendor => 'vendor', workflow_needed => 0, can_workflow => 1, text => t8('Purchase Credit Note')},
# transactions
# TODO: create gl_transaction with email
# { record_type => 'gl_transaction', customervendor => 'customer', workflow_needed => 0, can_workflow => 0, text => t8('GL Transaction')},
# { record_type => 'gl_transaction', customervendor => 'vendor', workflow_needed => 0, can_workflow => 0, text => t8('GL Transaction')},
# gl_transaction can be for vendor and customer
{ record_type => 'gl_transaction', customervendor => 'customer', workflow_needed => 0, can_workflow => 1, text => t8('GL Transaction')},
{ record_type => 'gl_transaction', customervendor => 'vendor', workflow_needed => 0, can_workflow => 1, text => t8('GL Transaction')},
{ record_type => 'ar_transaction', customervendor => 'customer', workflow_needed => 0, can_workflow => 1, text => t8('AR Transaction')},
{ record_type => 'ap_transaction', customervendor => 'vendor', workflow_needed => 0, can_workflow => 1, text => t8('AP Transaction')},
# templates
......
my ($self, $customer_vendor_type, $action) = @_;
return [
map { $_->{record_type} }
grep {
# No gl_transaction in standard workflows
# They can't be filtered by customer/vendor or open/closed and polute the list
($_->{record_type} ne 'gl_transaction')
}
grep {
($_->{customervendor} eq $customer_vendor_type)
&& ($action eq 'workflow_record' ? $_->{can_workflow} : 1)
......
$additional_where{$nr_key} = { ilike => "%$record_number%" };
}
unless ($with_closed) {
if (any {$_ eq 'closed' } $model->meta->columns) {
if (any {$_ eq 'closed'} $model->meta->columns) {
$additional_where{closed} = 0;
} elsif (any {$_ eq 'paid' } $model->meta->columns) {
} elsif (any {$_ eq 'paid'} $model->meta->columns) {
$additional_where{amount} = { gt => \'paid' };
}
}
......
my $action = $::form->{action_selection};
my $record_id = $::form->{"record_id"};
my $record_type = $::form->{"record_type"};
$record_type ||= $::form->{"${customer_vendor}_record_type_selection"};
$record_type ||= $::form->{"${customer_vendor}_${action}_type_selection"};
die t8("No record is selected.") unless $record_id || $action eq 'create_new';
die t8("No record is selected.") unless $record_id || $action eq 'new_record';
die t8("No record type is selected.") unless $record_type;
die "no 'email_journal_id' was given" unless $email_journal_id;
die "no 'customer_vendor_selection' was given" unless $customer_vendor;
......
}
my %additional_params = ();
if ($action eq 'create_new') {
if ($action eq 'new_record') {
$additional_params{action} = 'add_from_email_journal';
$additional_params{"${customer_vendor}_id"} = $customer_vendor_id;
} else {
} elsif ($action eq 'template_record') {
$additional_params{action} = 'load_record_template_from_email_journal';
$additional_params{id} = $record_id;
$additional_params{form_defaults} = {
email_journal_id => $email_journal_id,
email_attachment_id => $attachment_id,
};
} else { # workflow_record
$additional_params{action} = 'edit_with_email_journal_workflow';
$additional_params{id} = $record_id;
}
SL/DB/EmailJournalAttachment.pm
# TODO: file and webdav use different types
$record_type = 'accounts_payable' if $record_type eq 'ap_transaction';
$record_type = 'general_ledger' if $record_type eq 'ar_transaction';
$record_type = 'general_ledger' if $record_type eq 'gl_transaction';
$record_type = 'invoice' if $record_type eq 'invoice_storno';
my $webdav = SL::Webdav->new(
type => $record_type,
SL/DB/GLTransaction.pm
use SL::DB::Helper::LinkedRecords;
use SL::DB::MetaSetup::GLTransaction;
use SL::DB::Manager::GLTransaction;
use SL::Locale::String qw(t8);
use List::Util qw(sum);
use SL::DATEV;
use Carp;
use Data::Dumper;
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
__PACKAGE__->meta->make_manager_class;
__PACKAGE__->meta->add_relationship(
transactions => {
type => 'one to many',
......
__PACKAGE__->meta->initialize;
sub record_type {return 'gl_transaction';}
sub record_number {goto &id;}
sub displayable_name {goto &oneline_summary;}
sub abbreviation {
my $self = shift;
SL/DB/Manager/GLTransaction.pm
package SL::DB::Manager::GLTransaction;
use strict;
use parent qw(SL::DB::Helper::Manager);
sub object_class { 'SL::DB::GLTransaction' }
__PACKAGE__->make_manager_methods;
sub type_filter {
my $class = shift;
my $type = lc(shift || '');
return if $type eq 'gl_transaction';
die "Unknown type $type";
}
1;
SL/GL.pm
use SL::DB::Chart;
use SL::DB::Draft;
use SL::DB::ValidityToken;
use SL::DB::GLTransaction;
use SL::Util qw(trim);
use SL::DB;
......
do_query($form, $dbh, $query, (values %$row));
}
if ($form->{workflow_email_journal_id}) {
my $ar_transaction_storno = SL::DB::GLTransaction->new(id => $new_id)->load;
my $email_journal = SL::DB::EmailJournal->new(
id => delete $form->{workflow_email_journal_id}
)->load;
$email_journal->link_to_record_with_attachment(
$ar_transaction_storno,
delete $::form->{workflow_email_attachment_id}
);
}
return 1;
}
bin/mozilla/ap.pl
&add;
}
sub load_record_template_from_email_journal {
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
&load_record_template;
}
sub edit_with_email_journal_workflow {
my ($self) = @_;
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
bin/mozilla/ar.pl
&add;
}
sub load_record_template_from_email_journal {
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
&load_record_template;
}
sub edit_with_email_journal_workflow {
my ($self) = @_;
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
bin/mozilla/gl.pl
use SL::DB::BankTransactionAccTrans;
use SL::DB::Tax;
use SL::DB::ValidityToken;
use SL::DB::GLTransaction;
use SL::FU;
use SL::GL;
use SL::Helper::Flash qw(flash flash_later);
......
}
sub add_from_email_journal {
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
&add;
}
sub load_record_template_from_email_journal {
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
&load_record_template;
}
sub edit_with_email_journal_workflow {
my ($self) = @_;
die "No 'email_journal_id' was given." unless ($::form->{email_journal_id});
$::form->{workflow_email_journal_id} = delete $::form->{email_journal_id};
$::form->{workflow_email_attachment_id} = delete $::form->{email_attachment_id};
&edit;
}
sub prepare_transaction {
$main::lxdebug->enter_sub();
......
)->webdav_path;
}
if ($form->{email_journal_id} && $form->{id} ne "") {
my $ar_transaction = SL::DB::GLTransaction->new(id => $form->{id})->load;
my $email_journal = SL::DB::EmailJournal->new(
id => delete $form->{email_journal_id}
)->load;
$email_journal->link_to_record_with_attachment($ar_transaction, delete $::form->{email_attachment_id});
}
my $msg = $::locale->text("General ledger transaction '#1' posted (ID: #2)", $form->{reference}, $form->{id});
if ($form->{callback} =~ /BankTransaction/ && $form->{bt_id}) {
SL::Helper::Flash::flash_later('info', $msg) if $msg;
css/design40/email_journal.css
input.record_button {
color: var(--color-dark);
background-color: var(--color-lighter);
width: 200px;
width: 300px;
padding: 5px;
margin: 5px;
float: left;
locale/de/all
'Create customers and vendors. Edit all vendors. Edit only customers where salesman equals employee (login)' => 'Kunden und Lieferanten erfassen. Alle Lieferanten bearbeiten. Nur Kunden bearbeiten bei denen der Verkäufer gleich Bearbeiter (login) ist',
'Create delivery order' => 'Lieferschein erstellen',
'Create first invoice on' => 'Erste Rechnung erzeugen am',
'Create from Record Template' => 'Mit Belegvorlage erstellen',
'Create from Record Template' => 'Neu erfassen mit Belegvorlage',
'Create from Workflow' => 'Workflow weiterführen von',
'Create invoice' => 'Buchung erstellen',
'Create invoice?' => 'Rechnung erstellen?',
templates/design40_webpages/ar/form_header.html
<div id="ui-tabs-basic-data">
[% IF email_attachment_id || workflow_email_attachment_id%]
[% IF email_attachment_id || workflow_email_attachment_id %]
<div class="wrapper" id="email_attachment_wrapper">
[%
BLOCK panel_1;
templates/design40_webpages/email_journal/show.html
</div><!-- /.record_toggle -->
</div><!-- record_div -->
</div><!-- record_selection_div -->
<div id="create_new_div" class="input-panel" style="display:none;min-width:0;margin:0">
<div id="new_record_div" class="input-panel" style="display:none;min-width:0;margin:0">
[% L.button_tag('kivi.EmailJournal.apply_action_with_attachment();',
LxERP.t8('Apply with Attachment')) %]
</div>
templates/design40_webpages/gl/form_header.html
[% USE LxERP %]
[% USE T8 %]
[% USE L %]
<h1>[% title | html %]</h1>
[% USE P %]
<h1>
[% IF workflow_email_journal_id; LxERP.t8("Email Journal Workflow") _ " - "; END; %]
[% title | html %]
</h1>
<script type="text/javascript">
<!--
......
[% IF !id %]
[% L.hidden_tag('form_validity_token', form_validity_token) %]
[% END %]
[% L.hidden_tag('email_journal_id', email_journal_id) %]
[% L.hidden_tag('email_attachment_id', email_attachment_id) %]
[% L.hidden_tag('workflow_email_journal_id', workflow_email_journal_id) %]
[% L.hidden_tag('workflow_email_attachment_id', workflow_email_attachment_id) %]
<input type=hidden name=title value="[% hide_title | html %]">
......
<ul>
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
[% IF email_attachment_id || workflow_email_attachment_id %]
<li><a href="controller.pl?action=EmailJournal/attachment_preview&attachment_id=[% HTML.url(email_attachment_id || workflow_email_attachment_id) %]">[% 'Email Attachment Preview' | $T8 %]</a></li>
[% END %]
[% IF INSTANCE_CONF.get_webdav %]
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
[% END %]
......
</div><!-- /.wrapper -->
[% IF email_attachment_id || workflow_email_attachment_id %]
<div class="wrapper" id="email_attachment_wrapper">
[%
BLOCK panel_1;
P.email_journal.attachment_preview(
email_attachment_id || workflow_email_attachment_id,
style="height:600px"
);
END;
INCLUDE 'common/toggle_panel.html'
block_name='panel_1'
button_closed = LxERP.t8('Show Attachment')
button_open = LxERP.t8('Hide Attachment')
;
%]
</div>
[% END %]
<div class="wrapper">
<table class="tbl-horizontal">

Auch abrufbar als: Unified diff