__PACKAGE__->run_before('check_object_params', only => [ qw(list ajax_delete ajax_importdialog ajax_import ajax_unimport ajax_upload ajax_files_uploaded) ]);
+# gen: bitmask: bit 1 (value is 1 or 3) => file created
+# bit 2 (value is 2 or 3) => file from other source
+# gltype: is this used somewhere?
+# dir: is this used somewhere?
+# model: base name of the rose model
+# right: access right used for import
my %file_types = (
'sales_quotation' => { gen => 1, gltype => '', dir =>'SalesQuotation', model => 'Order', right => 'import_ar' },
'sales_order' => { gen => 1, gltype => '', dir =>'SalesOrder', model => 'Order', right => 'import_ar' },
'csv_customer' => { gen => 1, gltype => '', dir =>'Reports', model => 'Customer', right => 'xx' },
'csv_vendor' => { gen => 1, gltype => '', dir =>'Reports', model => 'Vendor', right => 'xx' },
'shop_image' => { gen => 0, gltype => '', dir =>'ShopImages', model => 'Part', right => 'xx' },
+ 'letter' => { gen => 3, gltype => '', dir =>'Letter', model => 'Letter', right => 'sales_letter_edit | purchase_letter_edit' },
);
#--- 4 locale ---#
use SL::DB::Letter;
use SL::DB::LetterDraft;
use SL::DB::Printer;
+use SL::File;
use SL::Helper::Flash qw(flash flash_later);
use SL::Helper::CreatePDF;
use SL::Helper::PrintOptions;
$webdav_file->store(file => $result{file_name});
}
+ if ($::instance_conf->get_doc_storage) {
+ my %save_params = (object_id => $letter->id,
+ object_type => 'letter',
+ mime_type => 'application/pdf',
+ source => 'created',
+ file_type => 'document',
+ file_name => $attachment_name,
+ file_path => $result{file_name});
+ SL::File->save(%save_params);
+ }
+
# set some form defaults for printing webdav copy variables
if ( $::form->{media} eq 'email') {
my $mail = Mailer->new;
sub _display {
my ($self, %params) = @_;
- $::request->{layout}->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.Letter kivi.SalesPurchase);
+ $::request->{layout}->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.Letter kivi.SalesPurchase kivi.File);
my $letter = $self->letter;
--- /dev/null
+-- @tag: file_storage_type_letter
+-- @description: Letter als valid_type für Filemanagement
+-- @depends: shopimages
+
+ALTER TABLE files
+ DROP CONSTRAINT valid_type;
+ALTER TABLE files
+ ADD CONSTRAINT valid_type CHECK (
+ (object_type = 'credit_note' ) OR (object_type = 'invoice' ) OR (object_type = 'sales_order' )
+ OR (object_type = 'sales_quotation' ) OR (object_type = 'sales_delivery_order' ) OR (object_type = 'request_quotation' )
+ OR (object_type = 'purchase_order' ) OR (object_type = 'purchase_delivery_order' ) OR (object_type = 'purchase_invoice' )
+ OR (object_type = 'vendor' ) OR (object_type = 'customer' ) OR (object_type = 'part' )
+ OR (object_type = 'gl_transaction' ) OR (object_type = 'dunning' ) OR (object_type = 'dunning1' )
+ OR (object_type = 'dunning2' ) OR (object_type = 'dunning3' ) OR (object_type = 'draft' )
+ OR (object_type = 'statement' ) OR (object_type = 'shop_image' ) OR (object_type = 'letter' )
+ );
<form action='controller.pl' method='POST' id='form'>
<input type="hidden" name="letter.id" value="[% letter.id | html %]">
<input type="hidden" name="draft.id" value="[% draft.id | html %]">
- <input type="hidden" name="type" value="[% type | html %]">
+ <input type="hidden" name="type" value="[% FORM.type | html %]">
[% L.hidden_tag('is_sales', SELF.is_sales) %]
[%- INCLUDE 'common/flash.html' %]
[%- IF letter.id %]
[%- IF INSTANCE_CONF.get_webdav %]
<li><a href="#ui-tabs-webdav">[% LxERP.t8('WebDAV') %]</a></li>
+ [%- END %]
+ [%- IF INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=document&object_type=[% HTML.escape(FORM.type) %]&object_id=[% HTML.url(letter.id) %]">[% 'Documents' | $T8 %]</a></li>
[%- END %]
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Letter&object_id=[% HTML.url(letter.id) %]">[% LxERP.t8("Linked Records") %]</a></li>
[%- END %]