Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ee454f5b

Von Sven Schöling vor mehr als 14 Jahren hinzugefügt

  • ID ee454f5b3b7979f407a9429dfc04c5d7302ed1f8
  • Vorgänger a87dd0ec
  • Nachfolger 4b7433f4

IC->follow_account_chain cached jetzt die Ergebnisse.

Unterschiede anzeigen:

SL/IC.pm
1453 1453

  
1454 1454
  my ($query, $sth);
1455 1455

  
1456
  $query =
1457
    qq|SELECT c.new_chart_id, date($transdate) >= c.valid_from AS is_valid, | .
1458
    qq|  cnew.accno | .
1459
    qq|FROM chart c | .
1460
    qq|LEFT JOIN chart cnew ON c.new_chart_id = cnew.id | .
1461
    qq|WHERE (c.id = ?) AND NOT c.new_chart_id IS NULL AND (c.new_chart_id > 0)|;
1462
  $sth = prepare_query($form, $dbh, $query);
1456
  $form->{ACCOUNT_CHAIN_BY_ID} ||= {
1457
    map { $_->{id} => $_ }
1458
      selectall_hashref_query($form, $dbh, <<SQL, $transdate) };
1459
    SELECT c.id, c.new_chart_id, date(?) >= c.valid_from AS is_valid, cnew.accno
1460
    FROM chart c
1461
    LEFT JOIN chart cnew ON c.new_chart_id = cnew.id
1462
    WHERE NOT c.new_chart_id IS NULL AND (c.new_chart_id > 0)
1463
SQL
1463 1464

  
1464 1465
  while (1) {
1465
    do_statement($form, $sth, $query, $accno_id);
1466
    my $ref = $sth->fetchrow_hashref();
1466
    my $ref = $form->{ACCOUNT_CHAIN_BY_ID}->{$accno_id};
1467 1467
    last unless ($ref && $ref->{"is_valid"} &&
1468 1468
                 !grep({ $_ == $ref->{"new_chart_id"} } @visited_accno_ids));
1469 1469
    $accno_id = $ref->{"new_chart_id"};
......
1509 1509
    $transdate = $dbh->quote($transdate);
1510 1510
  }
1511 1511
  #/transdate
1512
  my $inc_exp = $form->{"vc"} eq "customer" ? "income" : "expense";
1512
  my $inc_exp = $form->{"vc"} eq "customer" ? "income_accno_id" : "expense_accno_id";
1513 1513

  
1514 1514
  my @part_ids = grep { $_ } values %args;
1515 1515
  my $in       = join ',', ('?') x @part_ids;
......
1557 1557

  
1558 1558
    $form->{"${_}_accno_$index"} = $accounts{"${_}_accno"} for qw(inventory income expense);
1559 1559

  
1560
    $sth_tax->execute($accounts{"${inc_exp}_accno_id"}, quote_db_date($transdate));
1560
    $sth_tax->execute($accounts{$inc_exp}, quote_db_date($transdate));
1561 1561
    $ref = $sth_tax->fetchrow_hashref or next;
1562 1562

  
1563 1563
    $form->{"taxaccounts_$index"} = $ref->{"accno"};

Auch abrufbar als: Unified diff