$::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 {
use SL::SessionFile::Random;
use SL::PriceSource;
use SL::Webdav;
+use SL::File;
use SL::DB::Order;
use SL::DB::Default;
$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;
}
} } @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 {
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;
}
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;
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;
$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' ]) };
$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();
), @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};
}
}
- $::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} ) {
[%- IF INSTANCE_CONF.get_webdav %]
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
[%- END %]
+[%- IF id AND INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=document&object_type=purchase_invoice&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=purchase_invoice&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+[%- END %]
[%- IF id %]
[%- IF AUTH.assert('record_links', 1) %]
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=PurchaseInvoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
<ul>
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
[%- IF id %]
+ [%- IF INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=invoice&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+ [%- END %]
[% IF AUTH.assert('record_links', 1) %]
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Invoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
[%- END %]
<li><a href="#contacts">[% 'Contacts' | $T8 %]</a></li>
[% IF ( SELF.cv.id && AUTH.assert('sales_all_edit', 1) ) %]
<li><a href="#deliveries">[% 'Supplies' | $T8 %]</a></li>
+[%- IF INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% FORM.db == 'vendor' ? 'vendor' : 'customer' %]&object_id=[% SELF.cv.id %]">[% 'Attachments' | $T8 %]</a></li>
+[%- END %]
[% END %]
<li><a href="#vcnotes">[% 'Notes' | $T8 %]</a></li>
[%- IF INSTANCE_CONF.get_webdav %]
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
[%- END %]
+[%- IF id AND INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=document&object_type=[% HTML.escape(type) %]&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% HTML.escape(type) %]&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+[%- END %]
[%- IF id AND AUTH.assert('record_links', 1) %]
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=DeliveryOrder&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
[%- END %]
<li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
[%- IF INSTANCE_CONF.get_webdav %]
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
+[%- END %]
+[%- IF id %]
+[%- IF INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=document&object_type=gl_transaction&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=gl_transaction&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+[%- END %]
[%- END %]
</ul>
<div id="ui-tabs-basic-data">
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
[%- END %]
[%- IF id %]
+ [%- IF INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=document&object_type=purchase_invoice&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=purchase_invoice&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+ [%- END %]
[%- IF AUTH.assert('record_links', 1) %]
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=PurchaseInvoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
[%- END %]
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
[%- END %]
[%- IF id %]
+ [%- IF INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=document&object_type=invoice&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=invoice&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+ [%- END %]
[%- IF AUTH.assert('record_links', 1) %]
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Invoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
[%- END %]
[%- IF INSTANCE_CONF.get_webdav %]
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
[%- END %]
+[%- IF id AND INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=document&object_type=[% HTML.escape(type) %]&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% HTML.escape(type) %]&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+[%- END %]
[%- IF id AND AUTH.assert('record_links', 1) %]
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Order&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
[%- END %]
[%- IF INSTANCE_CONF.get_webdav %]
<li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
[%- END %]
+[%- IF SELF.order.id AND 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(SELF.order.id) %]">[% 'Documents' | $T8 %]</a></li>
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% HTML.escape(FORM.type) %]&object_id=[% HTML.url(SELF.order.id) %]">[% 'Attachments' | $T8 %]</a></li>
+[%- END %]
[%- IF SELF.order.id %]
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Order&object_id=[% HTML.url(SELF.order.id) %]">[% 'Linked Records' | $T8 %]</a></li>
[%- END %]
[%- IF SELF.part.is_assembly %]
<li><a href="#assembly_tab">[% 'Assembly items' | $T8 %]</a></li>
[%- END %]
+[%- IF INSTANCE_CONF.get_doc_storage %]
+ <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=part&object_id=[% SELF.part.id %]">[% 'Attachments' | $T8 %]</a></li>
+ <li><a href="controller.pl?action=File/list&file_type=image&object_type=part&object_id=[% SELF.part.id %]">[% 'Images' | $T8 %]</a></li>
+[%- END %]
[% IF SELF.all_languages.size %]
<li><a href="#translations_tab">[% 'Translations' | $T8 %]</a></li>
[% END %]