Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0a5317e7

Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt

  • ID 0a5317e7d69e81f6052d4659b4379c6c8e398ea0
  • Vorgänger d82cd38a
  • Nachfolger 59c0bed1

Beim Speichern/Buchen geleerte Zeilen entfernen

Vor dem Speichern/Buchen von Verkaufs- und Einkaufsbelegen
evtl. geleerte Zeilen entfernen (also Zeilen, in denen die
Artikelnummer entfernt wurde), damit kein explizites "Erneuern" durch
den Benutzer notwendig ist.

Fix für Bug 1197.

Unterschiede anzeigen:

bin/mozilla/do.pl
609 609
  # $locale->text('Customer missing!');
610 610
  # $locale->text('Vendor missing!');
611 611

  
612
  remove_emptied_rows();
612 613
  validate_items();
613 614

  
614 615
  # if the name changed get new values
bin/mozilla/io.pl
765 765
    map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice lastcost);
766 766

  
767 767
  } else {
768
    my @flds = qw(id partnumber description qty ship sellprice unit
769
                  discount inventory_accno income_accno expense_accno listprice
770
                  taxaccounts bin assembly weight projectnumber project_id
771
                  oldprojectnumber runningnumber serialnumber partsgroup payment_id
772
                  not_discountable shop ve gv buchungsgruppen_id language_values
773
                  sellprice_pg pricegroup_old price_old price_new unit_old ordnumber
774
                  transdate longdescription basefactor marge_total marge_percent
775
                  marge_price_factor lastcost price_factor_id partnotes
776
                  stock_out stock_in has_sernumber);
777

  
778
    my $ic_cvar_configs = CVar->get_configs(module => 'IC');
779
    push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
780

  
781
    # this section applies to invoices and orders
782
    # remove any empty numbers
783
    if ($form->{rowcount}) {
784
      for my $i (1 .. $form->{rowcount} - 1) {
785
        if ($form->{"partnumber_$i"}) {
786
          push @a, {};
787
          my $j = $#a;
788

  
789
          map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
790
          $count++;
791
          if ($main::lizenzen) {
792
            if ($form->{"licensenumber_$i"} == -1) {
793
              &new_license($i);
794
              exit;
795
            }
796
          }
797
        }
798
      }
799

  
800
      $form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
801
      $form->{rowcount} = $count;
802

  
803
      $form->{creditremaining} -= &invoicetotal;
768
    remove_emptied_rows(1);
804 769

  
805
    }
770
    $form->{creditremaining} -= &invoicetotal;
806 771
  }
807 772

  
808 773
  #sk
......
825 790
  $main::lxdebug->leave_sub();
826 791
}
827 792

  
793
sub remove_emptied_rows {
794
  my $dont_add_empty = shift;
795
  my $form           = $::form;
796

  
797
  return unless $form->{rowcount};
798

  
799
  my @flds = qw(id partnumber description qty ship sellprice unit
800
                discount inventory_accno income_accno expense_accno listprice
801
                taxaccounts bin assembly weight projectnumber project_id
802
                oldprojectnumber runningnumber serialnumber partsgroup payment_id
803
                not_discountable shop ve gv buchungsgruppen_id language_values
804
                sellprice_pg pricegroup_old price_old price_new unit_old ordnumber
805
                transdate longdescription basefactor marge_total marge_percent
806
                marge_price_factor lastcost price_factor_id partnotes
807
                stock_out stock_in has_sernumber);
808

  
809
  my $ic_cvar_configs = CVar->get_configs(module => 'IC');
810
  push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
811

  
812
  my @new_rows;
813
  for my $i (1 .. $form->{rowcount} - 1) {
814
    next unless $form->{"partnumber_$i"};
815

  
816
    push @new_rows, { map { $_ => $form->{"${_}_$i" } } @flds };
817
  }
818

  
819
  my $new_rowcount = scalar @new_rows;
820
  $form->redo_rows(\@flds, \@new_rows, $new_rowcount, $form->{rowcount});
821
  $form->{rowcount} = $new_rowcount + ($dont_add_empty ? 0 : 1);
822
}
823

  
828 824
sub invoicetotal {
829 825
  $main::lxdebug->enter_sub();
830 826

  
bin/mozilla/ir.pl
667 667
    exit;
668 668
  }
669 669

  
670
  remove_emptied_rows();
670 671
  &validate_items;
671 672

  
672 673
  my $closedto     = $form->datetonum($form->{closedto}, \%myconfig);
bin/mozilla/is.pl
656 656
    $form->{print_and_post} = 0;
657 657
  }
658 658

  
659
  remove_emptied_rows();
659 660
  &validate_items;
660 661

  
661 662
  my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
bin/mozilla/oe.pl
1101 1101
  $form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
1102 1102
    if ($form->{currency} ne $form->{defaultcurrency});
1103 1103

  
1104
  remove_emptied_rows();
1104 1105
  &validate_items;
1105 1106

  
1106 1107
  my $payment_id;

Auch abrufbar als: Unified diff