=head1 set_zustand_acctinfo

Setzt die Accounting-Info.

Ist dieser Wert gesetzt, so wird ein Accounting-Datensatz generiert,
wenn der Zustandsübergang ausgeführt wird (nur bei Domains).

=head2 Argumente

=over 4

=item $typ

Tabelle.

=item $id

ID des Eintrags.

=item $kn

Standard-Prompt.

=item $tkn

Textform des Tabellennamens ("Domain").

Default: C<ucfirst($typ)>.

=back

=head2 Ergebnis

Nix.

=cut

use utf8;
use warnings; no warnings "redefine";
use strict;
use Dbase::Help qw(Do DoFn);
use Dbase::Globals qw(get_descr);
use Loader qw(log_update select_descr);

sub set_zustand_acctinfo($$;$$) {
	my($typ,$id,$kn,$tkn) = @_;
	$tkn = ucfirst($typ) unless defined $tkn;

	my $st = select_descr("acctinfo",4+128,undef,"${tkn}-Accounting","$typ,!hide");
	return undef unless defined $st;

	$st = "NULL" if $st eq "-";

	my($von,$mail) = DoFn("select von,erkannt from ${typ}zustand where id=$id");

	log_update("${typ}zustand","von",$von,"mail",$mail,undef,"acctinfo",undef,
		get_descr("acctinfo",DoFn("select acctinfo from ${typ}zustand where id=$id"),1));
	Do("update ${typ}zustand set acctinfo=$st where id=$id");
	$id;
}
1;
