Merge branch 'fronkdev' into 'master'
Rimo Status also update sets status when input params higher then See merge request fronk/thetool!525
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
<div class="col-12">
|
||||
<ul class="nav nav-tabs order-tab">
|
||||
<li class="nav-item"><a class="nav-link active" href="#preorder-detail-<?=$preorder->id?>-detail" data-toggle="tab" aria-expanded="false">Bestellung</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-flags" data-toggle="tab" aria-expanded="false">Status</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-address" data-toggle="tab" aria-expanded="false">Adressdetails</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-flags" data-toggle="tab" aria-expanded="false">Status</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-rimo" data-toggle="tab" aria-expanded="false">RIMO</a></li>
|
||||
<?php if($me->is("Admin") && $preorder->adb_hausnummer->borderpoint_lat && $preorder->adb_hausnummer->borderpoint_long): ?>
|
||||
<li class="nav-item"><a class="nav-link" href="#preorder-detail-<?=$preorder->id?>-map" data-toggle="tab" aria-expanded="false" onclick="loadBorderpointMap(<?=$preorder->id?>)">Übergabepunkt</a></li>
|
||||
@@ -501,7 +501,7 @@
|
||||
<?=(array_key_exists($flag->id, $preorder->statusflags) && $preorder->statusflags[$flag->id]->value && $preorder->statusflags[$flag->id]->value->value) ? "checked='checked'" : ""?>
|
||||
/>
|
||||
</th>
|
||||
<td class="text-monospace align-middle" id="preorder-<?=$preorder->id?>-statusflag-<?=$flag->id?>-text"><?=$preorder->statusflags[$flag->id]->code?> - <?=$preorder->statusflags[$flag->id]->name?></td>
|
||||
<td class="text-monospace align-middle" id="preorder-<?=$preorder->id?>-statusflag-<?=$flag->id?>-text"><?=$preorder->statusflags[$flag->id]->name?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
@@ -554,7 +554,7 @@
|
||||
<tr>
|
||||
<td><?=date("d.m.Y H:i:s", $history->create)?></td>
|
||||
<td><?=$history->creator->name?></td>
|
||||
<td><?=$history->key?></td>
|
||||
<td><?=$history->getKey()?></td>
|
||||
<td><?=$history->getText("old")?></td>
|
||||
<td><?=$history->getText("new")?></td>
|
||||
</tr>
|
||||
|
||||
@@ -105,14 +105,28 @@ class AddressDB {
|
||||
|
||||
$order_type = $preorder->type;
|
||||
|
||||
foreach(TT_PREORDER_RIMO_STATUS_MATRIX as $matrix) {
|
||||
//echo "wohneinheit ".$wohneinheit->id."\n";
|
||||
//var_dump($matrix);
|
||||
if($matrix["rbop"] && $matrix["rbop"] != $b_op_state) continue;
|
||||
if($matrix["rbex"] && $matrix["rbex"] != $b_ex_state) continue;
|
||||
$status_matrix = array_reverse(TT_PREORDER_RIMO_STATUS_MATRIX);
|
||||
|
||||
if($matrix["rhop"] && $matrix["rhop"] != $h_op_state) continue;
|
||||
if($matrix["rhex"] && $matrix["rhex"] != $h_ex_state) continue;
|
||||
|
||||
foreach($status_matrix as $matrix) {
|
||||
//var_dump($matrix);
|
||||
if($matrix["rbop"]) {
|
||||
if(!is_array($matrix["rbop"])) $matrix["rbop"] = [$matrix["rbop"]];
|
||||
if(!in_array($b_op_state, $matrix["rbop"])) continue;
|
||||
}
|
||||
if($matrix["rbex"] && $matrix["rbex"] != $b_ex_state) {
|
||||
if(!is_array($matrix["rbex"])) $matrix["rbex"] = [$matrix["rbex"]];
|
||||
if(!in_array($b_ex_state, $matrix["rbex"])) continue;
|
||||
};
|
||||
|
||||
if($matrix["rhop"] && $matrix["rhop"] != $h_op_state) {
|
||||
if(!is_array($matrix["rhop"])) $matrix["rhop"] = [$matrix["rhop"]];
|
||||
if(!in_array($h_op_state, $matrix["rhop"])) continue;
|
||||
};
|
||||
if($matrix["rhex"] && $matrix["rhex"] != $h_ex_state) {
|
||||
if(!is_array($matrix["rhex"])) $matrix["rhex"] = [$matrix["rhex"]];
|
||||
if(!in_array($h_ex_state, $matrix["rhex"])) continue;
|
||||
};
|
||||
|
||||
if($matrix["rwo"] && (!$workorder || $matrix["rwo"] != $wo_state)) continue;
|
||||
|
||||
@@ -132,17 +146,28 @@ class AddressDB {
|
||||
$hausnummer_status = $matrix["h"];
|
||||
if($hausnummer_status) {
|
||||
$log->debug(__METHOD__.": new Hausnummer (".$hausnummer->id.") status: ".$matrix["h"]);
|
||||
$old_status = $hausnummer->status_id;
|
||||
$hausnummer->setNewStatusCode($hausnummer_status);
|
||||
$hausnummer->save();
|
||||
if($hausnummer->status_id != $old_status) {
|
||||
$hausnummer->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$wohneinheit = new ADBWohneinheit($wohneinheit->id);
|
||||
|
||||
$wohneinheit_status = $matrix["w"];
|
||||
if($wohneinheit_status) {
|
||||
$log->debug(__METHOD__.": new Wohneinheit (".$wohneinheit->id.") status: ".$matrix["w"]);
|
||||
$old_status_id = $wohneinheit->status_id;
|
||||
$wohneinheit->setNewStatusCode($wohneinheit_status);
|
||||
$wohneinheit->save();
|
||||
if($wohneinheit->status_id != $old_status_id) {
|
||||
$wohneinheit->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,23 @@ class PreorderHistory extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getKey() {
|
||||
$key = $this->key;
|
||||
|
||||
if(preg_match('/^preorderstatusflag-(\d+)-/', $key, $m)) {
|
||||
if(array_key_exists(1, $m)) {
|
||||
$id = $m[1];
|
||||
$psf = new Preorderstatusflag($id);
|
||||
return "Status Flag ".$psf->name;
|
||||
}
|
||||
}
|
||||
return $key;
|
||||
}
|
||||
|
||||
public function getText($type = "new") {
|
||||
$value = $this->getValue($type);
|
||||
if($value === null) return "";
|
||||
|
||||
@@ -10,6 +10,12 @@ class PreorderStatusflag extends mfBaseModel {
|
||||
if($name == "value") {
|
||||
if(!$this->preorder_id) return null;
|
||||
$value = PreorderStatusflagValueModel::getFirst(["preorder_id" => $this->preorder_id, "flag_id" => $this->id]);
|
||||
if(!$value) {
|
||||
$value = PreorderStatusflagValueModel::create([
|
||||
"preorder_id" => $this->preorder_id,
|
||||
"flag_id" => $this->id
|
||||
]);
|
||||
}
|
||||
$this->value = $value;
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
@@ -2,4 +2,15 @@
|
||||
|
||||
class PreorderStatusflagValue extends mfBaseModel {
|
||||
|
||||
protected function afterSave() {
|
||||
if($this->_old_data->value != $this->value) {
|
||||
$history = PreorderHistoryModel::create([
|
||||
"preorder_id" => $this->preorder_id,
|
||||
"key" => "preorderstatusflag-".$this->flag_id."-value",
|
||||
"old_value" => $this->_old_data->value,
|
||||
"new_value" => $this->data->value
|
||||
]);
|
||||
$history->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,6 +221,7 @@ foreach ($clusters as $cluster_data) {
|
||||
continue;
|
||||
}*/
|
||||
$hausnummer_count++;
|
||||
if($hausnummer_count < 300) continue;
|
||||
|
||||
/*
|
||||
// ignore buildings without units
|
||||
@@ -247,30 +248,34 @@ foreach ($clusters as $cluster_data) {
|
||||
/*
|
||||
* Set Building Status based on Operational-/Executionstate
|
||||
*/
|
||||
$b_executionstate_id = $building->executionState->name;
|
||||
$b_executionstate_label = $building->executionState->userLabel;
|
||||
$b_operationalstate_id = $building->operationalState->name;
|
||||
$b_operationalstate_label = $building->operationalState->userLabel;
|
||||
|
||||
if($b_executionstate_label != $hausnummer->rimo_ex_state) {
|
||||
$hausnummer->rimo_ex_state = $b_executionstate_label;
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
if($b_operationalstate_label != $hausnummer->rimo_op_state) {
|
||||
$hausnummer->rimo_op_state = $b_operationalstate_label;
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
if(is_object($building->executionState) && property_exists($building->executionState, "userLabel")) {
|
||||
$b_executionstate_id = $building->executionState->name;
|
||||
$b_executionstate_label = $building->executionState->userLabel;
|
||||
$b_operationalstate_id = $building->operationalState->name;
|
||||
$b_operationalstate_label = $building->operationalState->userLabel;
|
||||
|
||||
if($b_executionstate_label != $hausnummer->rimo_ex_state) {
|
||||
$hausnummer->rimo_ex_state = $b_executionstate_label;
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
if($b_operationalstate_label != $hausnummer->rimo_op_state) {
|
||||
$hausnummer->rimo_op_state = $b_operationalstate_label;
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
if($b_executionstate_id == "99" && $hausnummer->visibility != "private") {
|
||||
echo "== Setting visibility to private because execution state $b_executionstate_id ($b_executionstate_label) [".$hausnummer->id."]\n";
|
||||
$hausnummer->visibility = "private";
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
}
|
||||
|
||||
if($b_executionstate_id == "99" && $hausnummer->visibility != "private") {
|
||||
echo "== Setting visibility to private because execution state $b_executionstate_id ($b_executionstate_label) [".$hausnummer->id."]\n";
|
||||
$hausnummer->visibility = "private";
|
||||
$hausnummer->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
}
|
||||
|
||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||
|
||||
$last_unit_num = 0;
|
||||
$existing_units = [];
|
||||
@@ -332,15 +337,19 @@ foreach ($clusters as $cluster_data) {
|
||||
if (!$unit->save()) {
|
||||
die("Error saving new unit\n" . print_r($home, 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);
|
||||
}
|
||||
|
||||
$unit = new \ADBWohneinheit($unit->id);
|
||||
|
||||
if ($unit->extref != $home_rimo_id) {
|
||||
$unit->extref = $home_rimo_id;
|
||||
if (!$unit->save()) {
|
||||
die("Error saving new extref on unit\n" . print_r($home, 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);
|
||||
}
|
||||
@@ -353,6 +362,7 @@ foreach ($clusters as $cluster_data) {
|
||||
$unit->rimo_ex_state = $home->executionState->userLabel;
|
||||
$unit->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
$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);
|
||||
}
|
||||
@@ -360,6 +370,7 @@ foreach ($clusters as $cluster_data) {
|
||||
$unit->rimo_op_state = $home->operationalState->userLabel;
|
||||
$unit->save();
|
||||
$hausnummer = new \ADBHausnummer($hausnummer_id);
|
||||
$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