]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorMoritz Bunkus <moritz@bunkus.org>
Tue, 10 Jan 2012 15:40:55 +0000 (16:40 +0100)
committerMoritz Bunkus <moritz@bunkus.org>
Tue, 10 Jan 2012 15:40:55 +0000 (16:40 +0100)
1  2 
bin/mozilla/ic.pl

diff --combined bin/mozilla/ic.pl
index ad6d71ef77210937519526b9c82b2d72d6c2e407,b02e19d3e3e8e405c07a4fa48fa417119367801a..48280d71f84c682ac0ddae1194a6f89ddc4eea7c
@@@ -1136,7 -1136,7 +1136,7 @@@ sub generate_report 
      model         => $locale->text('Model')            . ": '$form->{model}'",
      drawing       => $locale->text('Drawing')          . ": '$form->{drawing}'",
      microfiche    => $locale->text('Microfiche')       . ": '$form->{microfiche}'",
-     l_soldtotal   => $locale->text('soldtotal'),
+     l_soldtotal   => $locale->text('Qty in Selected Records'),
      ean           => $locale->text('EAN')              . ": '$form->{ean}'",
    );
  
    }
  
    if ($form->{l_linetotal}) {
-     $form->{l_onhand} = "Y";
+     $form->{l_qty} = "Y";
      $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice};
      $form->{l_linetotallastcost}  = $form->{searchitems} eq 'assembly' && !$form->{bom} ? "" : 'Y' if  $form->{l_lastcost};
      $form->{l_linetotallistprice} = "Y" if $form->{l_listprice};
          || $form->{ordered}
          || $form->{rfq}
          || $form->{quoted}) {
-       $form->{l_onhand} = "Y";
#      $form->{l_onhand} = "Y";
      } else {
        $form->{l_linetotalsellprice} = "";
        $form->{l_linetotallastcost}  = "";
      }
    }
  
+   # soldtotal doesn't make sense with more than one bsooqr option.
+   # so reset it to sold (the most common option), and issue a warning
+   my @bsooqr = qw(sold bought onorder ordered rfq quoted);
+   if ($form->{l_subtotal} && 1 < grep { $form->{$_} } @bsooqr) {
+     my $enabled       = first { $form->{$_} } @bsooqr;
+     $form->{$_}       = ''   for @bsooqr;
+     $form->{$enabled} = 'Y';
+     push @options, $::locale->text('Subtotal cannot distinguish betweens record types. Only one of the selected record types will be displayed: #1', $optiontexts{$enabled});
+   }
    IC->all_parts(\%myconfig, \%$form);
  
    my @columns = qw(
      $ref->{lastcost}      *= $ref->{exchangerate} / $ref->{price_factor};
  
      # use this for assemblies
-     my $onhand = $ref->{onhand};
+     my $soldtotal = $ref->{soldtotal};
  
      if ($ref->{assemblyitem}) {
        $row->{partnumber}{align}   = 'right';
-       $row->{onhand}{data}        = 0;
-       $onhand                     = 0 if ($form->{sold});
+       $row->{soldtotal}{data}     = 0;
+       $soldtotal                  = 0 if ($form->{sold});
      }
  
      my $edit_link               = build_std_url('action=edit', 'id=' . E($ref->{id}), 'callback');
  
      if (!$ref->{assemblyitem}) {
        foreach my $col (@subtotal_columns) {
-         $totals{$col}    += $onhand * $ref->{$col};
-         $subtotals{$col} += $onhand * $ref->{$col};
+         $totals{$col}    += $soldtotal * $ref->{$col};
+         $subtotals{$col} += $soldtotal * $ref->{$col};
        }
  
-       $subtotals{onhand} += $onhand;
+       $subtotals{soldtotal} += $soldtotal;
      }
  
      # set module stuff
        my $row = { map { $_ => { 'class' => 'listsubtotal', } } @columns };
  
        if (($form->{searchitems} ne 'assembly') || !$form->{bom}) {
-         $row->{onhand}->{data} = $form->format_amount(\%myconfig, $subtotals{onhand});
+         $row->{soldtotal}->{data} = $form->format_amount(\%myconfig, $subtotals{soldtotal});
        }
  
        map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $subtotals{$_}, 2) } @subtotal_columns;
-       map { $subtotals{$_} = 0 } ('onhand', @subtotal_columns);
+       map { $subtotals{$_} = 0 } ('soldtotal', @subtotal_columns);
  
        $report->add_data($row);
  
@@@ -2042,9 -2053,6 +2053,9 @@@ sub ajax_autocomplete 
  sub back_to_record {
    _check_io_auth();
  
 +
 +  delete @{$::form}{qw(action action_add action_back_to_record back_sub description item notes partnumber sellprice taxaccount2 unit vc)};
 +
    $::auth->restore_form_from_session($::form->{previousform}, clobber => 1);
    $::form->{rowcount}--;
    $::form->{action}   = 'display_form';