Fixed not creating OAID in rimo-import when requested
This commit is contained in:
@@ -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";
|
||||
Reference in New Issue
Block a user