}
+ # Update chart.taxkey_id to the latest from taxkeys for this chart.
+ $query = <<SQL;
+ UPDATE chart
+ SET taxkey_id = (
+ SELECT taxkey_id
+ FROM taxkeys
+ WHERE taxkeys.chart_id = chart.id
+ ORDER BY startdate DESC
+ LIMIT 1
+ )
+ WHERE id = ?
+SQL
+
+ do_query($form, $dbh, $query, $form->{id});
+
# commit
my $rc = $dbh->commit;
$dbh->disconnect;
--- /dev/null
+-- @tag: chart_taxkey_id_from_taxkeys
+-- @description: chart.taxkey_id aus taxkeys aktualisieren
+-- @depends: release_2_6_2
+-- @charset: utf-8
+UPDATE chart
+SET taxkey_id = (
+ SELECT taxkey_id
+ FROM taxkeys
+ WHERE taxkeys.chart_id = chart.id
+ ORDER BY startdate DESC
+ LIMIT 1
+);