Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 991d16bb

Von Jan Büren vor fast 10 Jahren hinzugefügt

  • ID 991d16bbbc32c05e2e30e00711a42ba20207a8db
  • Vorgänger 78912e55
  • Nachfolger 6934a717

Weitere Positionen verknüpft II

Gutschrift und Rückwartsverknüpfungen umgesetzt. Ferner für
OE.pm und IS.pm den Aufruf von RecordLinks in eine foreach
Schleife gesetzt (einfachere Codewartung).
Kleinigkeiten die mir hier nicht gefällt: converted_from_quotation,
die Variable ist jetzt noch drin und macht "nicht so viel Sinn",
da orderitems nicht zwischen Angebot und Auftrag (oe) unterscheidet.
Ansonsten ist die Positionsverknüpfung z.Z. genauer als die Beleg-Verknüpfung (s.a. #29)
und der nächste Schritt hiefür wäre die Visualisierung an der Oberfläche

Unterschiede anzeigen:

SL/IS.pm
796 796
                                  name_postfix => "_$i",
797 797
                                  dbh          => $dbh);
798 798
    }
799
    # link oe items with invoice
800
    if ($form->{"converted_from_orderitems_id_$i"}) {
801
      RecordLinks->create_links('dbh'        => $dbh,
802
                                'mode'       => 'ids',
803
                                'from_table' => 'orderitems',
804
                                'from_ids'   => $form->{"converted_from_orderitems_id_$i"},
805
                                'to_table'   => 'invoice',
806
                                'to_id'      => $form->{"invoice_id_$i"},
807
      );
808
      delete $form->{"converted_from_orderitems_id_$i"};
809
    }
810
    # link doi items with invoice
811
    if ($form->{"converted_from_delivery_order_items_id_$i"}) {
812
      RecordLinks->create_links('dbh'        => $dbh,
813
                                'mode'       => 'ids',
814
                                'from_table' => 'delivery_order_items',
815
                                'from_ids'   => $form->{"converted_from_delivery_order_items_id_$i"},
816
                                'to_table'   => 'invoice',
817
                                'to_id'      => $form->{"invoice_id_$i"},
818
      );
819
      delete $form->{"converted_from_delivery_order_items_id_$i"};
799
    # link previous items with invoice items
800
    foreach (qw(delivery_order_items orderitems invoice)) {
801
      if ($form->{"converted_from_${_}_id_$i"}) {
802
        RecordLinks->create_links('dbh'        => $dbh,
803
                                  'mode'       => 'ids',
804
                                  'from_table' => $_,
805
                                  'from_ids'   => $form->{"converted_from_${_}_id_$i"},
806
                                  'to_table'   => 'invoice',
807
                                  'to_id'      => $form->{"invoice_id_$i"},
808
        );
809
        delete $form->{"converted_from_${_}_id_$i"};
810
      }
820 811
    }
821 812
  }
822 813

  
SL/OE.pm
578 578
                                  name_prefix  => 'ic_',
579 579
                                  name_postfix => "_$i",
580 580
                                  dbh          => $dbh);
581
      # link quotation items with order items and delete entry (just one link)
582
      if ($form->{"converted_from_quotation_orderitems_id_$i"}) {
583
        RecordLinks->create_links('dbh'        => $dbh,
584
                                  'mode'       => 'ids',
585
                                  'from_table' => 'orderitems',
586
                                  'from_ids'   => $form->{"converted_from_quotation_orderitems_id_$i"},
587
                                  'to_table'   => 'orderitems',
588
                                  'to_id'      => $orderitems_id,
589
        );
590
        delete $form->{"converted_from_quotation_orderitems_id_$i"};
581
      # link previous items with orderitems
582
      foreach (qw(quotation_orderitems orderitems invoice)) {
583
        if ($form->{"converted_from_${_}_id_$i"}) {
584
          my $table = $_;
585
          $table    = 'orderitems' if $table eq 'quotation_orderitems';
586
          RecordLinks->create_links('dbh'        => $dbh,
587
                                    'mode'       => 'ids',
588
                                    'from_table' => $table,
589
                                    'from_ids'   => $form->{"converted_from_${_}_id_$i"},
590
                                    'to_table'   => 'orderitems',
591
                                    'to_id'      => $orderitems_id,
592
          );
593
          delete $form->{"converted_from_${_}_id_$i"};
594
        }
591 595
      }
592 596
    }
593 597
  }
bin/mozilla/io.pl
436 436
    my @hidden_vars;
437 437
    # add hidden ids for persistent (item|invoice)_ids and previous (converted_from*) ids
438 438
    if ($is_quotation) {
439
      push @hidden_vars, qw(orderitems_id);
439
      push @hidden_vars, qw(orderitems_id converted_from_orderitems_id);
440 440
    }
441 441
    if ($is_s_p_order) {
442
      push @hidden_vars, qw(orderitems_id converted_from_quotation_orderitems_id);
442
      push @hidden_vars, qw(orderitems_id converted_from_quotation_orderitems_id converted_from_invoice_id);
443 443
    }
444 444
    if ($is_invoice) {
445 445
      push @hidden_vars, qw(invoice_id converted_from_orderitems_id converted_from_delivery_order_items_id);
......
743 743
                stock_out stock_in has_sernumber reqdate orderitems_id
744 744
                active_price_source active_discount_source delivery_order_items_id
745 745
                invoice_id converted_from_quotation_orderitems_id
746
                converted_from_orderitems_id converted_from_delivery_order_items_id);
746
                converted_from_orderitems_id converted_from_delivery_order_items_id
747
                converted_from_invoice_id);
747 748

  
748 749
  my $ic_cvar_configs = CVar->get_configs(module => 'IC');
749 750
  push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
......
883 884
    map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"})
884 885
            if ($form->{"${_}_${i}"}) }
885 886
        qw(ship qty sellprice listprice basefactor discount));
887
    $form->{"converted_from_invoice_id_$i"} = delete $form->{"invoice_id_$i"};
886 888
  }
887 889

  
888 890
  &prepare_order;
......
903 905
  # we are coming from *_order and convert to quotation
904 906
  # it seems that quotation is only called if we have a existing order
905 907
  if ($form->{type} =~  /(sales|purchase)_order/) {
906
    delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"};
908
    $form->{"converted_from_orderitems_id_$_"} = delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"};
907 909
  }
908 910
  if ($form->{second_run}) {
909 911
    $form->{print_and_post} = 0;
bin/mozilla/is.pl
983 983
      $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"};
984 984
    }
985 985
  }
986
  # set new persistent ids for credit note
987
  delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
986
  # set new persistent ids for credit note and link previous invoice id
987
  $form->{"converted_from_invoice_id_$_"} = delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
988 988

  
989 989
  my $currency = $form->{currency};
990 990
  &invoice_links;
bin/mozilla/oe.pl
1820 1820

  
1821 1821
  # reset
1822 1822
  map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered ordnumber);
1823
  $form->{"converted_from_quotation_orderitems_id_$_"} = $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"};  # always reset orderitems_id
1824
  delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"};  # always reset orderitems_id
1823
  # this converted variable is also used for sales_order to purchase order and vice versa
1824
  $form->{"converted_from_quotation_orderitems_id_$_"} = delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"};
1825 1825

  
1826 1826
  # if purchase_order was generated from sales_order, use  lastcost_$i as sellprice_$i
1827 1827
  # also reset discounts

Auch abrufbar als: Unified diff