sub tab_einf {
if ($eintr) {
&check_doctype();
}
my $dbh = DBI->connect($DBN,$DBUSER,$DBPASS) or die $DBI::errstr;
my $statement_check="SELECT ident_nr, docname FROM zusdoc WHERE ident_nr='$identnr' and docname='$docname'";
my $statement_insert="INSERT INTO $TABELLE VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
my $sth_insert=$dbh->prepare($statement_insert) or die $DBI::errstr;
my $sth_check=$dbh->prepare($statement_check) or die $DBI::errstr;
$sth_check->execute or die $DBI::errstr;
my ($merker_d, $merker_e, $merker_f) = 1 x 3;
my $merker = 0;
if ($doctyp eq 'EI')
{
if (($check1 || $check2 || $check3 || $check4 || $check5) and $ersteller and $werk)
{
if ($head_de and $deutsch)
{
$merker_d = 1;
}
elsif ($head_de or $deutsch) {
$merker_d = 0;
}
else {
$merker_d = 1;
}
if ($head_en and $englisch)
{
$merker_e = 1;
}
elsif ($head_en or $englisch) {
$merker_e = 0;
}
else {
$merker_e = 1;
}
if ($head_fr and $franz)
{
$merker_f = 1;
}
elsif ($head_fr or $franz) {
$merker_f = 0;
}
else {
$merker_f = 1;
}
}
}
elsif ($doctyp eq 'SI') {
unless ($sth_check->fetchrow_array()) {
if (($check1 || $check2 || $check3 || $check4 || $check5) && $ersteller && $werk && $docname)
{
if ($head_de and $pdf_de)
{
$merker_d = 1;
}
elsif ($head_de or $pdf_de) {
$merker_d = 0;
}
else {
$merker_d = 1;
}
if ($head_en and $pdf_en)
{
$merker_e = 1;
}
elsif ($head_en or $pdf_en) {
$merker_e = 0;
}
else {
$merker_e = 1;
}
if ($head_fr and $pdf_fr)
{
$merker_f = 1;
}
elsif ($head_fr or $pdf_fr) {
$merker_f = 0;
}
else {
$merker_f = 1;
}
}
}
}
#Einfügen in tabelle
if ($merker_d && $merker_e && $merker_f) {
if ($head_de) {
$sth_insert->execute($identnr,'DE',$doctyp,$docname,$head_de,$deutsch,$date,$ersteller,$werk,$check1,$check2,
$check3,$check4,$check5) or die $DBI::errstr;
upload_file();
$merker=1;
}
if ($head_en) {
$sth_insert->execute($identnr,'EN',$doctyp,$docname,$head_en,$englisch,$date,$ersteller,$werk,$check1,$check2,
$check3,$check4,$check5) or die $DBI::errstr;
$merker=1;
}
if ($head_fr) {
$sth_insert->execute($identnr,'FR',$doctyp,$docname,$head_fr,$franz,$date,$ersteller,$werk,$check1,$check2,
$check3,$check4,$check5) or die $DBI::errstr;
$merker=1;
}
}
if ($merker == 0) {
&warnung();
}
else {
if ($eintr) {
&ausgabe_neu();
}
elsif ($aktual) {
&ausgabe_aktual();
}
}
$sth_check->finish();
$sth_insert->finish();
$dbh->disconnect();
}