Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 368f144b

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 368f144b970a4b307a50d82bb398e704d65eec43
  • Vorgänger 91b948e4
  • Nachfolger 6af007ae

Mandantenkonfiguration vereinfacht & in mehrere Dateien gespalten und in Tab-Dialog eingebettet

Unterschiede anzeigen:

SL/Controller/ClientConfig.pm
5 5

  
6 6
use SL::DB::Default;
7 7
use SL::Helper::Flash;
8
use SL::Locale::String qw(t8);
8 9

  
9 10
__PACKAGE__->run_before('check_auth');
10 11

  
12
use Rose::Object::MakeMethods::Generic (
13
  'scalar --get_set_init' => [ qw(defaults all_warehouses posting_options payment_options accounting_options inventory_options profit_options) ],
14
);
11 15

  
12 16
sub action_edit {
13 17
  my ($self, %params) = @_;
14

  
15
  $self->{posting_options} = [ { title => $::locale->text("never"), value => 0 },
16
                               { title => $::locale->text("every time"), value => 1 },
17
                               { title => $::locale->text("on the same day"), value => 2 }, ];
18
  $self->{payment_options} = [ { title => $::locale->text("never"), value => 0 },
19
                               { title => $::locale->text("every time"), value => 1 },
20
                               { title => $::locale->text("on the same day"), value => 2 }, ];
21
  $self->{accounting_options} = [ { title => $::locale->text("Accrual"), value => "accrual" },
22
                                  { title => $::locale->text("cash"), value => "cash" }, ];
23
  $self->{inventory_options} = [ { title => $::locale->text("perpetual"), value => "perpetual" },
24
                                 { title => $::locale->text("periodic"), value => "periodic" }, ];
25
  $self->{profit_options} = [ { title => $::locale->text("balance"), value => "balance" },
26
                              { title => $::locale->text("income"), value => "income" }, ];
27

  
28
  map { $self->{$_} = SL::DB::Default->get->$_ } qw(is_changeable ir_changeable ar_changeable ap_changeable gl_changeable);
29

  
30
  $self->{payments_changeable} = SL::DB::Default->get->payments_changeable;
31

  
32
  map { $self->{$_} = SL::DB::Default->get->$_ } qw(is_show_mark_as_paid ir_show_mark_as_paid ar_show_mark_as_paid ap_show_mark_as_paid);
33

  
34
  map { $self->{$_} = SL::DB::Default->get->$_ } qw(accounting_method inventory_system profit_determination);
35

  
36
  $self->{show_bestbefore}     = SL::DB::Default->get->show_bestbefore;
37

  
38
  map { $self->{$_} = SL::DB::Default->get->$_ } qw(datev_check_on_sales_invoice datev_check_on_purchase_invoice datev_check_on_ar_transaction datev_check_on_ap_transaction datev_check_on_gl_transaction);
39
  # datev check: not implemented yet:
40
  #check_on_cash_and_receipt = 0
41
  #check_on_dunning = 0
42
  #check_on_sepa_import = 0
43

  
44
  map { $self->{$_} = SL::DB::Default->get->$_ } qw(sales_order_show_delete purchase_order_show_delete sales_delivery_order_show_delete purchase_delivery_order_show_delete);
45

  
46
  # All warehouse / transfer default values
47
  map { $self->{$_} = SL::DB::Default->get->$_ } qw(transfer_default transfer_default_use_master_default_bin transfer_default_ignore_onhand
48
                                                    warehouse_id_ignore_onhand bin_id_ignore_onhand warehouse_id bin_id);
49

  
50
  # for the default warehouse and bin we get the list and
51
  # set a empty value with warehouse_id and bin_id = 0
52
  map { $self->{$_} = SL::DB::Default->get->$_ } qw(warehouse_id bin_id);
53
  $::form->get_lists('warehouses' => { 'key'    => 'WAREHOUSES',
54
                                       'bins'   => 'BINS', });
55
  $self->{WAREHOUSES} = $::form->{WAREHOUSES};
56
  # leerer lagerplatz mit id 0
57
  my $no_default_bin_entry = { 'id' => '0', description => '--', 'BINS' => [ { id => '0', description => ''} ] };
58
  push @ { $self->{WAREHOUSES} }, $no_default_bin_entry;
59

  
60
  # set defaults to empty
61
  if (my $max = scalar @{ $self->{WAREHOUSES} }) {
62
    $self->{warehouse_id} ||= $self->{WAREHOUSES}->[$max -1]->{id};
63
    $self->{bin_id}       ||= $self->{WAREHOUSES}->[$max -1]->{BINS}->[0]->{id};
64
    $self->{warehouse_id_ignore_onhand} ||= $self->{WAREHOUSES}->[$max -1]->{id};
65
    $self->{bin_id_ignore_onhand}       ||= $self->{WAREHOUSES}->[$max -1]->{BINS}->[0]->{id};
66
  }
67

  
68
  $self->{show_weight} = SL::DB::Default->get->show_weight;
69

  
70
  $self->render('client_config/form', title => $::locale->text('Client Configuration'));
18
  $self->edit_form;
71 19
}
72 20

  
73

  
74 21
sub action_save {
75 22
  my ($self, %params) = @_;
76 23

  
77
  map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(is_changeable ir_changeable ar_changeable ap_changeable gl_changeable);
24
  my $defaults = delete($::form->{defaults}) || {};
78 25

  
79
  SL::DB::Default->get->update_attributes('payments_changeable' => $::form->{payments_changeable});
26
  # undef several fields if an empty value has been selected.
27
  foreach (qw(warehouse_id bin_id warehouse_id_ignore_onhand bin_id_ignore_onhand)) {
28
    undef $defaults->{$_} if !$defaults->{$_};
29
  }
80 30

  
81
  map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(is_show_mark_as_paid ir_show_mark_as_paid ar_show_mark_as_paid ap_show_mark_as_paid);
31
  $self->defaults->update_attributes(%{ $defaults });
82 32

  
83
  map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(accounting_method inventory_system profit_determination);
33
  flash_later('info', t8('Client Configuration saved!'));
84 34

  
85
  SL::DB::Default->get->update_attributes('show_bestbefore'     => $::form->{show_bestbefore});
35
  $self->redirect_to(action => 'edit');
36
}
86 37

  
87
  map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(datev_check_on_sales_invoice datev_check_on_purchase_invoice datev_check_on_ar_transaction datev_check_on_ap_transaction datev_check_on_gl_transaction);
