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'));
}
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');
[%- USE T8 %][%- USE L %][% USE LxERP %]
+[% PROCESS 'common/select_warehouse_bin.html' warehouses=FORM.warehouses %]
<h1>[% title | html %]</h1>
[% PROCESS 'common/flash.html' %]
[% 'Any stock contents containing a best before date will be impossible to stock out otherwise.' | $T8 %]
</td>
</tr>
+ <tr> </tr>
+ <tr> </tr>
+ <tr>
+ <th align="right" nowrap="true">[% 'Default Warehouse' | $T8 %]</th>
+ <td>
+ <select name="warehouse_id" onchange="warehouse_selected(warehouses[this.selectedIndex]['id'], 0)">
+ [%- FOREACH warehouse = SELF.WAREHOUSES %]
+ <option value="[% HTML.escape(warehouse.id) %]"[% IF SELF.warehouse_id == warehouse.id %] selected[% END %]>[% warehouse.description %]</option>
+ [%- END %]
+ </select>
+ </td>
+ <td>
+ [% 'This is the default bin for parts' | $T8 %]<br>
+ </td>
+ </tr>
+ <tr>
+ <th align="right" nowrap="true">[% 'Default Bin' | $T8 %]</th>
+ <td><select id="bin_id" name="bin_id"></select></td>
+ </tr>
+
</table>