* Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2026 Eduard Wisch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \defgroup idsconnect Module IDS Connect * \brief IDS Connect Schnittstelle zum Elektrogroßhandel (Kluxen, Sonepar etc.) * * \file htdocs/idsconnect/core/modules/modIdsconnect.class.php * \ingroup idsconnect * \brief Modul-Deskriptor für IDS Connect */ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** * Modul-Deskriptor für IDS Connect */ class modIdsconnect extends DolibarrModules { /** * Constructor. Define names, constants, directories, boxes, permissions * * @param DoliDB $db Database handler */ public function __construct($db) { global $conf, $langs; $this->db = $db; $this->numero = 500025; $this->rights_class = 'idsconnect'; $this->family = "interface"; $this->module_position = '90'; $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "IdsconnectDescription"; $this->descriptionlong = "IdsconnectDescriptionLong"; $this->editor_name = 'Alles Watt laeuft'; $this->editor_url = ''; $this->version = '3.1'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->picto = 'fa-plug'; $this->module_parts = array( 'triggers' => 0, 'login' => 0, 'substitutions' => 0, 'menus' => 0, 'tpl' => 0, 'barcode' => 0, 'models' => 0, 'printing' => 0, 'theme' => 0, 'css' => array( '/idsconnect/css/idsconnect.css', ), 'js' => array(), 'hooks' => array( 'data' => array( 'ordersuppliercard', 'pricesuppliercard', ), 'entity' => '0', ), 'moduleforexternal' => 0, 'websitetemplates' => 0, 'captcha' => 0 ); $this->dirs = array("/idsconnect/temp"); $this->config_page_url = array("setup.php@idsconnect"); $this->hidden = getDolGlobalInt('MODULE_IDSCONNECT_DISABLED'); $this->depends = array('modFournisseur'); $this->requiredby = array(); $this->conflictwith = array(); $this->langfiles = array("idsconnect@idsconnect"); $this->phpmin = array(7, 4); $this->need_dolibarr_version = array(19, -3); $this->need_javascript_ajax = 0; $this->warnings_activation = array(); $this->warnings_activation_ext = array(); // Konstanten - Testmodus ist Standard AN $this->const = array( 1 => array('IDSCONNECT_TESTMODE', 'chaine', '1', 'Testmodus aktiv - keine echten Verbindungen zum Großhandel', 0), 2 => array('IDSCONNECT_LOG_ENABLED', 'chaine', '1', 'Logging aller IDS-Transaktionen', 0), 3 => array('IDSCONNECT_CALLBACK_SECRET', 'chaine', bin2hex(random_bytes(16)), 'Secret für Callback-Token-Generierung', 0), ); if (!isModEnabled("idsconnect")) { $conf->idsconnect = new stdClass(); $conf->idsconnect->enabled = 0; } // Tab in Lieferantenbestellungen $this->tabs = array( 'supplier_order:+idsconnect:IdsConnectTab:idsconnect@idsconnect:$user->hasRight(\'idsconnect\', \'use\'):/idsconnect/tab_supplierorder.php?id=__ID__', ); $this->dictionaries = array(); $this->boxes = array(); $this->cronjobs = array(); // ============================================================ // Berechtigungen // ============================================================ $this->rights = array(); $r = 0; // Lesen - Modul sehen, Logs anschauen $this->rights[$r][0] = $this->numero . '01'; $this->rights[$r][1] = 'IDS Connect Modul sehen und Logs lesen'; $this->rights[$r][4] = 'read'; $this->rights[$r][5] = ''; $r++; // Nutzen - Warenkörbe senden/empfangen, Shop öffnen $this->rights[$r][0] = $this->numero . '02'; $this->rights[$r][1] = 'IDS Connect Schnittstelle nutzen (Warenkörbe, Deep-Links)'; $this->rights[$r][4] = 'use'; $this->rights[$r][5] = ''; $r++; // Konfigurieren - Großhändler verwalten, Zugangsdaten ändern $this->rights[$r][0] = $this->numero . '03'; $this->rights[$r][1] = 'IDS Connect Großhändler und Zugangsdaten verwalten'; $this->rights[$r][4] = 'config'; $this->rights[$r][5] = ''; $r++; // Löschen - Logs und Großhändler löschen $this->rights[$r][0] = $this->numero . '04'; $this->rights[$r][1] = 'IDS Connect Daten löschen'; $this->rights[$r][4] = 'delete'; $this->rights[$r][5] = ''; $r++; // ============================================================ // Menüs - Unter Einkauf/Vertrieb > Lieferantenbestellungen // ============================================================ $this->menu = array(); $r = 0; // IDS Connect Haupteintrag unter Lieferantenbestellungen (Level 1) $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=commercial,fk_leftmenu=orders_suppliers', 'type' => 'left', 'titre' => 'ModuleIdsconnectName', 'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth valignmiddle paddingright"'), 'mainmenu' => 'commercial', 'leftmenu' => 'idsconnect', 'url' => '/idsconnect/idsconnectindex.php', 'langs' => 'idsconnect@idsconnect', 'position' => 500 + $r, 'enabled' => 'isModEnabled("idsconnect")', 'perms' => '$user->hasRight("idsconnect", "read")', 'target' => '', 'user' => 0, ); // Großhändler (Level 2 unter IDS Connect) $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=commercial,fk_leftmenu=idsconnect', 'type' => 'left', 'titre' => 'IdsconnectSuppliers', 'prefix' => img_picto('', 'fa-building', 'class="pictofixedwidth valignmiddle paddingright"'), 'mainmenu' => 'commercial', 'leftmenu' => 'idsconnect_suppliers', 'url' => '/idsconnect/supplier_list.php', 'langs' => 'idsconnect@idsconnect', 'position' => 500 + $r, 'enabled' => 'isModEnabled("idsconnect")', 'perms' => '$user->hasRight("idsconnect", "read")', 'target' => '', 'user' => 0, ); // Großhändler anlegen (Level 3 unter Großhändler) $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=commercial,fk_leftmenu=idsconnect_suppliers', 'type' => 'left', 'titre' => 'IdsconnectNewSupplier', 'mainmenu' => 'commercial', 'leftmenu' => 'idsconnect_supplier_new', 'url' => '/idsconnect/supplier_card.php?action=create', 'langs' => 'idsconnect@idsconnect', 'position' => 500 + $r, 'enabled' => 'isModEnabled("idsconnect")', 'perms' => '$user->hasRight("idsconnect", "config")', 'target' => '', 'user' => 0, ); // Transaktionslog (Level 2 unter IDS Connect) $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=commercial,fk_leftmenu=idsconnect', 'type' => 'left', 'titre' => 'IdsconnectLog', 'prefix' => img_picto('', 'fa-list-alt', 'class="pictofixedwidth valignmiddle paddingright"'), 'mainmenu' => 'commercial', 'leftmenu' => 'idsconnect_log', 'url' => '/idsconnect/log_list.php', 'langs' => 'idsconnect@idsconnect', 'position' => 500 + $r, 'enabled' => 'isModEnabled("idsconnect")', 'perms' => '$user->hasRight("idsconnect", "read")', 'target' => '', 'user' => 0, ); } /** * Modul aktivieren * * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, <=0 if KO */ public function init($options = '') { global $conf, $langs; $result = $this->_load_tables('/idsconnect/sql/'); if ($result < 0) { return -1; } $this->remove($options); $sql = array(); return $this->_init($sql, $options); } /** * Modul deaktivieren * * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, <=0 if KO */ public function remove($options = '') { $sql = array(); return $this->_remove($sql, $options); } }