Revision 034cbfaa
Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt
SL/Controller/EmailJournal.pm | ||
---|---|---|
model => 'SL::DB::Reclamation',
|
||
types => SL::DB::Reclamation::TypeData->valid_types(),
|
||
},
|
||
Invoice => {
|
||
ArTransaction => {
|
||
controller => 'ar.pl',
|
||
model => 'SL::DB::Invoice',
|
||
types => [
|
||
'ar_transaction',
|
||
],
|
||
},
|
||
Invoice => {
|
||
controller => 'is.pl',
|
||
model => 'SL::DB::Invoice',
|
||
types => [
|
||
'invoice',
|
||
'invoice_for_advance_payment',
|
||
'invoice_for_advance_payment_storno',
|
||
... | ... | |
'credit_note_storno',
|
||
],
|
||
},
|
||
PurchaseInvoice => {
|
||
ApTransaction => {
|
||
controller => 'ap.pl',
|
||
model => 'SL::DB::PurchaseInvoice',
|
||
types => [
|
||
'ap_transaction',
|
||
],
|
||
},
|
||
PurchaseInvoice => {
|
||
controller => 'ir.pl',
|
||
model => 'SL::DB::PurchaseInvoice',
|
||
types => [
|
||
'purchase_invoice',
|
||
'purchase_credit_note',
|
||
],
|
||
... | ... | |
$::form->error(t8('You do not have permission to access this entry.'));
|
||
}
|
||
|
||
# TODO: what record types can be created, which are only available in workflows?
|
||
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();
|
||
... | ... | |
$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{action} = 'edit_with_email_journal_workflow';
|
||
$additional_params{id} = $record_id;
|
||
}
|
||
|
||
$self->redirect_to(
|
||
controller => $RECORD_TYPE_TO_CONTROLLER{$record_type},
|
||
type => $record_type,
|
||
from_id => $email_journal_id,
|
||
from_type => 'email_journal',
|
||
email_journal_id => $email_journal_id,
|
||
email_attachment_id => $attachment_id,
|
||
%additional_params,
|
||
);
|
SL/DB/EmailJournal.pm | ||
---|---|---|
|
||
use strict;
|
||
|
||
use Carp qw(croak);
|
||
use List::Util qw(first);
|
||
|
||
use SL::Webdav;
|
||
use SL::File;
|
||
|
||
... | ... | |
return $result || ($self->id <=> $other->id);
|
||
}
|
||
|
||
sub link_to_record_with_attachment {
|
||
my ($self, $record, $attachment_or_id) = @_;
|
||
|
||
if ($attachment_or_id ne '') {
|
||
my $attachment = ref $attachment_or_id ?
|
||
$attachment_or_id
|
||
: first {$_->id == $attachment_or_id} @{$self->attachments_sorted};
|
||
croak "Email journal attachment does not belong to this email journal"
|
||
unless $attachment && $attachment->email_journal_id == $self->id;
|
||
$attachment->add_file_to_record($record);
|
||
}
|
||
|
||
$self->link_to_record($record);
|
||
}
|
||
|
||
sub process_attachments_as_purchase_invoices {
|
||
my ($self) = @_;
|
||
|
SL/DB/EmailJournalAttachment.pm | ||
---|---|---|
# copy file to webdav folder
|
||
if ($::instance_conf->get_webdav_documents) {
|
||
my $record_type = $record->record_type;
|
||
# TODO: file and webdav use different types for ap_transaction
|
||
# 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 = 'invoice' if $record_type eq 'invoice_storno';
|
||
my $webdav = SL::Webdav->new(
|
||
type => $record_type,
|
||
number => $record->record_number,
|
||
... | ... | |
# copy file to doc storage
|
||
if ($::instance_conf->get_doc_storage) {
|
||
my $record_type = $record->record_type;
|
||
# TODO: file and webdav use different types for ap_invoice
|
||
# TODO: file and webdav use different types
|
||
$record_type = 'purchase_invoice' if $record_type eq 'ap_transaction';
|
||
$record_type = 'invoice' if $record_type eq 'ar_transaction';
|
||
$record_type = 'invoice' if $record_type eq 'invoice_storno';
|
||
eval {
|
||
SL::File->save(
|
||
object_id => $record->id,
|
Auch abrufbar als: Unified diff
EmailJournal: Workflow angepasst