diff --git a/Abfall_IO/README.md b/Abfall_IO/README.md index 7f5e3a7..ea2805e 100644 --- a/Abfall_IO/README.md +++ b/Abfall_IO/README.md @@ -2,7 +2,7 @@ [![Version](https://img.shields.io/badge/Symcon-PHP--Modul-red.svg?style=flat-square)](https://www.symcon.de/service/dokumentation/entwicklerbereich/sdk-tools/sdk-php/) [![Product](https://img.shields.io/badge/Symcon%20Version-6.4-blue.svg?style=flat-square)](https://www.symcon.de/produkt/) -[![Version](https://img.shields.io/badge/Modul%20Version-2.1.20240304-orange.svg?style=flat-square)](https://github.com/Wilkware/WasteManagement) +[![Version](https://img.shields.io/badge/Modul%20Version-2.2.20240317-orange.svg?style=flat-square)](https://github.com/Wilkware/WasteManagement) [![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-green.svg?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/4.0/) [![Actions](https://img.shields.io/github/actions/workflow/status/wilkware/WasteManagement/style.yml?branch=main&label=CheckStyle&style=flat-square)](https://github.com/Wilkware/WasteManagement/actions) @@ -125,6 +125,10 @@ __Beispiel__: `ABPIO_FixWasteName(12345, 'Hausmüll', 'Hausmüll (2 wöchentlich ### 8. Versionshistorie +v2.2.20240317 + +* _NEU_: Support für (manuelle) Strassensuche + v2.1.20240304 * _FIX_: User-Agent für Datenabruf korrigiert diff --git a/Abfall_IO/module.php b/Abfall_IO/module.php index 511b689..72a619a 100644 --- a/Abfall_IO/module.php +++ b/Abfall_IO/module.php @@ -40,6 +40,7 @@ class Abfall_IO extends IPSModule private const ACTION_CLIENT = 'init'; private const ACTION_PLACE = 'auswahl_kommune_set'; private const ACTION_DISTRICT = 'auswahl_bezirk_set'; + private const ACTION_QUERY = 'auswahl_strasse_qry_set'; private const ACTION_STREET = 'auswahl_strasse_set'; private const ACTION_ADDON = 'auswahl_hnr_set'; private const ACTION_FRACTIONS = 'auswahl_fraktionen_set'; @@ -122,7 +123,7 @@ public function GetConfigurationForm() if ($cId != 'null') { $io[self::IO_CLIENT] = $cId; $options = $this->ExecuteAction($io); - if ($options == null) { + if (($options == null) && ($io[self::IO_ACTION] != self::ACTION_QUERY)) { $next = false; } } else { @@ -131,6 +132,11 @@ public function GetConfigurationForm() } // Place if ($next) { + // Streets? + if ($io[self::IO_ACTION] == self::ACTION_QUERY) { + $options = $this->ExecuteAction($io); + $this->SendDebug(__FUNCTION__, $io); + } // Fix or Dynamic if ($io[self::IO_ACTION] == self::ACTION_PLACE) { if ($options != null) { @@ -162,6 +168,11 @@ public function GetConfigurationForm() } // District if ($next) { + // Streets? + if ($io[self::IO_ACTION] == self::ACTION_QUERY) { + $options = $this->ExecuteAction($io); + $this->SendDebug(__FUNCTION__, $io); + } // Fix or Dynamic if ($io[self::IO_ACTION] == self::ACTION_DISTRICT) { if ($options != null) { @@ -177,7 +188,7 @@ public function GetConfigurationForm() $io[self::IO_DISTRICT] = $dId; // than prepeare the next $options = $this->ExecuteAction($io); - if ($options == null) { + if (($options == null) && ($io[self::IO_ACTION] != self::ACTION_QUERY)) { $this->SendDebug(__FUNCTION__, __LINE__); $next = false; } @@ -193,6 +204,11 @@ public function GetConfigurationForm() } // Street if ($next) { + // Streets? + if ($io[self::IO_ACTION] == self::ACTION_QUERY) { + $options = $this->ExecuteAction($io); + $this->SendDebug(__FUNCTION__, $io); + } // Fix or Dynamic if ($io[self::IO_ACTION] == self::ACTION_STREET) { if ($options != null) { @@ -573,27 +589,35 @@ protected function OnChangeClient($id) if ($id != 'null') { $data = $this->ExecuteAction($io); } + if ($io[self::IO_ACTION] == self::ACTION_QUERY) { + $data = $this->ExecuteAction($io); + $this->SendDebug(__FUNCTION__, $io); + } $this->SendDebug(__FUNCTION__, $io); // Bad fix for cities only!!! if ($io[self::IO_ACTION] == self::ACTION_STREET) { + $this->SendDebug(__FUNCTION__,'Hide place & district'); $this->UpdateFormField('placeID', 'visible', false); $this->UpdateFormField('districtID', 'visible', false); // Fix Options if ($io[self::IO_PLACE] == '') { + $this->SendDebug(__FUNCTION__,'Place == null'); $this->UpdateFormField('placeID', 'value', 'null'); } else { + $this->SendDebug(__FUNCTION__,'Place == ' . $io[self::IO_PLACE]); $options[] = ['caption' => $this->Translate('Please select ...') . str_repeat(' ', 79), 'value' => $io[self::IO_PLACE]]; $this->UpdateFormField('placeID', 'options', json_encode($options)); $this->UpdateFormField('placeID', 'value', $io[self::IO_PLACE]); } if ($io[self::IO_DISTRICT] == '') { - $this->UpdateFormField('placeID', 'value', 'null'); + $this->UpdateFormField('districtID', 'value', 'null'); } else { $options[] = ['caption' => $this->Translate('Please select ...') . str_repeat(' ', 79), 'value' => $io[self::IO_DISTRICT]]; - $this->UpdateFormField('placeID', 'options', json_encode($options)); - $this->UpdateFormField('placeID', 'value', $io[self::IO_DISTRICT]); + $this->UpdateFormField('districtID', 'options', json_encode($options)); + $this->UpdateFormField('districtID', 'value', $io[self::IO_DISTRICT]); } } + $this->SendDebug(__FUNCTION__, $io); // Hide or Unhide properties $this->UpdateForm($io, $data); // Update attribute @@ -614,6 +638,9 @@ protected function OnChangePlace($id) if ($id != 'null') { $data = $this->ExecuteAction($io); } + if ($io[self::IO_ACTION] == self::ACTION_QUERY) { + $data = $this->ExecuteAction($io); + } $this->SendDebug(__FUNCTION__, $io); // Hide or Unhide properties $this->UpdateForm($io, $data); @@ -635,6 +662,9 @@ protected function OnChangeDistrict($id) if ($id != 'null') { $data = $this->ExecuteAction($io); } + if ($io[self::IO_ACTION] == self::ACTION_QUERY) { + $data = $this->ExecuteAction($io); + } // Hide or Unhide properties $this->UpdateForm($io, $data); // Update attribute @@ -996,6 +1026,18 @@ protected function ExecuteAction(&$io) } $this->SendDebug(__FUNCTION__, 'Hidden: ' . $name . ':' . $value); } + $inputs = $res->query("//input[@type='text']"); + foreach($inputs as $input){ + $items = []; + $name = $input->getAttribute('name'); + $action = $input->getAttribute('awk-data-onchange-submit-waction'); + $this->SendDebug(__FUNCTION__, 'Text: ' . $name . ':' . $action); + if ($this->StartsWith($name, 'f_qry')) { + $io[self::IO_ACTION] = $action; + $io[$name] = ''; + return $data; + } + } $divs = $res->query("//div[@class='awk-ui-input-tr']"); if ($divs->length > 0) { $items = [];