From a2a902ffa58011e0de07304d018cd2a19ed0a2de Mon Sep 17 00:00:00 2001 From: CyberVitexus Date: Tue, 14 Jan 2025 22:39:03 +0100 Subject: [PATCH] Configuration Update ApiClient improved --- .../discomp2abraflexi.multiflexi.app.json | 30 +++++++++++++++---- src/Discomp/ApiClient.php | 4 +-- src/discomp2abraflexi.php | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/multiflexi/discomp2abraflexi.multiflexi.app.json b/multiflexi/discomp2abraflexi.multiflexi.app.json index 6421d29..6221791 100644 --- a/multiflexi/discomp2abraflexi.multiflexi.app.json +++ b/multiflexi/discomp2abraflexi.multiflexi.app.json @@ -41,31 +41,49 @@ "description": "Intial storage Code", "defval": "SKLAD", "required": false - }, + }, "ABRAFLEXI_DISCOMP_CODE": { "type": "string", "description": "Discomp Addressbook Code", "defval": "DISCOMP", "required": false - }, + }, "DISCOMP_USERNAME": { "type": "string", "description": "Your Discomp username", "defval": "", "required": true - }, + }, "DISCOMP_PASSWORD": { "type": "password", "description": "Your Discomp password", "defval": "", "required": true - }, + }, "DISCOMP_TYP_ZASOBY": { "type": "string", "description": "Intial storage Code", "defval": "typZasoby.material", "required": false - } + }, + "DISCOMP_API_DEBUG": { + "type": "checkbox", + "description": "Show API debug messages", + "defval": "False", + "required": false + }, + "APP_DEBUG": { + "type": "checkbox", + "description": "Show debug messages", + "defval": "False", + "required": false + }, + "EASE_LOGGER": { + "type": "string", + "description": "Logger type", + "defval": "syslog|console", + "required": false + } }, - "multiflexi": "1.7.2" + "multiflexi": "1.20" } diff --git a/src/Discomp/ApiClient.php b/src/Discomp/ApiClient.php index 5ef2446..e56dee2 100644 --- a/src/Discomp/ApiClient.php +++ b/src/Discomp/ApiClient.php @@ -90,13 +90,13 @@ public function __construct($username = '', $password = '') { $this->apiUsername = \strlen($username) ? $username : \Ease\Shared::cfg('DISCOMP_USERNAME'); $this->apiPassword = \strlen($password) ? $password : \Ease\Shared::cfg('DISCOMP_PASSWORD'); - $this->debug = \Ease\Shared::cfg('DISCOMP_API_DEBUG', false); + $this->debug = strtolower((string) \Ease\Shared::cfg('DISCOMP_API_DEBUG', false)) === 'True'; $this->curlInit(); $this->setObjectName(); } /** - * Close Curl Handle before serizaliation. + * Close Curl Handle before serialization. */ public function __destruct() { diff --git a/src/discomp2abraflexi.php b/src/discomp2abraflexi.php index c17504d..fcbfb88 100644 --- a/src/discomp2abraflexi.php +++ b/src/discomp2abraflexi.php @@ -40,7 +40,7 @@ $importer = new Discomp\Importer(); try { - if (\Ease\Shared::cfg('DISCOMP_SCOPE') === 'all') { + if (\Ease\Shared::cfg('DISCOMP_SCOPE', false) === 'all') { $importer->allTimeItems(); } else { $importer->freshItems();