Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 61763f2f

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

retrieve_accounts: 'current_date' richtig in Queries einbauen

Unterschiede anzeigen:

SL/IC.pm
1467 1467

  
1468 1468
  $form->{ACCOUNT_CHAIN_BY_ID} ||= {
1469 1469
    map { $_->{id} => $_ }
1470
      selectall_hashref_query($form, $dbh, <<SQL, $transdate) };
1471
    SELECT c.id, c.new_chart_id, date(?) >= c.valid_from AS is_valid, cnew.accno
1470
      selectall_hashref_query($form, $dbh, <<SQL) };
1471
    SELECT c.id, c.new_chart_id, ${transdate} >= c.valid_from AS is_valid, cnew.accno
1472 1472
    FROM chart c
1473 1473
    LEFT JOIN chart cnew ON c.new_chart_id = cnew.id
1474 1474
    WHERE NOT c.new_chart_id IS NULL AND (c.new_chart_id > 0)
......
1518 1518
  if ($transdate eq "") {
1519 1519
    $transdate = "current_date";
1520 1520
  } else {
1521
    $transdate = $dbh->quote($transdate);
1521
    $transdate = 'date(' . $dbh->quote($transdate) . ')';
1522 1522
  }
1523 1523
  #/transdate
1524 1524
  my $inc_exp = $form->{"vc"} eq "customer" ? "income_accno_id" : "expense_accno_id";
......
1551 1551
    WHERE t.id IN
1552 1552
      (SELECT tk.tax_id
1553 1553
       FROM taxkeys tk
1554
       WHERE tk.chart_id = ? AND startdate <= ?
1554
       WHERE tk.chart_id = ? AND startdate <= ${transdate}
1555 1555
       ORDER BY startdate DESC LIMIT 1)
1556 1556
SQL
1557 1557

  
......
1569 1569

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

  
1572
    $sth_tax->execute($accounts{$inc_exp}, quote_db_date($transdate));
1572
    $sth_tax->execute($accounts{$inc_exp});
1573 1573
    $ref = $sth_tax->fetchrow_hashref or next;
1574 1574

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

Auch abrufbar als: Unified diff