use SL::DB::Vendor;
use SL::DB;
use SL::GenericTranslations;
+use SL::Helper::UserPreferences::DisplayPreferences;
use SL::Helper::UserPreferences::PositionsScrollbar;
use SL::Helper::UserPreferences::PartPickerSearch;
use SL::Helper::UserPreferences::TimeRecording;
SL::Helper::UserPreferences::TimeRecording->new()->get_use_duration();
}
+sub longdescription_dialog_size_percentage {
+ SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
+}
+
sub save_preferences {
$main::lxdebug->enter_sub();
if (exists $form->{time_recording_use_duration}) {
SL::Helper::UserPreferences::TimeRecording->new()->store_use_duration($form->{time_recording_use_duration})
}
+ if (exists $form->{longdescription_dialog_size_percentage}) {
+ SL::Helper::UserPreferences::DisplayPreferences->new()->store_longdescription_dialog_size_percentage($form->{longdescription_dialog_size_percentage})
+ }
$main::lxdebug->leave_sub();
use SL::Helper::CreatePDF qw(:all);
use SL::Helper::PrintOptions;
use SL::Helper::ShippedQty;
+use SL::Helper::UserPreferences::DisplayPreferences;
use SL::Helper::UserPreferences::PositionsScrollbar;
use SL::Helper::UserPreferences::UpdatePositions;
} } @all_objects;
}
- $self->{template_args}{in_out} = $self->type_data->transfer;
+ $self->{template_args}{in_out} = $self->type_data->transfer;
+ $self->{template_args}{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
$self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
use SL::Helper::CreatePDF qw(:all);
use SL::Helper::PrintOptions;
use SL::Helper::ShippedQty;
+use SL::Helper::UserPreferences::DisplayPreferences;
use SL::Helper::UserPreferences::PositionsScrollbar;
use SL::Helper::UserPreferences::UpdatePositions;
&& $::instance_conf->get_transport_cost_reminder_article_number_id ) {
$self->{template_args}->{transport_cost_reminder_article} = SL::DB::Part->new(id => $::instance_conf->get_transport_cost_reminder_article_number_id)->load;
}
+ $self->{template_args}->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
$self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
--- /dev/null
+package SL::Helper::UserPreferences::DisplayPreferences;
+
+use strict;
+use parent qw(Rose::Object);
+
+use SL::Helper::UserPreferences;
+
+use Rose::Object::MakeMethods::Generic (
+ 'scalar --get_set_init' => [ qw(user_prefs) ],
+);
+
+sub get_longdescription_dialog_size_percentage {
+ $_[0]->user_prefs->get('longdescription_dialog_size_percentage');
+}
+
+sub store_longdescription_dialog_size_percentage {
+ $_[0]->user_prefs->store('longdescription_dialog_size_percentage', $_[1]);
+}
+
+sub init_user_prefs {
+ SL::Helper::UserPreferences->new(
+ namespace => $_[0]->namespace,
+ )
+}
+
+# read only stuff
+sub namespace { 'DisplayPreferences' }
+sub version { 1 }
+
+1;
+
+__END__
+
+=pod
+
+=encoding utf-8
+
+=head1 NAME
+
+SL::Helper::UserPreferences::DisplayPreferences - preferences intended
+to store user settings for various display settings.
+
+=head1 SYNOPSIS
+
+ use SL::Helper::UserPreferences::DisplayPreferences;
+ my $prefs = SL::Helper::UserPreferences::DisplayPreferences->new();
+
+ $prefs->store_use_duration(1);
+ my $value = $prefs->get_longdescription_dialog_size_percentage;
+
+=head1 DESCRIPTION
+
+This module manages storing the user's choise for settings for
+various display settings.
+For now the preferred procentual size of the edit-dialog for longdescriptions
+of positions can be stored.
+
+=head1 BUGS
+
+None yet :)
+
+=head1 AUTHOR
+
+Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
+
+=cut
$form->{enabled_quick_searchmodules} = \@{$enabled_quick_search};
$form->{default_quick_searchmodules} = \@quick_search_modules;
- $form->{displayable_name_specs_by_module} = AM->displayable_name_specs_by_module();
- $form->{positions_scrollbar_height} = AM->positions_scrollbar_height();
- $form->{purchase_search_makemodel} = AM->purchase_search_makemodel();
- $form->{sales_search_customer_partnumber} = AM->sales_search_customer_partnumber();
- $form->{positions_show_update_button} = AM->positions_show_update_button();
- $form->{time_recording_use_duration} = AM->time_recording_use_duration();
+ $form->{displayable_name_specs_by_module} = AM->displayable_name_specs_by_module();
+ $form->{positions_scrollbar_height} = AM->positions_scrollbar_height();
+ $form->{purchase_search_makemodel} = AM->purchase_search_makemodel();
+ $form->{sales_search_customer_partnumber} = AM->sales_search_customer_partnumber();
+ $form->{positions_show_update_button} = AM->positions_show_update_button();
+ $form->{time_recording_use_duration} = AM->time_recording_use_duration();
+ $form->{longdescription_dialog_size_percentage} = AM->longdescription_dialog_size_percentage();
$myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
$form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
use SL::Controller::DeliveryOrder;
use SL::DB::DeliveryOrder;
use SL::DB::DeliveryOrder::TypeData qw(:types validate_type);
+use SL::Helper::UserPreferences::DisplayPreferences;
use SL::DO;
use SL::IR;
use SL::IS;
$form->{follow_up_trans_info} = $form->{donumber} .'('. $form->{VC_OBJ}->name .')' if $form->{VC_OBJ};
+ $form->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
$::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.File kivi.MassDeliveryOrderPrint kivi.SalesPurchase kivi.Part kivi.CustomerVendor kivi.Validator ckeditor/ckeditor ckeditor/adapters/jquery kivi.io));
use SL::FU;
use SL::Helper::Flash qw(flash_later);
+use SL::Helper::UserPreferences::DisplayPreferences;
use SL::IR;
use SL::IS;
use SL::DB::BankTransactionAccTrans;
$form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
- $TMPL_VAR{is_format_html} = $form->{format} eq 'html';
- $TMPL_VAR{dateformat} = $myconfig{dateformat};
- $TMPL_VAR{numberformat} = $myconfig{numberformat};
+ $TMPL_VAR{is_format_html} = $form->{format} eq 'html';
+ $TMPL_VAR{dateformat} = $myconfig{dateformat};
+ $TMPL_VAR{numberformat} = $myconfig{numberformat};
+ $TMPL_VAR{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
# hiddens
$TMPL_VAR{HIDDENS} = [qw(
use SL::FU;
use SL::IS;
use SL::OE;
+use SL::Helper::UserPreferences::DisplayPreferences;
use SL::MoreCommon qw(restore_form save_form);
use SL::RecordLinks;
$form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
- $TMPL_VAR{is_type_normal_invoice} = $form->{type} eq "invoice";
- $TMPL_VAR{is_type_credit_note} = $form->{type} eq "credit_note";
- $TMPL_VAR{is_format_html} = $form->{format} eq 'html';
- $TMPL_VAR{dateformat} = $myconfig{dateformat};
- $TMPL_VAR{numberformat} = $myconfig{numberformat};
+ $TMPL_VAR{is_type_normal_invoice} = $form->{type} eq "invoice";
+ $TMPL_VAR{is_type_credit_note} = $form->{type} eq "credit_note";
+ $TMPL_VAR{is_format_html} = $form->{format} eq 'html';
+ $TMPL_VAR{dateformat} = $myconfig{dateformat};
+ $TMPL_VAR{numberformat} = $myconfig{numberformat};
+ $TMPL_VAR{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
# hiddens
$TMPL_VAR{HIDDENS} = [qw(
use SL::OE;
use SL::IR;
use SL::IS;
+use SL::Helper::UserPreferences::DisplayPreferences;
use SL::MoreCommon qw(ary_diff restore_form save_form);
use SL::ReportGenerator;
use SL::YAML;
use Data::Dumper;
use SL::Controller::Order;
-
use SL::DB::Customer;
use SL::DB::TaxZone;
use SL::DB::PaymentTerm;
}
$::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});");
- $TMPL_VAR->{dateformat} = $myconfig{dateformat};
- $TMPL_VAR->{numberformat} = $myconfig{numberformat};
+ $TMPL_VAR->{dateformat} = $myconfig{dateformat};
+ $TMPL_VAR->{numberformat} = $myconfig{numberformat};
+ $TMPL_VAR->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
if ($form->{type} eq 'sales_order') {
if (!$form->{periodic_invoices_config}) {
namespace('kivi.SalesPurchase', function(ns) {
+ this.longdescription_dialog_size_percentage = 0;
+
this.edit_longdescription = function(row) {
var $element = $('#longdescription_' + row);
};
this.edit_longdescription_with_params = function(params) {
+ var dialog_width = 800;
+ var dialog_height = 500;
+ var textarea_width = 750;
+ var textarea_height = 220;
+ if (this.longdescription_dialog_size_percentage != 0) {
+ dialog_width = Math.ceil(window.innerWidth * this.longdescription_dialog_size_percentage/100);
+ dialog_height = Math.ceil(window.innerHeight * this.longdescription_dialog_size_percentage/100);
+ textarea_width = Math.ceil(dialog_width * 95/100);
+ textarea_height = dialog_height - 220;
+ if (textarea_height <= 0) textarea_height = 220;
+ }
+
var $container = $('#popup_edit_longdescription_input_container');
- var $edit = $('<textarea id="popup_edit_longdescription_input" class="texteditor-in-dialog texteditor-space-for-toolbar" wrap="soft" style="width: 750px; height: 220px;"></textarea>');
+ var $edit = $('<textarea id="popup_edit_longdescription_input" class="texteditor-in-dialog texteditor-space-for-toolbar" wrap="soft" style="width: ' + textarea_width + 'px; height: ' + textarea_height + 'px;"></textarea>');
$container.children().remove();
$container.append($edit);
id: 'edit_longdescription_dialog',
dialog: {
title: kivi.t8('Enter longdescription'),
+ width: dialog_width,
+ height: dialog_height,
open: function() { kivi.focus_ckeditor_when_ready('#popup_edit_longdescription_input'); },
close: function() { $('#popup_edit_longdescription_input_container').children().remove(); }
}
'Long Description (quotations & orders)' => 'Langtext (Angebote & Aufträge)',
'Long Description for invoices' => 'Langtext für Rechnungen',
'Long Description for quotations & orders' => 'Langtext für Angebote & Aufträge',
+ 'Longdescription dialog size percentage from main window (0 means fix values)' => 'Prozentuale Größe des Langtext-Dialogs im Verhältnis zum Hauptfenster (0 bedeutet feste Größe)',
'Loss' => 'Verlust',
'Loss carried forward account' => 'Verlustvortragskonto',
'Luxembourg' => 'Luxemburg',
'Long Description (quotations & orders)' => '',
'Long Description for invoices' => '',
'Long Description for quotations & orders' => '',
+ 'Longdescription dialog size percentage from main window (0 means fix values)' => '',
'Loss' => '',
'Loss carried forward account' => '',
'Luxembourg' => '',
</td>
</tr>
+ <tr>
+ <th align="right">[% 'Longdescription dialog size percentage from main window (0 means fix values)' | $T8 %]</th>
+ <td>
+ [% L.input_tag('longdescription_dialog_size_percentage', longdescription_dialog_size_percentage, size = 5) %]
+ </td>
+ </tr>
[%- IF INSTANCE_CONF.get_feature_experimental_order -%]
<tr>
<th align="right">[% 'Scrollbar height percentage for form postion area (0 means no scrollbar)' | $T8 %]</th>
<a onclick="$('#edit_longdescription_dialog').dialog('close');" href="#">[% LxERP.t8("Abort") %]</a>
</p>
</div>
+
+<script>
+ $(function() {
+ kivi.SalesPurchase.longdescription_dialog_size_percentage = "[% longdescription_dialog_size_percentage %]";
+ });
+</script>