Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ad20db68

Von Sven Schöling vor 1 Tag hinzugefügt

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

Order: Eingabeleiste jetzt auch in UserPrefs konfigurierbar

Unterschiede anzeigen:

SL/AM.pm
57 57
use SL::Helper::UserPreferences::PartPickerSearch;
58 58
use SL::Helper::UserPreferences::TimeRecording;
59 59
use SL::Helper::UserPreferences::UpdatePositions;
60
use SL::Helper::UserPreferences::ItemInputPosition;
60 61

  
61 62
use strict;
62 63

  
......
569 570
  SL::Helper::UserPreferences::PartPickerSearch->new()->get_all_as_list_default();
570 571
}
571 572

  
573
sub order_item_input_position {
574
  SL::Helper::UserPreferences::ItemInputPosition->new()->get_order_item_input_position();
575
}
576

  
572 577
sub save_preferences {
573 578
  $main::lxdebug->enter_sub();
574 579

  
......
618 623
  if (exists $form->{part_picker_search_all_as_list_default}) {
619 624
    SL::Helper::UserPreferences::PartPickerSearch->new()->store_all_as_list_default($form->{part_picker_search_all_as_list_default})
620 625
  }
626
  if (exists $form->{order_item_input_position}) {
627
    SL::Helper::UserPreferences::ItemInputPosition->new()->store_order_item_input_position($form->{order_item_input_position})
628
  }
621 629

  
622 630
  $main::lxdebug->leave_sub();
623 631

  
SL/Controller/Order.pm
2258 2258
    $self->{template_args}->{transport_cost_reminder_article} = SL::DB::Part->new(id => $::instance_conf->get_transport_cost_reminder_article_number_id)->load;
2259 2259
  }
2260 2260
  $self->{template_args}->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
2261
  $self->{template_args}->{order_item_input_position} = SL::Helper::UserPreferences::ItemInputPosition->new()->get_order_item_input_position
2262
                                                      // $::instance_conf->get_order_item_input_position;
2261 2263

  
2262 2264
  $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
2263 2265

  
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
bin/mozilla/am.pl
667 667
  $form->{longdescription_dialog_size_percentage} = AM->longdescription_dialog_size_percentage();
668 668
  $form->{layout_style}                           = AM->layout_style();
669 669
  $form->{part_picker_search_all_as_list_default} = AM->part_picker_search_all_as_list_default();
670
  $form->{order_item_input_position}              = AM->order_item_input_position();
670 671

  
671 672
  $myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
672 673
  $form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
templates/webpages/am/config.html
277 277
      </td>
278 278
    </tr>
279 279

  
280
     <tr>
281
       <th align="right">[% 'Item input position for quotations and orders' | $T8 %]</th>
282
       <td>
283
        [% 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) %]
284
      </td>
285
    </tr>
286

  
280 287
    </table>
281 288
   </div>
282 289

  
templates/webpages/order/tabs/basic_data.html
293 293
    </tr>
294 294
  </table>
295 295

  
296
  [%- IF INSTANCE_CONF.get_order_item_input_position == 0 -%]
296
  [%- IF order_item_input_position == 0 -%]
297 297
  [%- PROCESS order/tabs/_item_input.html SELF=SELF %]
298 298

  
299 299
  [% L.button_tag('kivi.Order.open_multi_items_dialog()', LxERP.t8('Add multiple items')) %]
......
361 361

  
362 362
    <tr>
363 363
      <td>
364
        [% IF INSTANCE_CONF.get_order_item_input_position == 1 %]
364
        [% IF order_item_input_position == 1 %]
365 365
        [%- PROCESS order/tabs/_item_input.html SELF=SELF %]
366 366

  
367 367
        [% L.button_tag('kivi.Order.open_multi_items_dialog()', LxERP.t8('Add multiple items')) %]

Auch abrufbar als: Unified diff