Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ad20db68

Von Sven Schöling vor 5 Monaten hinzugefügt

  • ID ad20db6844b979b8a189c89aba0be6eff859262f
  • Vorgänger 86f1ea29
  • Nachfolger de08e910

Order: Eingabeleiste jetzt auch in UserPrefs konfigurierbar

Unterschiede anzeigen:

SL/AM.pm
use SL::Helper::UserPreferences::PartPickerSearch;
use SL::Helper::UserPreferences::TimeRecording;
use SL::Helper::UserPreferences::UpdatePositions;
use SL::Helper::UserPreferences::ItemInputPosition;
use strict;
......
SL::Helper::UserPreferences::PartPickerSearch->new()->get_all_as_list_default();
}
sub order_item_input_position {
SL::Helper::UserPreferences::ItemInputPosition->new()->get_order_item_input_position();
}
sub save_preferences {
$main::lxdebug->enter_sub();
......
if (exists $form->{part_picker_search_all_as_list_default}) {
SL::Helper::UserPreferences::PartPickerSearch->new()->store_all_as_list_default($form->{part_picker_search_all_as_list_default})
}
if (exists $form->{order_item_input_position}) {
SL::Helper::UserPreferences::ItemInputPosition->new()->store_order_item_input_position($form->{order_item_input_position})
}
$main::lxdebug->leave_sub();
SL/Controller/Order.pm
$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->{template_args}->{order_item_input_position} = SL::Helper::UserPreferences::ItemInputPosition->new()->get_order_item_input_position
// $::instance_conf->get_order_item_input_position;
$self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
SL/Helper/UserPreferences/ItemInputPosition.pm
package SL::Helper::UserPreferences::ItemInputPosition;
use strict;
use parent qw(Rose::Object);
use Carp;
use List::MoreUtils qw(none);
use SL::Helper::UserPreferences;
use Rose::Object::MakeMethods::Generic (
'scalar --get_set_init' => [ qw(user_prefs) ],
);
sub get_order_item_input_position {
$_[0]->user_prefs->get('order_item_input_position')
}
sub store_order_item_input_position {
my ($self, $value) = @_;
if ($value eq 'default') {
$self->user_prefs->delete('order_item_input_position');
} else {
$self->user_prefs->store('order_item_input_position', $value);
}
}
sub init_user_prefs {
SL::Helper::UserPreferences->new(
namespace => $_[0]->namespace,
)
}
# read only stuff
sub namespace { 'ItemInputPosition' }
sub version { 1 }
1;
__END__
=pod
=encoding utf-8
=head1 NAME
SL::Helper::UserPreferences::ItemInputPosition - preferences intended
to store user settings for the behavior of the item input in record masks
=head1 SYNOPSIS
use SL::Helper::UserPreferences::ItemInputPosition;
my $prefs = SL::Helper::UserPreferences::ItemInputPosition->new();
$prefs->store_order_item_input_position(1);
my $value = $prefs->get_order_item_input_position;
=head1 DESCRIPTION
Currently this only applies to the item input in L<SL::Controller::Order> forms.
Readable values:
=over 4
=item * undefined - use client setting
=item * 0 - render above the positions
=item * 1 - render below the positions
=back
For storage C<default> is used to delete the value since form values can not be undefined.
=head1 BUGS
None yet :)
=head1 AUTHOR
Sven Schöling E<lt>s.schoeling@googlemail.comE<gt>
=cut
bin/mozilla/am.pl
$form->{longdescription_dialog_size_percentage} = AM->longdescription_dialog_size_percentage();
$form->{layout_style} = AM->layout_style();
$form->{part_picker_search_all_as_list_default} = AM->part_picker_search_all_as_list_default();
$form->{order_item_input_position} = AM->order_item_input_position();
$myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
$form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
templates/webpages/am/config.html
</td>
</tr>
<tr>
<th align="right">[% 'Item input position for quotations and orders' | $T8 %]</th>
<td>
[% L.select_tag('order_item_input_position', [ [ 'default', LxERP.t8('Use settings from client configuration') ], [ 0, LxERP.t8('above the positions') ], [ 1, LxERP.t8('below the positions') ] ], default=order_item_input_position) %]
</td>
</tr>
</table>
</div>
templates/webpages/order/tabs/basic_data.html
</tr>
</table>
[%- IF INSTANCE_CONF.get_order_item_input_position == 0 -%]
[%- IF order_item_input_position == 0 -%]
[%- PROCESS order/tabs/_item_input.html SELF=SELF %]
[% L.button_tag('kivi.Order.open_multi_items_dialog()', LxERP.t8('Add multiple items')) %]
......
<tr>
<td>
[% IF INSTANCE_CONF.get_order_item_input_position == 1 %]
[% IF order_item_input_position == 1 %]
[%- PROCESS order/tabs/_item_input.html SELF=SELF %]
[% L.button_tag('kivi.Order.open_multi_items_dialog()', LxERP.t8('Add multiple items')) %]

Auch abrufbar als: Unified diff