Homes update premstaetten nord
This commit is contained in:
@@ -13,7 +13,7 @@ require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
|||||||
|
|
||||||
$me = new User(1);
|
$me = new User(1);
|
||||||
|
|
||||||
$filename = __DIR__."/import/SDIHome__Homes_ PremNord_20230526.csv";
|
$filename = __DIR__."/import/SDIHome__Homes_PremNord_20230609.csv";
|
||||||
|
|
||||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||||
$log = mfLoghandler::singleton();
|
$log = mfLoghandler::singleton();
|
||||||
@@ -115,13 +115,14 @@ while($csv = fgetcsv($input, 0, ";")) {
|
|||||||
|
|
||||||
$wohneinheit = ADBWohneinheitModel::create($wohneinheit_data);
|
$wohneinheit = ADBWohneinheitModel::create($wohneinheit_data);
|
||||||
$wohneinheit->save();
|
$wohneinheit->save();
|
||||||
|
//echo "+ ".$wohneinheit->extref."\n";
|
||||||
} else {
|
} else {
|
||||||
$wohneinheit = ADBWohneinheitModel::getFirst(['hausnummer_id' => $hausnummer->id, "extref" => $wohneinheit_extref]);
|
$wohneinheit = ADBWohneinheitModel::getFirst(['hausnummer_id' => $hausnummer->id, "extref" => $wohneinheit_extref]);
|
||||||
if($wohneinheit) continue; // unit with extref exists so continue
|
if($wohneinheit) continue; // unit with extref exists so continue
|
||||||
|
|
||||||
if($hausnummer_extref == "25012281") {
|
if($hausnummer_extref == "25012281") {
|
||||||
$zusatz = "Haus ".(ceil($num / 12))." Top $num";
|
$zusatz = "Haus ".(ceil($num / 12))." Top $num";
|
||||||
echo "$num: $zusatz\n";
|
//echo "$num: $zusatz\n";
|
||||||
$wohneinheit = ADBWohneinheitModel::getFirst(['hausnummer_id' => $hausnummer->id, "zusatz" => $zusatz]);
|
$wohneinheit = ADBWohneinheitModel::getFirst(['hausnummer_id' => $hausnummer->id, "zusatz" => $zusatz]);
|
||||||
if(!$wohneinheit) {
|
if(!$wohneinheit) {
|
||||||
echo "top not found\n";
|
echo "top not found\n";
|
||||||
@@ -158,6 +159,7 @@ while($csv = fgetcsv($input, 0, ";")) {
|
|||||||
if(!$wohneinheit->extref) {
|
if(!$wohneinheit->extref) {
|
||||||
$wohneinheit->extref = $wohneinheit_extref;
|
$wohneinheit->extref = $wohneinheit_extref;
|
||||||
//var_dump("UPDATE UNIT",$wohneinheit);exit;
|
//var_dump("UPDATE UNIT",$wohneinheit);exit;
|
||||||
|
//echo "u ".$wohneinheit->extref."\n";
|
||||||
$wohneinheit->save();
|
$wohneinheit->save();
|
||||||
//exit;
|
//exit;
|
||||||
}
|
}
|
||||||
@@ -167,6 +169,8 @@ while($csv = fgetcsv($input, 0, ";")) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "\n";
|
||||||
|
|
||||||
function getLastWohneinheit($hausnummer_id) {
|
function getLastWohneinheit($hausnummer_id) {
|
||||||
global $db;
|
global $db;
|
||||||
$sql = "SELECT * FROM Wohneinheit WHERE hausnummer_id = $hausnummer_id ORDER BY num DESC LIMIT 1";
|
$sql = "SELECT * FROM Wohneinheit WHERE hausnummer_id = $hausnummer_id ORDER BY num DESC LIMIT 1";
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user