Revision 6d7fc901
Von Tamino Steinert vor 11 Monaten hinzugefügt
SL/Controller/EmailJournal.pm | ||
---|---|---|
50 | 50 |
model => 'SL::DB::Reclamation', |
51 | 51 |
types => SL::DB::Reclamation::TypeData->valid_types(), |
52 | 52 |
}, |
53 |
Invoice => {
|
|
53 |
ArTransaction => {
|
|
54 | 54 |
controller => 'ar.pl', |
55 | 55 |
model => 'SL::DB::Invoice', |
56 | 56 |
types => [ |
57 | 57 |
'ar_transaction', |
58 |
], |
|
59 |
}, |
|
60 |
Invoice => { |
|
61 |
controller => 'is.pl', |
|
62 |
model => 'SL::DB::Invoice', |
|
63 |
types => [ |
|
58 | 64 |
'invoice', |
59 | 65 |
'invoice_for_advance_payment', |
60 | 66 |
'invoice_for_advance_payment_storno', |
... | ... | |
64 | 70 |
'credit_note_storno', |
65 | 71 |
], |
66 | 72 |
}, |
67 |
PurchaseInvoice => {
|
|
73 |
ApTransaction => {
|
|
68 | 74 |
controller => 'ap.pl', |
69 | 75 |
model => 'SL::DB::PurchaseInvoice', |
70 | 76 |
types => [ |
71 | 77 |
'ap_transaction', |
78 |
], |
|
79 |
}, |
|
80 |
PurchaseInvoice => { |
|
81 |
controller => 'ir.pl', |
|
82 |
model => 'SL::DB::PurchaseInvoice', |
|
83 |
types => [ |
|
72 | 84 |
'purchase_invoice', |
73 | 85 |
'purchase_credit_note', |
74 | 86 |
], |
... | ... | |
117 | 129 |
$::form->error(t8('You do not have permission to access this entry.')); |
118 | 130 |
} |
119 | 131 |
|
132 |
# TODO: what record types can be created, which are only available in workflows? |
|
120 | 133 |
my @record_types_with_info = (); |
121 | 134 |
for my $record_class ('SL::DB::Order', 'SL::DB::DeliveryOrder', 'SL::DB::Reclamation') { |
122 | 135 |
my $valid_types = "${record_class}::TypeData"->valid_types(); |
... | ... | |
217 | 230 |
$additional_params{action} = 'add_from_email_journal'; |
218 | 231 |
$additional_params{"${customer_vendor}_id"} = $customer_vendor_id; |
219 | 232 |
} else { |
220 |
$additional_params{action} = 'edit_from_email_journal';
|
|
233 |
$additional_params{action} = 'edit_with_email_journal_workflow';
|
|
221 | 234 |
$additional_params{id} = $record_id; |
222 | 235 |
} |
223 | 236 |
|
224 | 237 |
$self->redirect_to( |
225 | 238 |
controller => $RECORD_TYPE_TO_CONTROLLER{$record_type}, |
226 | 239 |
type => $record_type, |
227 |
from_id => $email_journal_id, |
|
228 |
from_type => 'email_journal', |
|
240 |
email_journal_id => $email_journal_id, |
|
229 | 241 |
email_attachment_id => $attachment_id, |
230 | 242 |
%additional_params, |
231 | 243 |
); |
SL/DB/EmailJournal.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
|
5 |
use Carp qw(croak); |
|
6 |
use List::Util qw(first); |
|
7 |
|
|
5 | 8 |
use SL::Webdav; |
6 | 9 |
use SL::File; |
7 | 10 |
|
... | ... | |
33 | 36 |
return $result || ($self->id <=> $other->id); |
34 | 37 |
} |
35 | 38 |
|
39 |
sub link_to_record_with_attachment { |
|
40 |
my ($self, $record, $attachment_or_id) = @_; |
|
41 |
|
|
42 |
if ($attachment_or_id ne '') { |
|
43 |
my $attachment = ref $attachment_or_id ? |
|
44 |
$attachment_or_id |
|
45 |
: first {$_->id == $attachment_or_id} @{$self->attachments_sorted}; |
|
46 |
croak "Email journal attachment does not belong to this email journal" |
|
47 |
unless $attachment && $attachment->email_journal_id == $self->id; |
|
48 |
$attachment->add_file_to_record($record); |
|
49 |
} |
|
50 |
|
|
51 |
$self->link_to_record($record); |
|
52 |
} |
|
53 |
|
|
36 | 54 |
sub process_attachments_as_purchase_invoices { |
37 | 55 |
my ($self) = @_; |
38 | 56 |
|
SL/DB/EmailJournalAttachment.pm | ||
---|---|---|
17 | 17 |
# copy file to webdav folder |
18 | 18 |
if ($::instance_conf->get_webdav_documents) { |
19 | 19 |
my $record_type = $record->record_type; |
20 |
# TODO: file and webdav use different types for ap_transaction
|
|
20 |
# TODO: file and webdav use different types |
|
21 | 21 |
$record_type = 'accounts_payable' if $record_type eq 'ap_transaction'; |
22 |
$record_type = 'general_ledger' if $record_type eq 'ar_transaction'; |
|
23 |
$record_type = 'invoice' if $record_type eq 'invoice_storno'; |
|
22 | 24 |
my $webdav = SL::Webdav->new( |
23 | 25 |
type => $record_type, |
24 | 26 |
number => $record->record_number, |
... | ... | |
37 | 39 |
# copy file to doc storage |
38 | 40 |
if ($::instance_conf->get_doc_storage) { |
39 | 41 |
my $record_type = $record->record_type; |
40 |
# TODO: file and webdav use different types for ap_invoice
|
|
42 |
# TODO: file and webdav use different types |
|
41 | 43 |
$record_type = 'purchase_invoice' if $record_type eq 'ap_transaction'; |
44 |
$record_type = 'invoice' if $record_type eq 'ar_transaction'; |
|
45 |
$record_type = 'invoice' if $record_type eq 'invoice_storno'; |
|
42 | 46 |
eval { |
43 | 47 |
SL::File->save( |
44 | 48 |
object_id => $record->id, |
Auch abrufbar als: Unified diff
EmailJournal: Workflow angepasst