38
#
39
# initializers
40
#
88 41

  
89
  map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(sales_order_show_delete purchase_order_show_delete sales_delivery_order_show_delete purchase_delivery_order_show_delete);
42
sub init_defaults       { SL::DB::Default->get }
43
sub init_all_warehouses { SL::DB::Manager::Warehouse->get_all_sorted }
90 44

  
91
  # undef warehouse_id if the empty value is selected
92
  if ( ($::form->{warehouse_id} == 0) && ($::form->{bin_id} == 0) ) {
93
    undef $::form->{warehouse_id};
94
    undef $::form->{bin_id};
95
  }
96
  # undef warehouse_id_ignore_onhand if the empty value is selected
97
  if ( ($::form->{warehouse_id_ignore_onhand} == 0) && ($::form->{bin_id_ignore_onhand} == 0) ) {
98
    undef $::form->{warehouse_id_ignore_onhand};
99
    undef $::form->{bin_id_ignore_onhand};
100
  }
101

  
102
  # All warehouse / transfer default values
103
  map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(transfer_default transfer_default_use_master_default_bin transfer_default_ignore_onhand
104
                                                                            warehouse_id_ignore_onhand bin_id_ignore_onhand warehouse_id bin_id);
45
sub init_posting_options {
46
  [ { title => t8("never"),           value => 0           },
47
    { title => t8("every time"),      value => 1           },
48
    { title => t8("on the same day"), value => 2           }, ]
49
}
105 50

  
106
  SL::DB::Default->get->update_attributes('show_weight'     => $::form->{show_weight});
51
sub init_payment_options {
52
  [ { title => t8("never"),           value => 0           },
53
    { title => t8("every time"),      value => 1           },
54
    { title => t8("on the same day"), value => 2           }, ]
55
}
107 56

  
108
  flash_later('info', $::locale->text('Client Configuration saved!'));
57
sub init_accounting_options {
58
  [ { title => t8("Accrual"),         value => "accrual"   },
59
    { title => t8("cash"),            value => "cash"      }, ]
60
}
109 61

  
110
  $self->redirect_to(action => 'edit');
62
sub init_inventory_options {
63
  [ { title => t8("perpetual"),       value => "perpetual" },
64
    { title => t8("periodic"),        value => "periodic"  }, ]
111 65
}
112 66

  
67
sub init_profit_options {
68
  [ { title => t8("balance"),         value => "balance"   },
69
    { title => t8("income"),          value => "income"    }, ]
70
}
113 71

  
114
#################### private stuff ##########################
72
#
73
# filters
74
#
115 75

  
116 76
sub check_auth {
117 77
  $::auth->assert('admin');
118 78
}
119 79

  
80
#
81
# helpers
82
#
83

  
84
sub edit_form {
85
  my ($self) = @_;
86
  $self->render('client_config/form', title => t8('Client Configuration'));
87
}
88

  
120 89
1;
templates/webpages/client_config/_datev_check_configuration.html
1
[%- USE LxERP -%][%- USE L -%]
2
<div id="datev_check_configuration">
3
 <div class='listheading'>[% LxERP.t8('DATEV check configuration') %]</div>
4

  
5
 <table>
6
  <tr>
7
   <td colspan="3">[% LxERP.t8('It is possible to make a quick DATEV export everytime you post a record to ensure things work nicely with their data requirements. This will result in a slight overhead though you can enable this for each type of record independantly.') %]</td>
8
  </tr>
9
  <tr>
10
   <td align="right">[% LxERP.t8('Check on sales invoice') %]</td>
11
   <td>[% L.yes_no_tag('defaults.datev_check_on_sales_invoice', SELF.defaults.datev_check_on_sales_invoice) %]</td>
12
   <td>[% LxERP.t8('Perform check when a sales invoice or a payment for a sales invoice is posted?') %]</td>
13
  </tr>
14
  <tr>
15
   <td align="right">[% LxERP.t8('Check on purchase invoice') %]</td>
16
   <td>[% L.yes_no_tag('defaults.datev_check_on_purchase_invoice', SELF.defaults.datev_check_on_purchase_invoice) %]</td>
17
   <td>[% LxERP.t8('Perform check when a purchase invoice or a payment for a purchase invoice is posted?') %]</td>
18
  </tr>
19
  <tr>
20
   <td align="right">[% LxERP.t8('Check on ar transaction') %]</td>
21
   <td>[% L.yes_no_tag('defaults.datev_check_on_ar_transaction', SELF.defaults.datev_check_on_ar_transaction) %]</td>
22
   <td>[% LxERP.t8('Perform check when an ar transaction is posted?') %]</td>
23
  </tr>
24
  <tr>
25
   <td align="right">[% LxERP.t8('Check on ap transaction') %]</td>
26
   <td>[% L.yes_no_tag('defaults.datev_check_on_ap_transaction', SELF.defaults.datev_check_on_ap_transaction) %]</td>
