]> wagnertech.de Git - mfinanz.git/blob - SL/Helper/UserPreferences/ItemInputPosition.pm
Merge branch 'master' of http://wagnertech.de/git/mfinanz
[mfinanz.git] / SL / Helper / UserPreferences / ItemInputPosition.pm
1 package SL::Helper::UserPreferences::ItemInputPosition;
2
3 use strict;
4 use parent qw(Rose::Object);
5
6 use Carp;
7 use List::MoreUtils qw(none);
8
9 use SL::Helper::UserPreferences;
10
11 use Rose::Object::MakeMethods::Generic (
12   'scalar --get_set_init' => [ qw(user_prefs) ],
13 );
14
15 sub get_order_item_input_position {
16   $_[0]->user_prefs->get('order_item_input_position')
17 }
18
19 sub store_order_item_input_position {
20   my ($self, $value) = @_;
21
22   if ($value eq 'default') {
23     $self->user_prefs->delete('order_item_input_position');
24   } else {
25     $self->user_prefs->store('order_item_input_position', $value);
26   }
27 }
28
29 sub init_user_prefs {
30   SL::Helper::UserPreferences->new(
31     namespace => $_[0]->namespace,
32   )
33 }
34
35 # read only stuff
36 sub namespace     { 'ItemInputPosition' }
37 sub version       { 1 }
38
39 1;
40
41 __END__
42
43 =pod
44
45 =encoding utf-8
46
47 =head1 NAME
48
49 SL::Helper::UserPreferences::ItemInputPosition - preferences intended
50 to store user settings for the behavior of the item input in record masks
51
52 =head1 SYNOPSIS
53
54   use SL::Helper::UserPreferences::ItemInputPosition;
55   my $prefs = SL::Helper::UserPreferences::ItemInputPosition->new();
56
57   $prefs->store_order_item_input_position(1);
58   my $value = $prefs->get_order_item_input_position;
59
60 =head1 DESCRIPTION
61
62 Currently this only applies to the item input in L<SL::Controller::Order> forms.
63
64 Readable values:
65
66 =over 4
67
68 =item * undefined - use client setting
69
70 =item * 0 - render above the positions
71
72 =item * 1 - render below the positions
73
74 =back
75
76 For storage C<default> is used to delete the value since form values can not be undefined.
77
78 =head1 BUGS
79
80 None yet :)
81
82 =head1 AUTHOR
83
84 Sven Schöling E<lt>s.schoeling@googlemail.comE<gt>
85
86 =cut