Added Lieboch to rimo api import

This commit is contained in:
Frank Schubert
2024-02-28 15:27:42 +01:00
parent 6db1055c6b
commit a0754d8c5d
8 changed files with 103 additions and 12 deletions

View File

@@ -56,7 +56,7 @@
Steuersatz % *
</div>
<div class="col-2 font-weight-medium">
Steuercode *
Steuercode
</div>
<div class="col-3 font-weight-medium">
Rechnungstext

View File

@@ -2,6 +2,7 @@
class ADBNetzgebiet extends mfBaseModel {
private $gemeinden;
private $json_options;
protected function init() {
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
@@ -23,6 +24,27 @@ class ADBNetzgebiet extends mfBaseModel {
return true;
}
public function getOption($opt) {
$options = $this->getOptions();
if(!$options) return null;
if(property_exists($options, $opt)) {
return $options->$opt;
}
return null;
}
public function getOptions() {
if(!$this->options) {
return false;
}
$opts = json_decode($this->options);
if(json_last_error() != JSON_ERROR_NONE) {
return null;
}
return $opts;
}
public function getProperty($name) {
if($this->$name == null) {

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class NetzgebietAddOptions extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
}
if($this->getEnvironment() == "addressdb") {
$table = $this->table("Netzgebiet");
$table->addColumn("options", "json", ["null" => true,"default" => null, "after" => "unit_create_oaid"]);
$table->update();
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
}
if($this->getEnvironment() == "addressdb") {
$this->table("Netzgebiet")->removeColumn("options")->save();
}
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace ADBRimoImport\ADBAddressHelper\Network;
/*
* Netzgebiet
* Premstätten Süd
*/
class Network_C06110 {
public function checkAddress($data) {
/*
* array keys are a reference their original variables and must be manipulated directly
*/
// dererence input array keys into copies
foreach(["name", "strasse_name", "hausnummer_name", "addresszusatz", "gem_kz", "gem_name", "ort_name", "plz_name"] as $var) {
$$var = $data[$var];
}
if($strasse_name == "Hans-Thalhammer-Straße") $strasse_name = "H. Thalhammer-Straße";
if($strasse_name == "Packerstraße") $strasse_name = "Packer Straße";
// put new values back into original pointer
foreach(["name", "strasse_name", "hausnummer_name", "addresszusatz", "gem_kz", "gem_name", "ort_name", "plz_name"] as $var) {
$data[$var] = $$var;
}
return true;
}
}

View File

@@ -272,9 +272,12 @@ class AddressHelper {
// update hausnummer
if($hausnummer->netzgebiet_id != $this->netzgebiet->id) {
$dont_overwrite_netzgbiet = $hausnummer->netzgebiet->getOption("hausnummer_dont_overwrite_netzgebiet");
if(!$dont_overwrite_netzgbiet) {
$hausnummer->netzgebiet_id = $this->netzgebiet->id;
$hausnummer->save();
}
}
if($hausnummer->extref != $name) {
$hausnummer->extref = $name;
$hausnummer->save();

View File

@@ -117,10 +117,10 @@ foreach($netowners as $apiOwner) {
}
/*if($cluster_rimo_id != "SDISalesCluster_85942336257_1707118316") {
// wettmannstaettten
if($cluster_rimo_id != "SDISalesCluster_29189625089_1679036889") {
// lieboch
continue;
}*/
}
/*
* get Cluster Outline Coords

View File

@@ -25,6 +25,9 @@ $campaign_ids["kalwang"] = 41;
$campaign_ids["st_stefan_stainz"] = 36;
$campaign_ids["wettmannst"] = 37;
$campaign_ids["mureck"] = 42;
$campaign_ids["lieboch"] = 35;
$campaign_ids["lieboch_vorab"] = 49;
$campaign_ids["lieboch_smart"] = 39;
if(!array_key_exists(1,$argv)) {
@@ -66,13 +69,11 @@ foreach(PreorderModel::searchActive(["preordercampaign_id" => $selected_campaign
continue;
}
//if($preorder->id == 920) {var_dump($wohneinheiten);exit;}
$available_units = [];
$additional_units = []; // to sort non-specific units last
foreach($wohneinheiten as $unit) {
if($preorder->adb_wohneinheit_id == $unit->id || !PreorderModel::getFirst(["adb_wohneinheit_id" => $unit->id, "deleted" => 0])) {
if($unit->tuer || preg_match('/^Top\s+\d+$/', $unit->zusatz)) {
if($preorder->adb_wohneinheit_id == $unit->id || !PreorderModel::getFirstActive(["adb_wohneinheit_id" => $unit->id])) {
if($unit->tuer || preg_match('/^(Top|Tuer|Tür)\s+\d+$/i', $unit->zusatz)) {
$available_units[] = $unit;
} else {
$additional_units[] = $unit;

View File

@@ -25,6 +25,9 @@ $campaign_ids["kalwang"] = 41;
$campaign_ids["st_stefan_stainz"] = 36;
$campaign_ids["wettmannst"] = 37;
$campaign_ids["mureck"] = 42;
$campaign_ids["lieboch"] = 35;
$campaign_ids["lieboch_vorab"] = 49;
$campaign_ids["lieboch_smart"] = 39;
if(!array_key_exists(1,$argv)) {