27
   <td>[% LxERP.t8('Perform check when an ap transaction is posted?') %]</td>
28
  </tr>
29
  <tr>
30
   <td align="right">[% LxERP.t8('Check on gl transaction') %]</td>
31
   <td>[% L.yes_no_tag('defaults.datev_check_on_gl_transaction', SELF.defaults.datev_check_on_gl_transaction) %]</td>
32
   <td>[% LxERP.t8('Perform check when a gl transaction is posted?') %]</td>
33
  </tr>
34
 </table>
35
</div>
templates/webpages/client_config/_miscellaneous.html
1
[%- USE LxERP -%][%- USE L -%]
2
<div id="miscellaneous">
3
 <div class='listheading'>[% LxERP.t8('Weight') %]</div>
4

  
5
 <table>
6
  <tr>
7
   <td align="right">[% LxERP.t8('Show weights') %]</td>
8
   <td>
9
    [% L.yes_no_tag('defaults.show_weight', SELF.defaults.show_weight) %]
10
   </td>
11
   <td>
12
    [% LxERP.t8('Show the weights of articles and the total weight in orders, invoices and delivery notes?') %]<br>
13
   </td>
14
  </tr>
15
 </table>
16
</div>
17
</div>
templates/webpages/client_config/_orders_deleteable.html
1
[%- USE LxERP -%][%- USE L -%]
2
<div id="orders_deleteable">
3
 <div class='listheading'>[% LxERP.t8('Orders / Delivery Orders deleteable') %]</div>
4

  
5
 <table>
6
  <tr>
7
   <td align="right">[% LxERP.t8('Sales Orders deleteable') %]</td>
8
   <td>[% L.yes_no_tag('defaults.sales_order_show_delete', SELF.defaults.sales_order_show_delete) %]</td>
9
   <td>[% LxERP.t8('Show delete button in sales orders?') %]</td>
10
  </tr>
11
  <tr>
12
   <td align="right">[% LxERP.t8('Purchase Orders deleteable') %]</td>
13
   <td>[% L.yes_no_tag('defaults.purchase_order_show_delete', SELF.defaults.purchase_order_show_delete) %]</td>
14
   <td>[% LxERP.t8('Show delete button in purchase orders?') %]</td>
15
  </tr>
16
  <tr>
17
   <td align="right">[% LxERP.t8('Sales Delivery Orders deleteable') %]</td>
18
   <td>[% L.yes_no_tag('defaults.sales_delivery_order_show_delete', SELF.defaults.sales_delivery_order_show_delete) %]</td>
19
   <td>[% LxERP.t8('Show delete button in sales delivery orders?') %]</td>
20
  </tr>
21
  <tr>
22
   <td align="right">[% LxERP.t8('Purchase Delivery Orders deleteable') %]</td>
23
   <td>[% L.yes_no_tag('defaults.purchase_delivery_order_show_delete', SELF.defaults.purchase_delivery_order_show_delete) %]</td>
24
   <td>[% LxERP.t8('Show delete button in purchase delivery orders?') %]</td>
25
  </tr>
26
 </table>
27
</div>
templates/webpages/client_config/_posting_configuration.html
1
[%- USE L -%][%- USE LxERP -%]
2
<div id="posting_configuration">
3
 <div class="listheading">[% LxERP.t8('Posting Configuration') %]</div>
4

  
5
 <table>
6
  <tr>
7
   <td align="right">[% LxERP.t8('Sales invoices changeable') %]</td>
8
   <td>[% L.select_tag('defaults.is_changeable', SELF.posting_options, value_key = 'value', title_key = 'title', default = SELF.defaults.is_changeable) %]</td>
9
   <td>[% LxERP.t8('Should sales invoices be and when should they be changeable or deleteable after posting?') %]</td>
10
  </tr>
11
  <tr>
12
   <td align="right">[% LxERP.t8('Purchase invoices changeable') %]</td>
13
   <td>[% L.select_tag('defaults.ir_changeable', SELF.posting_options, value_key = 'value', title_key = 'title', default = SELF.defaults.ir_changeable) %]</td>
14
   <td>[% LxERP.t8('Should purchase invoices be and when should they be deleteable after posting?') %]</td>
15
  </tr>
16
  <tr>
17
   <td align="right">[% LxERP.t8('AR transactions changeable') %]</td>
18
   <td>[% L.select_tag('defaults.ar_changeable', SELF.posting_options, value_key = 'value', title_key = 'title', default = SELF.defaults.ar_changeable) %]</td>
19
   <td>[% LxERP.t8('Should ar transactions be and when should they be changeable or deleteable after posting?') %]</td>
20
  </tr>
21
  <tr>
22
   <td align="right">[% LxERP.t8('AP transactions changeable') %]</td>
23
   <td>[% L.select_tag('defaults.ap_changeable', SELF.posting_options, value_key = 'value', title_key = 'title', default = SELF.defaults.ap_changeable) %]</td>
24
   <td>[% LxERP.t8('Should ap transactions be and when should they be changeable or deleteable after posting?') %]</td>
25
  </tr>
26
  <tr>
27
   <td align="right">[% LxERP.t8('GL transactions changeable') %]</td>
28
   <td>[% L.select_tag('defaults.gl_changeable', SELF.posting_options, value_key = 'value', title_key = 'title', default = SELF.defaults.gl_changeable) %]</td>
29
   <td>[% LxERP.t8('Should gl transactions be and when should they be changeable or deleteable after posting?') %]</td>
30
  </tr>
31

  
32
  <tr> </tr>
33
  <tr> </tr>
34

  
35
  <tr>
36
   <td align="right">[% LxERP.t8('Payments Changeable') %]</td>
