Skip to content

Commit

Permalink
Update v2.2.20240317
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilkware committed Mar 17, 2024
1 parent ba8faf1 commit bef7753
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Abfall_IO/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
52 changes: 47 additions & 5 deletions Abfall_IO/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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 = [];
Expand Down

0 comments on commit bef7753

Please sign in to comment.