From ca099d9f9803d203545d3a4887937fc90a36cdb5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 31 May 2013 10:09:58 +0200 Subject: [PATCH] =?utf8?q?Standardlager=20und=20Standardlagerplatz=20?= =?utf8?q?=C3=BCber=20Mandantenkonfiguration=20einstellbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/ClientConfig.pm | 19 +++++++++++++++++++ templates/webpages/client_config/form.html | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/SL/Controller/ClientConfig.pm b/SL/Controller/ClientConfig.pm index 41c19ee80..1bfa615ac 100644 --- a/SL/Controller/ClientConfig.pm +++ b/SL/Controller/ClientConfig.pm @@ -43,6 +43,18 @@ sub action_edit { 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); + map { $self->{$_} = SL::DB::Default->get->$_ } qw(warehouse_id bin_id); + $::form->get_lists('warehouses' => { 'key' => 'WAREHOUSES', + 'bins' => 'BINS', }); + $self->{WAREHOUSES} = $::form->{WAREHOUSES}; + # leerer lagerplatz mit id 0 + my $no_default_bin_entry = { 'id' => '0', description => '--', 'BINS' => [ { id => '0', description => ''} ] }; + push @ { $self->{WAREHOUSES} }, $no_default_bin_entry; + + if (my $max = scalar @{ $self->{WAREHOUSES} }) { + $self->{warehouse_id} ||= $self->{WAREHOUSES}->[$max -1]->{id}; + $self->{bin_id} ||= $self->{WAREHOUSES}->[$max -1]->{BINS}->[0]->{id}; + } $self->render('client_config/form', title => $::locale->text('Client Configuration')); } @@ -64,6 +76,13 @@ sub action_save { 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); + # undef warehouse_id if the empty value is selected + if ( ($::form->{warehouse_id} == 0) && ($::form->{bin_id} == 0) ) { + undef $::form->{warehouse_id}; + undef $::form->{bin_id}; + } + map { SL::DB::Default->get->update_attributes($_ => $::form->{$_}); } qw(warehouse_id bin_id); + flash_later('info', $::locale->text('Client Configuration saved!')); $self->redirect_to(action => 'edit'); diff --git a/templates/webpages/client_config/form.html b/templates/webpages/client_config/form.html index 5fc0c04ac..afd46765c 100644 --- a/templates/webpages/client_config/form.html +++ b/templates/webpages/client_config/form.html @@ -1,5 +1,6 @@ [%- USE T8 %][%- USE L %][% USE LxERP %] +[% PROCESS 'common/select_warehouse_bin.html' warehouses=FORM.warehouses %]

[% title | html %]

[% PROCESS 'common/flash.html' %] @@ -176,6 +177,26 @@ [% 'Any stock contents containing a best before date will be impossible to stock out otherwise.' | $T8 %] + + + + [% 'Default Warehouse' | $T8 %] + + + + + [% 'This is the default bin for parts' | $T8 %]
+ + + + [% 'Default Bin' | $T8 %] + + + -- 2.20.1