37
   <td>[% L.select_tag('defaults.payments_changeable', SELF.payment_options, value_key = 'value', title_key = 'title', default = SELF.defaults.payments_changeable) %]</td>
38
   <td>[% LxERP.t8('Should payments be and when should they be changeable after posting?') %]</td>
39
  </tr>
40

  
41
  <tr> </tr>
42
  <tr> </tr>
43

  
44
  <tr>
45
   <td align="right">[% LxERP.t8('Show "mark as paid" in sales invoices') %]</td>
46
   <td>[% L.yes_no_tag('defaults.is_show_mark_as_paid', SELF.defaults.is_show_mark_as_paid) %]</td>
47
   <td>[% LxERP.t8('Should the "mark as paid" button showed on sales invoices?') %]</td>
48
  </tr>
49
  <tr>
50
   <td align="right">[% LxERP.t8('Show "mark as paid" in purchase invoices') %]</td>
51
   <td>[% L.yes_no_tag('defaults.ir_show_mark_as_paid', SELF.defaults.ir_show_mark_as_paid) %]</td>
52
   <td>[% LxERP.t8('Should the "mark as paid" button showed in purchase invoices?') %]</td>
53
  </tr>
54
  <tr>
55
   <td align="right">[% LxERP.t8('Show "mark as paid" in ar transactions') %]</td>
56
   <td>[% L.yes_no_tag('defaults.ar_show_mark_as_paid', SELF.defaults.ar_show_mark_as_paid) %]</td>
57
   <td>[% LxERP.t8('Should the "mark as paid" button showed in ar transactions?') %]</td>
58
  </tr>
59
  <tr>
60
   <td align="right">[% LxERP.t8('Show "mark as paid" in ap transactions') %]</td>
61
   <td>[% L.yes_no_tag('defaults.ap_show_mark_as_paid', SELF.defaults.ap_show_mark_as_paid) %]</td>
62
   <td>[% LxERP.t8('Should the "mark as paid" button showed in ap transactions?') %]</td>
63
  </tr>
64

  
65
  <tr> </tr>
66
  <tr> </tr>
67

  
68
  <tr>
69
   <td align="right">[% LxERP.t8('Accounting method') %]</td>
70
   <td>[% L.select_tag('defaults.accounting_method', SELF.accounting_options, value_key = 'value', title_key = 'title', default = SELF.defaults.accounting_method) %]</td>
71
   <td>[% LxERP.t8('This option controls the posting and calculation behavior for the accounting method.') %]</td>
72
  </tr>
73
  <tr>
74
   <td align="right">[% LxERP.t8('Inventory system') %]</td>
75
   <td>[% L.select_tag('defaults.inventory_system', SELF.inventory_options, value_key = 'value', title_key = 'title', default = SELF.defaults.inventory_system) %]</td>
76
   <td>
77
    [% LxERP.t8('This option controls the inventory system.') %]<br>
78
    [% LxERP.t8('ATTENTION! You can not simply change it from periodic to perpetual once you started posting.') %]
79
   </td>
80
  </tr>
81
  <tr>
82
   <td align="right">[% LxERP.t8('Profit determination') %]</td>
83
   <td>[% L.select_tag('defaults.profit_determination', SELF.profit_options, value_key = 'value', title_key = 'title', default = SELF.defaults.profit_determination) %]</td>
84
   <td>[% LxERP.t8('This option controls the method used for profit determination.') %]</td>
85
  </tr>
86
 </table>
87
</div>
templates/webpages/client_config/_warehouse.html
1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%]
2
<div id="warehouse">
3
 <div class='listheading'>[% LxERP.t8('Warehouse') %]</div>
4

  
5
 <table>
6
  <tr>
7
   <td align="right">[% LxERP.t8('Default Transfer') %]</td>
8
   <td>
9
    [% L.yes_no_tag('defaults.transfer_default', SELF.defaults.transfer_default) %]
10
   </td>
11
   <td>
12
    [% LxERP.t8('Show Transfer via default') %]<br>
13
   </td>
14
  </tr>
15
  <tr>
16
   <td align="right">[% LxERP.t8('Default Transfer with Master Bin') %]</td>
17
   <td>
18
    [% L.yes_no_tag('defaults.transfer_default_use_master_default_bin', SELF.defaults.transfer_default_use_master_default_bin) %]
19
   </td>
20
   <td>
21
    [% LxERP.t8('Use master default bin for Default Transfer, if no default bin for the part is configured') %]<br>
22
   </td>
23
  </tr>
24
  <tr>
25
   <td align="right">[% LxERP.t8('Default Transfer Out with negative inventory') %]</td>
26
   <td>
27
    [% L.yes_no_tag('defaults.transfer_default_ignore_onhand', SELF.defaults.transfer_default_ignore_onhand) %]
28
   </td>
29
   <td>
30
    [% LxERP.t8('Default Transfer Out always succeed. The current part onhand is ignored and the inventory can have negative stocks (not recommended).') %]<br>
31
   </td>
32
  </tr>
33

  
34
  <tr> </tr>
35
  <tr>
36
   <td align="right" nowrap="true">[% LxERP.t8('Default Warehouse') %]</td>
37
   <td>
38
    [% L.select_tag('defaults.warehouse_id', SELF.all_warehouses, id='warehouse_id', with_empty=1, default=SELF.defaults.warehouse_id, title_key='description',
39
                    onchange="warehouse_selected(this.selectedIndex == 0 ? -1 : warehouses[this.selectedIndex - 1].id, -1)") %]
40
   </td>
41
   <td>
42
    [% LxERP.t8('This is the default bin for parts') %]<br>
