diff --git a/Layout/default/AddressDB/export.csv.php b/Layout/default/AddressDB/export.csv.php
index a675dfeac..34612b658 100644
--- a/Layout/default/AddressDB/export.csv.php
+++ b/Layout/default/AddressDB/export.csv.php
@@ -3,7 +3,7 @@ ob_end_flush();
header("Content-type: text/csv");
header('Content-disposition: attachment; filename="addressdb-export-'.date('Y-m-d_H-i-s').'.csv"');
?>
-AddressDB_ID;Extref;Adrcd;OAID;Netzgebiet_Extref;Netzgebiet;GKZ;Gemeinde;OKZ;Ortschaft;PLZ;SKZ;Strasse;Hausnummer;Grundstueck;GPS Breite; GPS Laenge;Rollout;Rollout_Info;Freigabe;Nutzungseinheiten;GDA-Eingenschaft;Meridian;RW;HW
+AddressDB_ID;Extref;Adrcd;OAID;Netzgebiet_Extref;Netzgebiet;GKZ;Gemeinde;OKZ;Ortschaft;PLZ;SKZ;Strasse;Hausnummer;Grundstueck;GPS Breite; GPS Laenge;Rollout;Rollout_Info;Freigabe;Nutzungseinheiten;GDA-Eigenschaft;Meridian;RW;HW
Kunde
Kontakt |
Partner |
- Anschluss |
+ Attribute |
Erstellt |
Zuletzt bearbeitet |
|
@@ -173,7 +173,10 @@
=($preorder->partner_id) ? $preorder->partner->getCompanyOrName() : ""?> |
- =($preorder->termination) ? $preorder->termination->code : ""?> |
+
+
+
+ |
=date('d.m.Y H:i', $preorder->create)?> |
=date('d.m.Y H:i', $preorder->edit)?> |
@@ -195,7 +198,56 @@
diff --git a/application/Preorder/Preorder.php b/application/Preorder/Preorder.php
index e9166f195..ea09c7b98 100644
--- a/application/Preorder/Preorder.php
+++ b/application/Preorder/Preorder.php
@@ -8,6 +8,7 @@ class Preorder extends mfBaseModel {
private $building;
private $adb_hausnummer;
private $adb_wohneinheit;
+ private $attribute = [];
public function afterLoad() {
@@ -184,6 +185,14 @@ class Preorder extends mfBaseModel {
}
+ if($name == "attribute") {
+ if(!$this->attributes) {
+ return null;
+ }
+ $this->attribute = json_decode($this->attributes, true);
+ return $this->attribute;
+ }
+
if($name == "creator") {
$user = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
if($user) {
diff --git a/application/Preorder/PreorderController.php b/application/Preorder/PreorderController.php
index a68a8af94..64530d74e 100644
--- a/application/Preorder/PreorderController.php
+++ b/application/Preorder/PreorderController.php
@@ -126,6 +126,9 @@ class PreorderController extends mfBaseController {
}
}
+ if(array_key_exists("attributes", $filter) && count($filter['attributes'])) {
+
+ }
if(is_array($filter) && count($filter)) {
foreach($filter as $name => $value) {
@@ -586,4 +589,60 @@ class PreorderController extends mfBaseController {
}
+ protected function apiAction() {
+ if(!$this->me->is(["Admin","netowner","salespartner"])) {
+ $this->redirect("Dashboard");
+ }
+ $do = $this->request->do;
+ $data = [];
+
+ switch($do) {
+ case "saveAttribute":
+ $return = $this->saveAttributeApi();
+ break;
+ default:
+ $return = false;
+ }
+
+ if(!is_array($return) || !count($return)) {
+ $data = ["status" => "error"];
+ $this->returnJson($data);
+ }
+ $data['status'] = "OK";
+ $data['result'] = $return;
+ $this->returnJson($data);
+ }
+
+ private function saveAttributeApi() {
+ $preorder_id = $this->request->id;
+ if(!is_numeric($preorder_id) || $preorder_id < 1) {
+ return false;
+ }
+
+ $preorder = new Preorder($preorder_id);
+ if(!$preorder->id) {
+ return false;
+ }
+
+ $attribute = $this->request->attribute;
+ if(!$attribute) {
+ return false;
+ }
+
+ $value = $this->request->value;
+ $attribs = $preorder->attribute;
+ if(!$attribs) {
+ $attribs = [];
+ }
+
+ $attribs[$attribute] = $value ? 1 : 0;
+ $preorder->attributes = json_encode($attribs);
+ if($preorder->save()) {
+ return ["id" => $preorder_id, "attribute" => $attribute];
+ } else {
+ $this->returnJson(["status" => "error", "result" => ["id" => $preorder_id, "attribute" => $attribute]]);
+ }
+
+ }
+
}
\ No newline at end of file
diff --git a/application/Preorder/PreorderModel.php b/application/Preorder/PreorderModel.php
index e3be6cf84..f22b93bab 100644
--- a/application/Preorder/PreorderModel.php
+++ b/application/Preorder/PreorderModel.php
@@ -51,6 +51,7 @@ class PreorderModel {
public $shipping_address;
public $addon_services;
public $addon_data;
+ public $attributes;
public $submit_type;
public $submit_request;
@@ -442,6 +443,22 @@ class PreorderModel {
}
}
+ if(array_key_exists("attributes", $filter)) {
+ $attributes = FronkDB::singleton()->escape($filter['attributes']);
+ if(is_array($attributes) && count($attributes)) {
+ if(array_key_exists("bep_specified", $attributes)) {
+ if($attributes['bep_specified']) {
+ $where .= " AND JSON_EXTRACT(attributes, \"$.bep_specified\") = 1";
+ }
+ }
+ if(array_key_exists("inhouse_cabling_supplied", $attributes)) {
+ if($attributes['inhouse_cabling_supplied']) {
+ $where .= " AND JSON_EXTRACT(attributes, \"$.inhouse_cabling_supplied\") = 1";
+ }
+ }
+ }
+ }
+
// custom where clause
if(array_key_exists("add-where", $filter)) {
$where .= " ".$filter['add-where'];
|