Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2729421a

Von Bernd Bleßmann vor fast 4 Jahren hinzugefügt

  • ID 2729421a189ba463f316a9fe706b95f34c6fbe77
  • Vorgänger 96186c41
  • Nachfolger 5c0d66f1

Brief: erzeugtes Dokument im DMS speichern

Unterschiede anzeigen:

SL/Controller/File.pm
43 43

  
44 44
__PACKAGE__->run_before('check_object_params', only => [ qw(list ajax_delete ajax_importdialog ajax_import ajax_unimport ajax_upload ajax_files_uploaded) ]);
45 45

  
46
# gen:    bitmask: bit 1 (value is 1 or 3)    => file created
47
#                  bit 2 (value is 2 or 3)    => file from other source
48
# gltype: is this used somewhere?
49
# dir:    is this used somewhere?
50
# model:  base name of the rose model
51
# right:  access right used for import
46 52
my %file_types = (
47 53
  'sales_quotation'         => { gen => 1, gltype => '',   dir =>'SalesQuotation',       model => 'Order',          right => 'import_ar'  },
48 54
  'sales_order'             => { gen => 1, gltype => '',   dir =>'SalesOrder',           model => 'Order',          right => 'import_ar'  },
......
61 67
  'csv_customer'            => { gen => 1, gltype => '',   dir =>'Reports',              model => 'Customer',       right => 'xx'         },
62 68
  'csv_vendor'              => { gen => 1, gltype => '',   dir =>'Reports',              model => 'Vendor',         right => 'xx'         },
63 69
  'shop_image'              => { gen => 0, gltype => '',   dir =>'ShopImages',           model => 'Part',           right => 'xx'         },
70
  'letter'                  => { gen => 3, gltype => '',   dir =>'Letter',               model => 'Letter',         right => 'sales_letter_edit | purchase_letter_edit' },
64 71
);
65 72

  
66 73
#--- 4 locale ---#
SL/Controller/Letter.pm
14 14
use SL::DB::Letter;
15 15
use SL::DB::LetterDraft;
16 16
use SL::DB::Printer;
17
use SL::File;
17 18
use SL::Helper::Flash qw(flash flash_later);
18 19
use SL::Helper::CreatePDF;
19 20
use SL::Helper::PrintOptions;
......
235 236
      $webdav_file->store(file => $result{file_name});
236 237
    }
237 238

  
239
    if ($::instance_conf->get_doc_storage) {
240
      my %save_params = (object_id    => $letter->id,
241
                         object_type  => 'letter',
242
                         mime_type    => 'application/pdf',
243
                         source       => 'created',
244
                         file_type    => 'document',
245
                         file_name    => $attachment_name,
246
                         file_path    => $result{file_name});
247
      SL::File->save(%save_params);
248
    }
249

  
238 250
    # set some form defaults for printing webdav copy variables
239 251
    if ( $::form->{media} eq 'email') {
240 252
      my $mail             = Mailer->new;
......
313 325
sub _display {
314 326
  my ($self, %params) = @_;
315 327

  
316
  $::request->{layout}->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.Letter kivi.SalesPurchase);
328
  $::request->{layout}->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.Letter kivi.SalesPurchase kivi.File);
317 329

  
318 330
  my $letter = $self->letter;
319 331

  
sql/Pg-upgrade2/file_storage_type_letter.sql
1
-- @tag: file_storage_type_letter
2
-- @description: Letter als valid_type für Filemanagement
3
-- @depends: shopimages
4

  
5
ALTER TABLE files
6
  DROP CONSTRAINT valid_type;
7
ALTER TABLE files
8
  ADD  CONSTRAINT valid_type CHECK (
9
             (object_type = 'credit_note'     ) OR (object_type = 'invoice'                 ) OR (object_type = 'sales_order'       )
10
          OR (object_type = 'sales_quotation' ) OR (object_type = 'sales_delivery_order'    ) OR (object_type = 'request_quotation' )
11
          OR (object_type = 'purchase_order'  ) OR (object_type = 'purchase_delivery_order' ) OR (object_type = 'purchase_invoice'  )
12
          OR (object_type = 'vendor'          ) OR (object_type = 'customer'                ) OR (object_type = 'part'              )
13
          OR (object_type = 'gl_transaction'  ) OR (object_type = 'dunning'                 ) OR (object_type = 'dunning1'          )
14
          OR (object_type = 'dunning2'        ) OR (object_type = 'dunning3'                ) OR (object_type = 'draft'             )
15
          OR (object_type = 'statement'       ) OR (object_type = 'shop_image'              ) OR (object_type = 'letter'            )
16
  );
templates/webpages/letter/edit.html
9 9
<form action='controller.pl' method='POST' id='form'>
10 10
  <input type="hidden" name="letter.id" value="[% letter.id | html %]">
11 11
  <input type="hidden" name="draft.id" value="[% draft.id | html %]">
12
  <input type="hidden" name="type" value="[% type | html %]">
12
  <input type="hidden" name="type" value="[% FORM.type | html %]">
13 13
  [% L.hidden_tag('is_sales', SELF.is_sales) %]
14 14

  
15 15
  [%- INCLUDE 'common/flash.html' %]
......
20 20
[%- IF letter.id %]
21 21
 [%- IF INSTANCE_CONF.get_webdav %]
22 22
     <li><a href="#ui-tabs-webdav">[% LxERP.t8('WebDAV') %]</a></li>
23
 [%- END %]
24
 [%- IF INSTANCE_CONF.get_doc_storage %]
25
      <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>
23 26
 [%- END %]
24 27
    <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Letter&object_id=[% HTML.url(letter.id) %]">[% LxERP.t8("Linked Records") %]</a></li>
25 28
[%- END %]

Auch abrufbar als: Unified diff