From: Martin Helmling martin.helmling@octosoft.eu Date: Tue, 27 Dec 2016 13:17:20 +0000 (+0100) Subject: Dateimanagement: Integration in Masken und Controller X-Git-Tag: release-3.5.4~1595 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1ce68041a1923c60a6608a2ed6365f5915bacd9a;p=kivitendo-erp.git Dateimanagement: Integration in Masken und Controller Einbau in alte Masken (bin/mozilla/* und templates/webpages/??/) sowie in neue Controller für Kunden/Lieferanten/Artikel , in neuen Auftragscontroller --- diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index 5404373f4..112e751d1 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -940,6 +940,7 @@ sub _pre_render { $::request->{layout}->add_javascripts('autocomplete_customer.js'); $::request->{layout}->add_javascripts('kivi.CustomerVendor.js'); + $::request->{layout}->add_javascripts('kivi.File.js'); } sub _prepare_cvar_configs_for_ajaj { diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 5562b1ea8..999fc2173 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -9,6 +9,7 @@ use SL::Locale::String qw(t8); use SL::SessionFile::Random; use SL::PriceSource; use SL::Webdav; +use SL::File; use SL::DB::Order; use SL::DB::Default; @@ -209,7 +210,15 @@ sub action_print { $self->js->flash('error', t8('Storing PDF to webdav folder failed: #1', $@)); } } - + if ($self->order->ordnumber && $::instance_conf->get_doc_storage) { + SL::File->store( object_id => $self->order->id, + object_type => $self->type, + mime_type => 'application/pdf', + source => 'created', + file_type => 'document', + file_name => $pdf_filename, + file_contents => $pdf); + } $self->js->render; } @@ -1087,7 +1096,7 @@ sub _pre_render { } } @all_objects; } - $::request->{layout}->use_javascript("${_}.js") for qw(kivi.SalesPurchase kivi.Order ckeditor/ckeditor ckeditor/adapters/jquery); + $::request->{layout}->use_javascript("${_}.js") for qw(kivi.SalesPurchase kivi.Order kivi.File ckeditor/ckeditor ckeditor/adapters/jquery); } sub _create_pdf { diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index eb1d52b64..12494dde2 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -617,7 +617,7 @@ sub add { sub _set_javascript { my ($self) = @_; - $::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery); + $::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.File kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery); $::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $self->part->id ]})});") if $self->part->id; } diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 23d1b0a5c..9018dd905 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -433,7 +433,7 @@ sub form_header { my $follow_up_vc = $form->{vendor_id} ? SL::DB::Vendor->load_cached($form->{vendor_id})->name : ''; my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; - $::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js", "kivi.RecordTemplate.js"); + $::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js", "kivi.RecordTemplate.js", "kivi.File.js"); my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; my $first_taxchart; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 66e5008f9..1fd81c3d1 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -389,7 +389,7 @@ sub form_header { my $follow_up_vc = $form->{customer_id} ? SL::DB::Customer->load_cached($form->{customer_id})->name : ''; my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; - $::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js", "kivi.RecordTemplate.js"); + $::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js", "kivi.File.js", "kivi.RecordTemplate.js"); my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; my $first_taxchart; diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 69df28eeb..0e8918bdc 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -302,7 +302,7 @@ sub form_header { $form->{follow_up_trans_info} = $form->{donumber} .'('. $form->{VC_OBJ}->name .')'; - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.File kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part)); my @custom_hidden; push @custom_hidden, map { "shiptocvar_" . $_->name } @{ SL::DB::Manager::CustomVariableConfig->get_all(where => [ module => 'ShipTo' ]) }; diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 748191059..ad1c20253 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -296,7 +296,7 @@ sub form_header { $TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice(); $form->{duedate} = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{due_due})->to_kivitendo if $TMPL_VAR{payment_terms_obj}; - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part autocomplete_project client_js)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.File kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part autocomplete_project client_js)); $form->header(); diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 5ac59b27e..f7d296c42 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -354,7 +354,7 @@ sub form_header { ), @custom_hiddens, map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}]; - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part client_js)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.File kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part client_js)); $TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice(); $form->{duedate} = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{duedate})->to_kivitendo if $TMPL_VAR{payment_terms_obj}; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 17d9fb500..85ec57dea 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -435,7 +435,7 @@ sub form_header { } } - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase show_form_details show_history show_vc_details ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase kivi.File show_form_details show_history show_vc_details ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part)); $form->header; if ($form->{CFDD_shipto} && $form->{CFDD_shipto_id} ) { diff --git a/templates/webpages/ap/form_header.html b/templates/webpages/ap/form_header.html index 878b86366..69d2309e8 100644 --- a/templates/webpages/ap/form_header.html +++ b/templates/webpages/ap/form_header.html @@ -59,6 +59,10 @@ [%- IF INSTANCE_CONF.get_webdav %]
  • [% 'WebDAV' | $T8 %]
  • [%- END %] +[%- IF id AND INSTANCE_CONF.get_doc_storage %] +
  • [% 'Documents' | $T8 %]
  • +
  • [% 'Attachments' | $T8 %]
  • +[%- END %] [%- IF id %] [%- IF AUTH.assert('record_links', 1) %]
  • [% 'Linked Records' | $T8 %]
  • diff --git a/templates/webpages/ar/form_header.html b/templates/webpages/ar/form_header.html index 689c3c3e1..8f59a37ea 100644 --- a/templates/webpages/ar/form_header.html +++ b/templates/webpages/ar/form_header.html @@ -26,6 +26,9 @@
    diff --git a/templates/webpages/ir/form_header.html b/templates/webpages/ir/form_header.html index f81b2cca7..6576dfbfe 100644 --- a/templates/webpages/ir/form_header.html +++ b/templates/webpages/ir/form_header.html @@ -32,6 +32,10 @@
  • [% 'WebDAV' | $T8 %]
  • [%- END %] [%- IF id %] + [%- IF INSTANCE_CONF.get_doc_storage %] +
  • [% 'Documents' | $T8 %]
  • +
  • [% 'Attachments' | $T8 %]
  • + [%- END %] [%- IF AUTH.assert('record_links', 1) %]
  • [% 'Linked Records' | $T8 %]
  • [%- END %] diff --git a/templates/webpages/is/form_header.html b/templates/webpages/is/form_header.html index 4fcc5ace6..1f8963991 100644 --- a/templates/webpages/is/form_header.html +++ b/templates/webpages/is/form_header.html @@ -33,6 +33,10 @@
  • [% 'WebDAV' | $T8 %]
  • [%- END %] [%- IF id %] + [%- IF INSTANCE_CONF.get_doc_storage %] +
  • [% 'Documents' | $T8 %]
  • +
  • [% 'Attachments' | $T8 %]
  • + [%- END %] [%- IF AUTH.assert('record_links', 1) %]
  • [% 'Linked Records' | $T8 %]
  • [%- END %] diff --git a/templates/webpages/oe/form_header.html b/templates/webpages/oe/form_header.html index 953cb1502..2f0766873 100644 --- a/templates/webpages/oe/form_header.html +++ b/templates/webpages/oe/form_header.html @@ -35,6 +35,10 @@ [%- IF INSTANCE_CONF.get_webdav %]
  • [% 'WebDAV' | $T8 %]
  • [%- END %] +[%- IF id AND INSTANCE_CONF.get_doc_storage %] +
  • [% 'Documents' | $T8 %]
  • +
  • [% 'Attachments' | $T8 %]
  • +[%- END %] [%- IF id AND AUTH.assert('record_links', 1) %]
  • [% 'Linked Records' | $T8 %]
  • [%- END %] diff --git a/templates/webpages/order/form.html b/templates/webpages/order/form.html index 3d4bddff3..46258ae41 100644 --- a/templates/webpages/order/form.html +++ b/templates/webpages/order/form.html @@ -26,6 +26,10 @@ [%- IF INSTANCE_CONF.get_webdav %]
  • [% 'WebDAV' | $T8 %]
  • [%- END %] +[%- IF SELF.order.id AND INSTANCE_CONF.get_doc_storage %] +
  • [% 'Documents' | $T8 %]
  • +
  • [% 'Attachments' | $T8 %]
  • +[%- END %] [%- IF SELF.order.id %]
  • [% 'Linked Records' | $T8 %]
  • [%- END %] diff --git a/templates/webpages/part/form.html b/templates/webpages/part/form.html index aa3cd68aa..58af99839 100644 --- a/templates/webpages/part/form.html +++ b/templates/webpages/part/form.html @@ -22,6 +22,10 @@ [%- IF SELF.part.is_assembly %]
  • [% 'Assembly items' | $T8 %]
  • [%- END %] +[%- IF INSTANCE_CONF.get_doc_storage %] +
  • [% 'Attachments' | $T8 %]
  • +
  • [% 'Images' | $T8 %]
  • +[%- END %] [% IF SELF.all_languages.size %]
  • [% 'Translations' | $T8 %]
  • [% END %]