]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/Inventory.pm
kivitendo 3.9.2-0.2
[mfinanz.git] / SL / Controller / Inventory.pm
index a4c11f6a0ababcf0b843139b38f3877fa59cf431..6940b2eb5b7234db6abc8049a4abaf3cb6594de5 100644 (file)
@@ -574,7 +574,7 @@ sub action_save_stocktaking {
         stocktaking_cutoff_date => $::form->{cutoff_date_as_date},
       });
       1;
-    } or do { $transfer_error = $EVAL_ERROR->error; }
+    } or do { $transfer_error = ref($EVAL_ERROR) eq 'SL::X::FormError' ? $EVAL_ERROR->error : $EVAL_ERROR; }
   });
 
   return $self->js->flash('error', $transfer_error)->render()
@@ -722,7 +722,7 @@ sub sanitize_target {
   my ($self) = @_;
 
   $self->warehouse($self->warehouses->[0])       if !$self->warehouse || !$self->warehouse->id;
-  $self->bin      ($self->warehouse->bins->[0])  if !$self->bin       || !$self->bin->id;
+  $self->bin      ($self->warehouse->bins_sorted_naturally->[0])  if !$self->bin       || !$self->bin->id;
 #  foreach my $warehouse ( $self->warehouses ) {
 #      $warehouse->{BINS} = [];
 #      foreach my $bin ( $self->bins ) {
@@ -768,7 +768,7 @@ sub build_warehouse_select {
 }
 
 sub build_bin_select {
-  select_tag('bin_id', [ $_[0]->warehouse->bins ],
+  select_tag('bin_id', $_[0]->warehouse->bins_sorted_naturally,
     title_key => 'description',
     default   => $_[0]->bin->id,
   );
@@ -812,7 +812,7 @@ grouped_ids as (
      from last_inventories
  group by trans_id
  order by max(itime)
-     desc limit 10
+     desc limit 20
 )
 select unnest(ids)
   from grouped_ids
@@ -867,8 +867,9 @@ sub prepare_stocktaking_report {
 
   my $callback    = $self->stocktaking_models->get_callback;
 
-  my $report      = SL::ReportGenerator->new(\%::myconfig, $::form);
-  $self->{report} = $report;
+  my $report       = SL::ReportGenerator->new(\%::myconfig, $::form);
+  $report->{title} = t8('Stocktaking Journal');
+  $self->{report}  = $report;
 
   my @columns     = qw(itime employee ean partnumber part qty unit bin chargenumber comment cutoff_date);
   my @sortable    = qw(itime employee ean partnumber part qty bin chargenumber comment cutoff_date);