addedd wohneinheiten in lieboch rimo import script

This commit is contained in:
Frank Schubert
2023-03-27 14:31:24 +02:00
parent 8e72421df6
commit ea0447208f

View File

@@ -49,7 +49,7 @@ while($csv = fgetcsv($input, 0, ";")) {
//$rollout_time = trim($csv[17]);
//$rollout_info = trim($csv[18]);
//$freigabe = trim($csv[19])
//$unit_count = trim($csv[78]);
$unit_count = trim($csv[5]);
$gdaeigenschaft = trim($csv[67]);
$fcp_name = trim($csv[50]);
@@ -59,7 +59,7 @@ while($csv = fgetcsv($input, 0, ";")) {
if(!$netzgebiet_extref) {
continue;
}
$netzgebiet = ADBNetzgebietModel::getFirst(["extref" => $netzgebiet_extref]);
if(!$netzgebiet) {
@@ -117,6 +117,8 @@ while($csv = fgetcsv($input, 0, ";")) {
$existing_hausnummer = ADBHausnummerModel::getFirst(["adrcd" => $adrcd]);
}
if(!$existing_hausnummer) {
//echo "$hausnummer_extref not found $strasse_name $hausnummer_name\n";
@@ -185,6 +187,7 @@ while($csv = fgetcsv($input, 0, ";")) {
} else {
echo "Address not found (straße: $strasse_name, hausnummer: $hausnummer_name, adrcd: $adrcd, extref: $hausnummer_extref)\n";
continue;
}
} else {
@@ -207,8 +210,10 @@ while($csv = fgetcsv($input, 0, ";")) {
}
$existing_hausnummer->save();
}
continue;
/*
//continue;
// add new units
$existing_units_count = ADBWohneinheitModel::count(['hausnummer_id' => $existing_hausnummer->id]);
if($existing_units_count != $unit_count) {
@@ -216,7 +221,7 @@ while($csv = fgetcsv($input, 0, ";")) {
echo "========================================================================\n";
echo "=============== [".$existing_hausnummer->id."] Need to delete ".($existing_units_count - $unit_count)." units\n";
echo "========================================================================\n";
}*//*
}*/
if($existing_units_count < $unit_count) {
echo "=============== Adding ".($unit_count - $existing_units_count)." units\n";
@@ -254,7 +259,7 @@ while($csv = fgetcsv($input, 0, ";")) {
}
}
*/
//echo "$hausnummer_extref: $adrcd, $netzgebiet_extref, $grund_nr, $unit_count, $gdaeigenschaft\n";
}