diff --git a/Layout/default/Building/Form.php b/Layout/default/Building/Form.php
index 11b7dad89..202b28296 100644
--- a/Layout/default/Building/Form.php
+++ b/Layout/default/Building/Form.php
@@ -300,6 +300,7 @@
$("#network_id").select2({placeholder: ""});
$("#pop_id").select2({placeholder: "", allowClear: true,});
$("#type_id").select2({placeholder: ""});
+ $("#networksection_id").select2({placeholder: "", allowClear: true,});
// disable mousewheel on input number field when in focus
$('form').on('focus', 'input[type=number]', function (e) {
@@ -325,14 +326,18 @@
function(success) {
if(success.status == "OK") {
//console.log(success);
- pops = success.result.pops;
+ var pops = success.result.pops;
if(typeof pops !== 'object' || pops === null) {
return true;
}
+ var selected = $("#pop_id option:selected").val();
$("#pop_id option:gt(0)").remove();
for(var pop_id in pops) {
$("#pop_id").append($("").attr("value", pop_id).text(pops[pop_id]));
}
+ if(selected) {
+ $("#pop_id").val(selected);
+ }
}
},
'json'
@@ -352,13 +357,18 @@
},
function(success) {
if(success.status == "OK") {
- sections = success.result.sections;
+ var sections = success.result.sections;
if(typeof sections !== 'object' || sections === null) {
return true;
}
+ var selected = $("#networksection_id option:selected").val();
$("#networksection_id option:gt(0)").remove();
for(var section_id in sections) {
- $("#networksection_id").append($("").attr("value", pop_id).text(sections[section_id]));
+ $("#networksection_id").append($("").attr("value", section_id).text(sections[section_id]));
+ }
+ console.log("selected: " + selected);
+ if(selected) {
+ $("#networksection_id").val(selected);
}
}
},
@@ -387,11 +397,15 @@
return true;
}
types.forEach(function(type) {
+ var selected = $("#" + type + "_id option:selected").val();
$("#" + type + "_id").empty();
$("#" + type + "_id").append($(""));
for(var perm_id in perms[type]) {
$("#" + type + "_id").append($("").attr("value", perm_id).text(perms[type][perm_id]));
}
+ if(selected) {
+ $("#" + type + "_id").val(selected);
+ }
});
}
},
diff --git a/application/Building/BuildingController.php b/application/Building/BuildingController.php
index 2efac4e0f..ce9b7d7ab 100644
--- a/application/Building/BuildingController.php
+++ b/application/Building/BuildingController.php
@@ -74,6 +74,7 @@ class BuildingController extends mfBaseController {
$data['status_id'] = ($r->status_id) ? $r->status_id : null;
$data['pipeworker_id'] = ($r->pipeworker_id) ? $r->pipeworker_id : null;
$data['lineworker_id'] = ($r->lineworker_id) ? $r->lineworker_id : null;
+ $data['networksection_id'] = ($r->networksection_id) ? $r->networksection_id : null;
$data['oan_id'] = $r->oan_id;
$data['street'] = $r->street;
@@ -105,7 +106,6 @@ class BuildingController extends mfBaseController {
}
//var_dump($address);exit;
-
$new_id = $building->save();
if(!$new_id) {
$this->layout()->setFlash("Fehler beim Speichern", "error");
diff --git a/application/Building/BuildingModel.php b/application/Building/BuildingModel.php
index ebfe5c518..d04f9a2f3 100644
--- a/application/Building/BuildingModel.php
+++ b/application/Building/BuildingModel.php
@@ -6,6 +6,8 @@ class BuildingModel {
public $type_id = null;
public $status_id = null;
public $pipeworker_id = null;
+ public $lineworker_id = null;
+ public $networksection_id = null;
public $code = null;
public $oan_id = null;
public $street = null;
@@ -13,6 +15,7 @@ class BuildingModel {
public $city = null;
public $gps_lat = null;
public $gps_long = null;
+ public $laea = null;
public $contact = null;
public $phone = null;
public $email = null;