Added scripts to update units and split preorders with connection_count
> 1
This commit is contained in:
@@ -75,7 +75,15 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
$bcode = $this->getProperty("hausnummer")->oaid;
|
||||
//var_dump($bcode);
|
||||
if(!$bcode) {
|
||||
return false;
|
||||
$hausnummer = $this->getProperty("hausnummer");
|
||||
$hausnummer->oaid = $hausnummer->getNewOAID();
|
||||
if(!$hausnummer->oaid) {
|
||||
return false;
|
||||
}
|
||||
if(!$hausnummer->save()) {
|
||||
return false;
|
||||
}
|
||||
$bcode = $hausnummer->oaid;
|
||||
}
|
||||
|
||||
$codes = [];
|
||||
|
||||
@@ -581,6 +581,7 @@ class AddressDBController extends mfBaseController {
|
||||
foreach($units as $unit) {
|
||||
$u = [];
|
||||
$u['id'] = $unit->id;
|
||||
$u['extref'] = $unit->extref;
|
||||
$u['zip'] = $unit->hausnummer->plz->plzstring;
|
||||
$u['city'] = $unit->hausnummer->ortschaft->name;
|
||||
$u['street'] = $unit->hausnummer->strasse->name;
|
||||
|
||||
@@ -414,7 +414,7 @@ class BuildingController extends mfBaseController {
|
||||
if($term->status->code >= TT_TERMSTATUS_CONNECTED) {
|
||||
$building_term['status'] = "connected";
|
||||
$data->status = "connected";
|
||||
} elseif($building->status->code == TT_BUILDINGSTATUS_CONNECTED) {
|
||||
} elseif($building->status->code >= TT_BUILDINGSTATUS_CONNECTED) {
|
||||
$building_term['status'] = "pipework-done";
|
||||
if($data->status != "connected") $data->status = "pipework-done";
|
||||
}
|
||||
|
||||
@@ -228,4 +228,35 @@ class Preorder extends mfBaseModel {
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
public function __clone() {
|
||||
$me = new User;
|
||||
$me->loadMe();
|
||||
|
||||
$old_id = $this->id;
|
||||
//$old_ucode = $this->ucode;
|
||||
$this->id = null;
|
||||
|
||||
$this->data = clone($this->data);
|
||||
$this->_old_data = new StdClass();
|
||||
|
||||
$this->status = null;
|
||||
$this->campaign = null;
|
||||
$this->partner = null;
|
||||
$this->building = null;
|
||||
$this->adb_hausnummer = null;
|
||||
$this->adb_wohneinheit;
|
||||
|
||||
// cleanup Preorder data
|
||||
$this->create_by = $me->id;
|
||||
$this->edit_by = $me->id;
|
||||
|
||||
$this->create = null;
|
||||
$this->edit = null;
|
||||
$this->saved = 0;
|
||||
$this->mode = "new";
|
||||
|
||||
//$this->save();
|
||||
$this->log->debug("Cloned Preorder $old_id");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user