<perl>
#------------------------------------------------#
#--SR Importieren Datensaetze Teil 1 #
#------------------------------------------------#
sub do_import
{
$count_tel = 0;
$count_fax = 0;
$count_d1 = 0;
$count_d2 = 0;
$work_blank = "";
get "Id==*", "../bgd/bgdata_imp0";
while (get_next("../bgd/bgdata_imp0"))
{
$work_firmnam = "";
$work_firmnam = "$d0_vorname " if ($d0_vorname);
$work_firmnam .= $d0_nachname if ($d0_nachname);
$work_firmnam =~ s/ /\@\@/g; # wg. parser-fehler blanks in @ umwandeln
$work_firmsort = "";
$work_firmsort = uc($d0_nachname) if ($d0_nachname);
$work_strasse = "";
$work_strasse = $d0_strasse;
$work_strasse .= " " if ($d0_nr < '10');
$work_strasse .= " " if ($d0_nr > '9' && $d0_nr < '100');
$work_strasse .= $d0_nr;
$work_strasse =~ s/ /\@\@/g; # wg. parser-fehler blanks in @ umwandeln
$work_ortsteil = "";
$work_ortsteil = "$d0_ortsteil " if ($d0_ortsteil);
$work_ortsteil = " Zentrum" if (!$d0_ortsteil);
$work_telefon = "";
$work_telefon = $d0_telefon if ($d0_telzusatz eq "");
$work_telefax = "";
$work_telefax = $d0_telefon if ($d0_telzusatz eq "Telefax");
$count_tel++ if ($d0_telzusatz eq "");
$count_fax++ if ($d0_telzusatz eq "Telefax");
$count_d1++ if ($d0_telzusatz eq "D1");
$count_d2++ if ($d0_telzusatz eq "D2");
if ($d0_telzusatz eq $work_blank)
{
put [ "d1_okey", "$d1_okey",
"d1_firmnam", "$work_firmnam",
"d1_firmsort", "$work_firmsort",
"d1_firmnam2", "$d0_zusatz",
"d1_strasse", "$work_strasse",
"d1_ort", "$d0_ort",
"d1_ortsteil", "$work_ortsteil",
"d1_plz", "$d0_plz",
"d1_vorwahl", "$d0_vorwahl",
"d1_telefon", "$work_telefon",
"d1_telefax", "$work_telefax",
"d1_email", "$d0_email",
"d1_url", "$d0_www",
"d1_kunde", "0",
"d1_status", "0" ],
"../bgd/bgdata_imp1";
}
}
$msg = "IMP";
$cmd = "do_import_2";
}
</perl>
<perl>
#------------------------------------------------#
#--SR Importieren Datensaetze Teil 2 #
#------------------------------------------------#
sub do_import_2
{
get "d0_telzusatz==Telefax", "../bgd/bgdata_imp0";
while (get_next("../bgd/bgdata_imp0"))
{
$work_firmnam = "";
$work_firmnam = "$d0_vorname " if ($d0_vorname);
$work_firmnam .= $d0_nachname if ($d0_nachname);
$work_firmnam =~ s/ /\@\@/g; # wg. parser-fehler blanks in @ umwandeln
$work_strasse = "";
$work_strasse = $d0_strasse;
$work_strasse .= " " if ($d0_nr < '10');
$work_strasse .= " " if ($d0_nr > '9' && $d0_nr < '100');
$work_strasse .= $d0_nr;
$work_strasse =~ s/ /\@\@/g; # wg. parser-fehler blanks in @ umwandeln
get "d1_firmnam==$work_firmnam & d1_strasse==$work_strasse", "../bgd/bgdata_imp1";
$pruef_d1_firmnam = $d1_firmnam;
$pruef_work_firmnam = $work_firmnam;
$pruef_d1_strasse = $d1_strasse;
$pruef_work_strasse = $work_strasse;
$pruef_count++;
if (($d1_firmnam eq $work_firmnam) && ($d1_strasse eq $work_strasse))
{
mod "Id==$_id",[ "d1_firmnam", "$d1_firmnam", "d1_strasse", "$d1_strasse",
"d1_telefax", "$d0_telefon", "d1_status", "1" ], "../bgd/bgdata_imp1";
$msg = "IMP2";
}
}
# $cmd = "fm_import";
$cmd = "do_korr";
}
</perl>
<perl>
#------------------------------------------------#
#--SR Korrigieren Datensaetze #
#------------------------------------------------#
sub do_korr
{
get "Id==*", "../bgd/bgdata_imp1","ergebnis";
while (get_next("ergebnis"))
{
$d1_firmnam =~ s/\@\@/ /g; # wg. parser-fehler @ wieder in blank wandeln
$d1_strasse =~ s/\@\@/ /g; # wg. parser-fehler @ wieder in blank wandeln
mod "Id==$_id", [ "d1_firmnam", "$d1_firmnam", "d1_strasse", "$d1_strasse" ], "../bgd/bgdata_imp1";
}
$cmd = "fm_import";
}
</perl>