43
    [% LxERP.t8('If configured this bin will be preselected for all new parts. Also this bin will be used as the master default bin, if default transfer out with master bin is activated.') %]<br>
44
   </td>
45
  </tr>
46
  <tr>
47
   <td align="right" nowrap="true">[% LxERP.t8('Default Bin') %]</td>
48
   <td>[% L.select_tag('defaults.bin_id', [], id='bin_id', with_empty=1) %]</td>
49
  </tr>
50
  <tr>
51
   <td align="right" nowrap="true">[% LxERP.t8('Default Warehouse with ignoring on hand') %]</td>
52
   <td>
53
    [% L.select_tag('defaults.warehouse_id_ignore_onhand', SELF.all_warehouses, id='warehouse_id_ignore_onhand', with_empty=1, default=SELF.defaults.warehouse_id_ignore_onhand, title_key='description',
54
                    onchange="warehouse_selected(this.selectedIndex == 0 ? -1 : warehouses[this.selectedIndex - 1].id, -1, 'bin_id_ignore_onhand')") %]
55
   </td>
56
   <td>
57
    [% LxERP.t8('This is the default bin for ignoring onhand') %]<br>
58
    [% LxERP.t8('If the default transfer out always succeed use this bin for negative stock quantity.') %]<br>
59
   </td>
60
  </tr>
61
  <tr>
62
   <td align="right" nowrap="true">[% LxERP.t8('Default Bin with ignoring onhand') %]</td>
63
   <td>[% L.select_tag('defaults.bin_id_ignore_onhand', [], id='bin_id_ignore_onhand', with_empty=1) %]</td>
64
  </tr>
65
  <tr>
66
   <td align="right">[% LxERP.t8('Show Bestbefore') %]</td>
67
   <td>
68
    [% L.yes_no_tag('defaults.show_bestbefore', SELF.defaults.show_bestbefore) %]
69
   </td>
70
   <td>
71
    [% LxERP.t8('Show fields used for the best before date?') %]<br>
72
    [% LxERP.t8('ATTENTION! If you enabled this feature you can not simply turn it off again without taking care that best_before fields are emptied in the database.') %]<br>
73
    [% LxERP.t8('This can be done with the following query:') %]<br>
74
    <br>
75
    UPDATE inventory SET bestbefore = NULL; <br>
76
    <br>
77
    [% LxERP.t8('Any stock contents containing a best before date will be impossible to stock out otherwise.') %]
78
   </td>
79
  </tr>
80
 </table>
81
</div>
templates/webpages/client_config/form.html
4 4
 <script type="text/javascript" src="js/parts_language_selection.js"></script>
5 5
 <script type="text/javascript">
6 6
  <!--
7
      warehouses = new Array();
8
      [%- USE WAREHOUSES_it = Iterator(SELF.WAREHOUSES) %][%- FOREACH warehouse = WAREHOUSES_it %]
9
      warehouses[[% WAREHOUSES_it.count - 1 %]] = new Array();
10
      warehouses[[% WAREHOUSES_it.count - 1 %]]['id'] = [% warehouse.id %];
11
      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'] = new Array();
12
      [% USE BINS_it = Iterator(warehouse.BINS) %][% FOREACH bin = BINS_it %]
13
      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count - 1 %]] = new Array();
14
      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count - 1 %]]['description'] = "[% JavaScript.escape(bin.description) %]";
15
      warehouses[[% WAREHOUSES_it.count - 1 %]]['bins'][[% BINS_it.count - 1 %]]['id'] = [% bin.id %];
16
      [% END %]
17
      [% END %]
18

  
19
      function warehouse_selected(warehouse_id, bin_id, bin_id_name) {
20

  
21
        // bin_id_name is optional and only used in client_config.html
22
        var bin_id_name = bin_id_name || 'bin_id';
23

  
24
        var control = document.getElementById(bin_id_name);
25

  
26
        for (var i = control.options.length - 1; i >= 0; i--) {
27
          control.options[i] = null;
28
        }
29

  
30
        var warehouse_index = 0;
31

  
32
        for (i = 0; i < warehouses.length; i++)
33
          if (warehouses[i]['id'] == warehouse_id) {
34
            warehouse_index = i;
35
            break;
36
          }
37

  
38
        var warehouse = warehouses[warehouse_index];
39
        var bin_index = 0;
40

  
41
        for (i = 0; i < warehouse['bins'].length; i++)
42
          if (warehouse['bins'][i]['id'] == bin_id) {
43
            bin_index = i;
44
            break;
45
          }
46

  
47
        for (i = 0; i < warehouse['bins'].length; i++) {
48
          control.options[i] = new Option(warehouse['bins'][i]['description'], warehouse['bins'][i]['id']);
49
        }
50

  
51

  
52
        control.options[bin_index].selected = true;
53
      }
54

  
55
      $(function() {
56
        warehouse_selected([% SELF.warehouse_id %], [% SELF.bin_id %], 'bin_id');
57
        warehouse_selected([% SELF.warehouse_id_ignore_onhand %], [% SELF.bin_id_ignore_onhand %], 'bin_id_ignore_onhand');
58
      })
