Fixed not creating OAID in rimo-import when requested
This commit is contained in:
@@ -418,6 +418,10 @@ class AddressHelper
|
||||
$hausnummer->save();
|
||||
}
|
||||
|
||||
if(!$hausnummer->oaid && $this->netzgebiet->unit_create_oaid) {
|
||||
$hausnummer->getNewOAID();
|
||||
}
|
||||
|
||||
|
||||
//echo ">>>>>>>>>>>>>>>>>>>\nupdating hausnummer:\n";
|
||||
//print_r($hausnummer);exit;
|
||||
|
||||
49
scripts/adb-rimo-import/regenerate-missing-unit-oaids.php
Normal file
49
scripts/adb-rimo-import/regenerate-missing-unit-oaids.php
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
//require 'vendor/autoload.php';
|
||||
require("../../config/config.php");
|
||||
|
||||
define('FRONKDB_SQLDEBUG', false);
|
||||
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||
|
||||
require_once(LIBDIR . "/mvcfronk/mfRouter/mfRouter.php");
|
||||
require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseModel.php");
|
||||
require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseController.php");
|
||||
|
||||
$me = new User(1);
|
||||
define("INTERNAL_USER_ID", $me->id);
|
||||
define("INTERNAL_USER_USERNAME", $me->username);
|
||||
define("MFBASE_BYPASS_LOGIN", true);
|
||||
|
||||
$h = 0;
|
||||
$u = 0;
|
||||
|
||||
foreach(ADBNetzgebietModel::getAll() as $netzgebiet) {
|
||||
if(!$netzgebiet->unit_create_oaid) continue;
|
||||
if(!$netzgebiet->rimo_id) continue;
|
||||
|
||||
//echo $netzgebiet->name."\n";continue;
|
||||
|
||||
foreach(ADBHausnummerModel::search(["netzgebiet_id" => $netzgebiet->id]) as $hausnummer) {
|
||||
if(!$hausnummer->oaid) {
|
||||
echo "h ".$hausnummer->id." = ".$hausnummer->oaid."\n";
|
||||
$hausnummer->oaid = $hausnummer->getNewOaid();
|
||||
if(!$hausnummer->save()) die("Error saving hausnummer\n");
|
||||
echo "h ".$hausnummer->id." => ".$hausnummer->oaid."\n";
|
||||
$h++;
|
||||
}
|
||||
foreach($hausnummer->wohneinheiten as $unit) {
|
||||
if(!$unit->oaid) {
|
||||
echo "u ".$unit->id." = ".$unit->oaid."\n";
|
||||
$unit->oaid = $unit->getNewOaid();
|
||||
if(!$unit->save()) die("Error saving unit\n");
|
||||
echo "u ".$unit->id." => ".$unit->oaid."\n";
|
||||
$u++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "Updated $h Buildings and $u Wohneinheiten\n";
|
||||
@@ -20,6 +20,7 @@ $me = new \User(TT_RIMO_IMPORT_USER_ID);
|
||||
|
||||
define("INTERNAL_USER_ID", $me->id);
|
||||
define("INTERNAL_USER_USERNAME", $me->username);
|
||||
define("MFBASE_BYPASS_LOGIN", true);
|
||||
|
||||
$mainlog = \mfLoghandler::singleton();
|
||||
$log = new \mfLog_File();
|
||||
@@ -311,6 +312,12 @@ foreach ($clusters as $cluster_data) {
|
||||
if (!$unit->save()) {
|
||||
die("Error saving new unit\n" . print_r($unit, true));
|
||||
}
|
||||
if(!$unit->oaid && $adb_netzgebiet->unit_create_oaid) {
|
||||
$unit->oaid = $unit->getNewOAID();
|
||||
if(!$unit->save()) {
|
||||
die("Error saving new unit OAID\n" . print_r($unit, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,6 +355,13 @@ foreach ($clusters as $cluster_data) {
|
||||
if (!$unit->save()) {
|
||||
die("Error saving new unit\n" . print_r($home, true));
|
||||
}
|
||||
if(!$unit->oaid && $adb_netzgebiet->unit_create_oaid) {
|
||||
$unit->oaid = $unit->getNewOAID();
|
||||
if(!$unit->save()) {
|
||||
die("Error saving new unit OAID\n" . print_r($unit, true));
|
||||
}
|
||||
}
|
||||
|
||||
$unit = new \ADBWohneinheit($unit->id);
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||
|
||||
Reference in New Issue
Block a user