7
var warehouses = [
8
 [%- USE warehouses_it = Iterator(SELF.all_warehouses) %][%- FOREACH warehouse = warehouses_it %]
9
  { id:   [% warehouse.id %],
10
    bins: [
11
     [% USE bins_it = Iterator(warehouse.bins_sorted) %][% FOREACH bin = bins_it %]
12
      { id: [% bin.id %], description: "[% JavaScript.escape(bin.description) %]" }[% UNLESS bins_it.last %],[% END %]
13
     [% END %]
14
   ] }[% UNLESS warehouses_it.last %],[% END %]
15
 [% END %]
16
];
17

  
18
function warehouse_selected(warehouse_id, bin_id, bin_id_name) {
19
  // bin_id_name is optional and only used in client_config.html
20
  bin_id_name = bin_id_name || 'bin_id';
21

  
22
  // Remove all bins safe for the empty entry
23
  var bin_select = $('#' + bin_id_name);
24
  bin_select.find('option').filter('[value!=""]').remove();
25

  
26
  // Find selected warehouse
27
  var warehouse = warehouses.filter(function(elt) { return elt.id == warehouse_id; })[0];
28
  if (!warehouse)
29
    return;
30

  
31
  // Add bins as options to select.
32
  $(warehouse.bins).each(function(idx, bin) {
33
    bin_select.append($('<option>', { value: bin.id, selected: bin.id == bin_id }).text(bin.description));
34
  });
35
}
36

  
37
$(function() {
38
  warehouse_selected([% SELF.defaults.warehouse_id || -1 %], [% SELF.defaults.bin_id || -1 %], 'bin_id');
39
  warehouse_selected([% SELF.defaults.warehouse_id_ignore_onhand || -1 %], [% SELF.defaults.bin_id_ignore_onhand || -1 %], 'bin_id_ignore_onhand');
40
})
59 41
    -->
60 42
 </script>
61 43
<h1>[% title | html %]</h1>
......
63 45
[% PROCESS 'common/flash.html' %]
64 46

  
65 47
<form action='controller.pl' method='POST'>
66

  
67
<table>
68

  
69
 <tr class='listheading'>
70
   <th colspan="3">[% 'Posting Configuration' | $T8 %]</th>
71
 </tr>
72

  
73
 <tr>
74
   <td align="right">[% 'Sales invoices changeable' | $T8 %]</td>
75
   <td>[% L.select_tag('is_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.is_changeable) %]</td>
76
   <td>[% 'Should sales invoices be and when should they be changeable or deleteable after posting?' | $T8 %]</td>
77
 </tr>
78
 <tr>
79
   <td align="right">[% 'Purchase invoices changeable' | $T8 %]</td>
80
   <td>[% L.select_tag('ir_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.ir_changeable) %]</td>
81
   <td>[% 'Should purchase invoices be and when should they be deleteable after posting?' | $T8 %]</td>
82
 </tr>
83
 <tr>
84
   <td align="right">[% 'AR transactions changeable' | $T8 %]</td>
85
   <td>[% L.select_tag('ar_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.ar_changeable) %]</td>
86
   <td>[% 'Should ar transactions be and when should they be changeable or deleteable after posting?' | $T8 %]</td>
87
 </tr>
88
 <tr>
89
   <td align="right">[% 'AP transactions changeable' | $T8 %]</td>
90
   <td>[% L.select_tag('ap_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.ap_changeable) %]</td>
91
   <td>[% 'Should ap transactions be and when should they be changeable or deleteable after posting?' | $T8 %]</td>
92
 </tr>
93
 <tr>
94
   <td align="right">[% 'GL transactions changeable' | $T8 %]</td>
95
   <td>[% L.select_tag('gl_changeable', SELF.posting_options, value_key => 'value', title_key => 'title', default => SELF.gl_changeable) %]</td>
96
   <td>[% 'Should gl transactions be and when should they be changeable or deleteable after posting?' | $T8 %]</td>
97
 </tr>
98

  
99
 <tr> </tr>
100
 <tr> </tr>
101

  
102
 <tr>
103
   <td align="right">[% 'Payments Changeable' | $T8 %]</td>
104
   <td>[% L.select_tag('payments_changeable', SELF.payment_options, value_key => 'value', title_key => 'title', default => SELF.payments_changeable) %]</td>
105
   <td>[% 'Should payments be and when should they be changeable after posting?' | $T8 %]</td>
106
 </tr>
107

  
108
 <tr> </tr>
109
 <tr> </tr>
110

  
111
 <tr>
112
   <td align="right">[% 'Show "mark as paid" in sales invoices' | $T8 %]</td>
113
   <td>[% L.yes_no_tag('is_show_mark_as_paid', SELF.is_show_mark_as_paid) %]</td>
114
   <td>[% 'Should the "mark as paid" button showed on sales invoices?' | $T8 %]</td>
115
 </tr>
116
 <tr>
117
   <td align="right">[% 'Show "mark as paid" in purchase invoices' | $T8 %]</td>
118
   <td>[% L.yes_no_tag('ir_show_mark_as_paid', SELF.ir_show_mark_as_paid) %]</td>
119
   <td>[% 'Should the "mark as paid" button showed in purchase invoices?' | $T8 %]</td>
120
 </tr>
121
 <tr>
122
   <td align="right">[% 'Show "mark as paid" in ar transactions' | $T8 %]</td>
123
   <td>[% L.yes_no_tag('ar_show_mark_as_paid', SELF.ar_show_mark_as_paid) %]</td>
124
   <td>[% 'Should the "mark as paid" button showed in ar transactions?' | $T8 %]</td>
125
 </tr>
126
 <tr>
127
   <td align="right">[% 'Show "mark as paid" in ap transactions' | $T8 %]</td>
128
   <td>[% L.yes_no_tag('ap_show_mark_as_paid', SELF.ap_show_mark_as_paid) %]</td>
129
   <td>[% 'Should the "mark as paid" button showed in ap transactions?' | $T8 %]</td>
130
 </tr>
131

  
132
 <tr> </tr>
133
 <tr> </tr>
134

  
135
 <tr>
136
   <td align="right">[% 'Accounting method' | $T8 %]</td>
137
   <td>[% L.select_tag('accounting_method', SELF.accounting_options, value_key => 'value', title_key => 'title', default => SELF.accounting_method) %]</td>
138
   <td>[% 'This option controls the posting and calculation behavior for the accounting method.' | $T8 %]</td>
139
 </tr>
140
 <tr>
141
   <td align="right">[% 'Inventory system' | $T8 %]</td>
142
   <td>[% L.select_tag('inventory_system', SELF.inventory_options, value_key => 'value', title_key => 'title', default => SELF.inventory_system) %]</td>
143
   <td>
144
     [% 'This option controls the inventory system.' | $T8 %]<br>
145
     [% 'ATTENTION! You can not simply change it from periodic to perpetual once you started posting.' | $T8 %]
146
   </td>
147
 </tr>
148
 <tr>
149
   <td align="right">[% 'Profit determination' | $T8 %]</td>
150
   <td>[% L.select_tag('profit_determination', SELF.profit_options, value_key => 'value', title_key => 'title', default => SELF.profit_determination) %]</td>
151
   <td>[% 'This option controls the method used for profit determination.' | $T8 %]</td>
152
 </tr>
153

  
154
 <tr> </tr>
155
 <tr> </tr>
156

  
157
 <tr class='listheading'>
158
   <th colspan="3">[% 'DATEV check configuration' | $T8 %]</th>
159
 </tr>
160
 <tr>
161
   <td colspan="3">[% 'It is possible to make a quick DATEV export everytime you post a record to ensure things work nicely with their data requirements. This will result in a slight overhead though you can enable this for each type of record independantly.' | $T8 %]</td>
162
 </tr>
163
 <tr>
164
   <td align="right">[% 'Check on sales invoice' | $T8 %]</td>
165
   <td>[% L.yes_no_tag('datev_check_on_sales_invoice', SELF.datev_check_on_sales_invoice) %]</td>
166
   <td>[% 'Perform check when a sales invoice or a payment for a sales invoice is posted?' | $T8 %]</td>
167
 </tr>
168
 <tr>
169
   <td align="right">[% 'Check on purchase invoice' | $T8 %]</td>
170
   <td>[% L.yes_no_tag('datev_check_on_purchase_invoice', SELF.datev_check_on_purchase_invoice) %]</td>
171
   <td>[% 'Perform check when a purchase invoice or a payment for a purchase invoice is posted?' | $T8 %]</td>
172
 </tr>
173
 <tr>
174
   <td align="right">[% 'Check on ar transaction' | $T8 %]</td>
175
   <td>[% L.yes_no_tag('datev_check_on_ar_transaction', SELF.datev_check_on_ar_transaction) %]</td>
176
   <td>[% 'Perform check when an ar transaction is posted?' | $T8 %]</td>
177
 </tr>
178
 <tr>
179
   <td align="right">[% 'Check on ap transaction' | $T8 %]</td>
180
   <td>[% L.yes_no_tag('datev_check_on_ap_transaction', SELF.datev_check_on_ap_transaction) %]</td>
181
   <td>[% 'Perform check when an ap transaction is posted?' | $T8 %]</td>
182
 </tr>
183
 <tr>
184
   <td align="right">[% 'Check on gl transaction' | $T8 %]</td>
185
   <td>[% L.yes_no_tag('datev_check_on_gl_transaction', SELF.datev_check_on_gl_transaction) %]</td>
186
   <td>[% 'Perform check when a gl transaction is posted?' | $T8 %]</td>
187
 </tr>
188

  
189
 <tr> </tr>
190
 <tr> </tr>
191

  
192
 <tr class='listheading'>
193
   <th colspan="3">[% 'Orders / Delivery Orders deleteable' | $T8 %]</th>
194
 </tr>
195
 <tr>
196
   <td align="right">[% 'Sales Orders deleteable' | $T8 %]</td>
197
   <td>[% L.yes_no_tag('sales_order_show_delete', SELF.sales_order_show_delete) %]</td>
198
   <td>[% 'Show delete button in sales orders?' | $T8 %]</td>
199
 </tr>
200
 <tr>
201
   <td align="right">[% 'Purchase Orders deleteable' | $T8 %]</td>
202
   <td>[% L.yes_no_tag('purchase_order_show_delete', SELF.purchase_order_show_delete) %]</td>
203
   <td>[% 'Show delete button in purchase orders?' | $T8 %]</td>
204
 </tr>
205
 <tr>
206
   <td align="right">[% 'Sales Delivery Orders deleteable' | $T8 %]</td>
207
   <td>[% L.yes_no_tag('sales_delivery_order_show_delete', SELF.sales_delivery_order_show_delete) %]</td>
208
   <td>[% 'Show delete button in sales delivery orders?' | $T8 %]</td>
209
 </tr>
210
 <tr>
211
   <td align="right">[% 'Purchase Delivery Orders deleteable' | $T8 %]</td>
212
   <td>[% L.yes_no_tag('purchase_delivery_order_show_delete', SELF.purchase_delivery_order_show_delete) %]</td>
213
   <td>[% 'Show delete button in purchase delivery orders?' | $T8 %]</td>
214
 </tr>
215

  
216
 <tr> </tr>
217
 <tr> </tr>
218

  
219
 <tr class='listheading'>
220
   <th colspan="3">[% 'Warehouse' | $T8 %]</th>
221
 </tr>
222
 <tr>
223
   <td align="right">[% 'Default Transfer' | $T8 %]</td>
224
   <td>
225
     [% L.yes_no_tag('transfer_default', SELF.transfer_default) %]
226
   </td>
227
   <td>
228
     [% 'Show Transfer via default' | $T8 %]<br>
229
  </td>
230
  </tr>
231
  <tr>
232
   <td align="right">[% 'Default Transfer with Master Bin' | $T8 %]</td>
233
   <td>
234
     [% L.yes_no_tag('transfer_default_use_master_default_bin', SELF.transfer_default_use_master_default_bin) %]
235
   </td>
236
   <td>
237
     [% 'Use master default bin for Default Transfer, if no default bin for the part is configured' | $T8 %]<br>
238
  </td>
239
  </tr>
240
  <tr>
241
   <td align="right">[% 'Default Transfer Out with negative inventory' | $T8 %]</td>
242
   <td>
243
     [% L.yes_no_tag('transfer_default_ignore_onhand', SELF.transfer_default_ignore_onhand) %]
244
   </td>
245
   <td>
246
     [% 'Default Transfer Out always succeed. The current part onhand is ignored and the inventory can have negative stocks (not recommended).' | $T8 %]<br>
247
  </td>
248
  </tr>
249

  
250
 <tr> </tr>
251
<tr>
252
<th align="right" nowrap="true">[% 'Default Warehouse' | $T8 %]</th>
253
<td>
254
 <select name="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)">
255
  [%- FOREACH warehouse = SELF.WAREHOUSES %]
256
    <option value="[% HTML.escape(warehouse.id) %]"[% IF SELF.warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
257
  [%- END %]
258
 </select>
259
</td>
260
<td>
261
   [% 'This is the default bin for parts' | $T8 %]<br>
262
   [% 'If configured this bin will be preselected for all new parts. Also this bin will be used as the master default bin, if default transfer out with master bin is activated.' | $T8 %]<br>
263
</td>
264
</tr>
265
<tr>
266
<th align="right" nowrap="true">[% 'Default Bin' | $T8 %]</th>
267
<td><select id="bin_id" name="bin_id"></select></td>
268
</tr>
269
<tr>
270
<th align="right" nowrap="true">[% 'Default Warehouse with ignoring on hand' | $T8 %]</th>
271
<td>
272
 <select name="warehouse_id_ignore_onhand" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0, 'bin_id_ignore_onhand')">
273
  [%- FOREACH warehouse = SELF.WAREHOUSES %]
274
    <option value="[% HTML.escape(warehouse.id) %]"[% IF SELF.warehouse_id_ignore_onhand == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
275
  [%- END %]
276
 </select>
277
</td>
278
<td>
279
   [% 'This is the default bin for ignoring onhand' | $T8 %]<br>
280
   [% 'If the default transfer out always succeed use this bin for negative stock quantity.' | $T8 %]<br>
281
</td>
282
</tr>
283
<tr>
284
<th align="right" nowrap="true">[% 'Default Bin with ignoring onhand' | $T8 %]</th>
285
<td><select id="bin_id_ignore_onhand" name="bin_id_ignore_onhand"></select></td>
286
</tr>
287
<tr>
288
   <td align="right">[% 'Show Bestbefore' | $T8 %]</td>
289
   <td>
290
     [% L.yes_no_tag('show_bestbefore', SELF.show_bestbefore) %]
291
   </td>
292
   <td>
293
     [% 'Show fields used for the best before date?' | $T8 %]<br>
294
     [% 'ATTENTION! If you enabled this feature you can not simply turn it off again without taking care that best_before fields are emptied in the database.' | $T8 %]<br>
295
     [% 'This can be done with the following query:' | $T8 %]<br>
296
     <br>
297
     UPDATE inventory SET bestbefore = NULL; <br>
298
     <br>
299
     [% 'Any stock contents containing a best before date will be impossible to stock out otherwise.' | $T8 %]
300
   </td>
301
 </tr>
302
 <tr class='listheading'>
303
   <th colspan="3">[% 'Weight' | $T8 %]</th>
304
 </tr>
305
 <tr>
306
   <td align="right">[% 'Show weights' | $T8 %]</td>
307
   <td>
308
     [% L.yes_no_tag('show_weight', SELF.show_weight) %]
309
   </td>
310
   <td>
311
     [% 'Show the weights of articles and the total weight in orders, invoices and delivery notes?' | $T8 %]<br>
312
   </td>
313
 </tr>
314
</table>
315

  
316
<br>
317

  
318
[%- L.hidden_tag('action',  'ClientConfig/dispatch')  %]
319
[%- L.submit_tag('action_save',  LxERP.t8('Save'))  %]
320

  
321
<br><br>
48
 <div class="tabwidget">
49
  <ul>
50
   <li><a href="#posting_configuration">[% 'Posting Configuration' | $T8 %]</a></li>
51
   <li><a href="#datev_check_configuration">[% 'DATEV check configuration' | $T8 %]</a></li>
52
   <li><a href="#orders_deleteable">[% 'Orders / Delivery Orders deleteable' | $T8 %]</a></li>
53
   <li><a href="#warehouse">[% 'Warehouse' | $T8 %]</a></li>
54
   <li><a href="#miscellaneous">[% 'Miscellaneous' | $T8 %]</a></li>
55
  </ul>
56

  
57
[% PROCESS 'client_config/_posting_configuration.html' %]
58
[% PROCESS 'client_config/_datev_check_configuration.html' %]
59
[% PROCESS 'client_config/_orders_deleteable.html' %]
60
[% PROCESS 'client_config/_warehouse.html' %]
61
[% PROCESS 'client_config/_miscellaneous.html' %]
62

  
63
 <div>
64
  [%- L.hidden_tag('action',  'ClientConfig/dispatch')  %]
65
  [%- L.submit_tag('action_save',  LxERP.t8('Save'))  %]
66
 </div>
322 67

  
323 68
</form>

Auch abrufbar als: Unified diff