commit 3f3637926539adbab288a9baf3d47c3dd8a96e67 Author: Eduard Wisch Date: Mon Apr 13 18:23:46 2026 +0200 feat: Dolibarr-Modul Eplan — Initial [deploy] Verknüpfung zur ElektroPlan PWA (Raumaufmaß mit Bluetooth-Laser). - Setup-Seite mit PWA-URL + großem Öffnen-Button - Menü-Eintrag unter Werkzeuge - Modul-Nr. 500037, Rechte: read + admin - Lang: de_DE + en_US Co-Authored-By: Claude Opus 4.6 (1M context) diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..04fbec7 --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,59 @@ +name: Deploy Eplan + +on: + push: + tags: + - 'v*' + branches: + - main + +jobs: + deploy: + runs-on: docker + if: startsWith(github.ref, 'refs/tags/v') || contains(github.event.head_commit.message, '[deploy]') + steps: + - name: Notify Start + uses: data/ntfy-action@main + with: + url: https://notify.data-it-solution.de + topic: vk-builds + auth: ${{ secrets.NTFY_AUTH }} + project: Eplan + status: start + + - name: Checkout + run: | + git clone --depth 1 --branch "${GITHUB_REF_NAME}" \ + "https://token:${{ secrets.GIT_TOKEN }}@git.data-it-solution.de/${GITHUB_REPOSITORY}.git" . + + - name: Deploy nach Prod + run: | + ZIEL="/mnt/appdata/firma/dolibarr-202509/modules/eplan" + mkdir -p "$ZIEL"/{core/modules,admin,langs/de_DE,langs/en_US,lib} + cp core/modules/modEplan.class.php "$ZIEL/core/modules/" + cp admin/setup.php "$ZIEL/admin/" + cp lib/eplan.lib.php "$ZIEL/lib/" + cp langs/de_DE/eplan.lang "$ZIEL/langs/de_DE/" + cp langs/en_US/eplan.lang "$ZIEL/langs/en_US/" + echo "Deployt nach $ZIEL" + ls -la "$ZIEL/core/modules/" + + - name: Notify Success + if: success() + uses: data/ntfy-action@main + with: + url: https://notify.data-it-solution.de + topic: vk-builds + auth: ${{ secrets.NTFY_AUTH }} + project: Eplan + status: success + + - name: Notify Failure + if: failure() + uses: data/ntfy-action@main + with: + url: https://notify.data-it-solution.de + topic: vk-builds + auth: ${{ secrets.NTFY_AUTH }} + project: Eplan + status: failure diff --git a/admin/setup.php b/admin/setup.php new file mode 100644 index 0000000..755faf7 --- /dev/null +++ b/admin/setup.php @@ -0,0 +1,92 @@ + + * GPL v3+ + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once __DIR__.'/../lib/eplan.lib.php'; + +$langs->loadLangs(array('admin', 'eplan@eplan')); + +if (!$user->admin && !$user->hasRight('eplan', 'admin')) { + accessforbidden(); +} + +$action = GETPOST('action', 'aZ09'); + +if ($action == 'save' && $user->admin) { + $pwa_url = GETPOST('EPLAN_PWA_URL', 'alpha'); + $pwa_url = rtrim($pwa_url, '/'); + dolibarr_set_const($db, 'EPLAN_PWA_URL', $pwa_url, 'chaine', 0, '', $conf->entity); + setEventMessages($langs->trans("EplanSettingsSaved"), null, 'mesgs'); + header("Location: ".$_SERVER['PHP_SELF']); + exit; +} + +$page_name = "EplanSetup"; +llxHeader('', $langs->trans($page_name), '', '', 0, 0, '', '', '', 'mod-eplan page-admin-setup'); + +$head = eplanAdminPrepareHead(); +print dol_get_fiche_head($head, 'settings', $langs->trans("EplanSetup"), -1, 'fa-drafting-compass'); + +$pwa_url = getDolGlobalString('EPLAN_PWA_URL'); + +print '
'; + +if (!empty($pwa_url)) { + print '
'; + print '
'; + print '
'; + print '

ElektroPlan

'; + print '

'.$langs->trans("EplanOpenPwaDesc").'

'; + print '

'.$langs->trans("EplanInstallHint").'

'; + print '
'; + print ''; + print '
'; + print '
'; +} else { + print '
'; + print ' '; + print $langs->trans("EplanNotConfigured"); + print '
'; +} + +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; +print ''.$langs->trans("EplanPwaUrl").''; +print '
'.$langs->trans("EplanPwaUrlDesc").''; +print '
'; +print ''; +print '
'; +print '
'; +print ''; +print '
'; +print '
'; + +print '
'; +print ''; +print ''; +print ''; +print ''; +for ($i = 1; $i <= 5; $i++) { + print ''; +} +print '
'.$langs->trans("EplanAbout").'
'.$langs->trans("EplanAboutText").'
'.$langs->trans("EplanFeatures").'
'; + print $langs->trans("EplanFeature".$i).'
'; + +print dol_get_fiche_end(); +llxFooter(); +$db->close(); diff --git a/core/modules/modEplan.class.php b/core/modules/modEplan.class.php new file mode 100644 index 0000000..7a22f93 --- /dev/null +++ b/core/modules/modEplan.class.php @@ -0,0 +1,120 @@ + + * GPL v3+ — siehe COPYING + */ + +/** + * \defgroup eplan Module Eplan + * \brief Verknüpfung zu ElektroPlan PWA — Raumaufmaß mit Bluetooth-Laser + * \file htdocs/eplan/core/modules/modEplan.class.php + */ +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; + +class modEplan extends DolibarrModules +{ + public function __construct($db) + { + global $conf, $langs; + $this->db = $db; + + $this->numero = 500037; + $this->rights_class = 'eplan'; + $this->family = "other"; + $this->module_position = '91'; + $this->name = preg_replace('/^mod/i', '', get_class($this)); + $this->description = "Verknüpfung zur ElektroPlan PWA — Raumaufmaß mit Bluetooth-Laser direkt aus Dolibarr."; + $this->descriptionlong = "Stellt einen Link zur ElektroPlan PWA im Admin-Menü bereit. Die PWA ermöglicht mobiles Raumaufmaß mit Finger-Skizze und Bosch GLM Bluetooth-Laser. Grundrisse können als PDF an Aufträge angehängt werden."; + + $this->editor_name = 'Alles Watt läuft'; + $this->editor_url = ''; + $this->version = '1.0.0'; + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + $this->picto = 'fa-drafting-compass'; + + $this->module_parts = array( + 'triggers' => 0, + 'login' => 0, + 'substitutions' => 0, + 'menus' => 0, + 'tpl' => 0, + 'barcode' => 0, + 'models' => 0, + 'printing' => 0, + 'theme' => 0, + 'css' => array(), + 'js' => array(), + 'hooks' => array(), + 'moduleforexternal' => 0, + ); + + $this->dirs = array(); + + // Admin-Setup-Seite + $this->config_page_url = array("setup.php@eplan"); + + $this->hidden = false; + $this->depends = array(); + $this->requiredby = array(); + $this->conflictwith = array(); + $this->langfiles = array("eplan@eplan"); + $this->phpmin = array(7, 4); + $this->need_dolibarr_version = array(19, 0); + $this->need_javascript_ajax = 0; + + // Konstanten + $this->const = array( + 0 => array('EPLAN_PWA_URL', 'chaine', '', 'URL zur ElektroPlan PWA', 0, 'current', 0), + ); + + // Rechte + $this->rights = array(); + $r = 0; + + $this->rights[$r][0] = $this->numero + 0; // 500037 + $this->rights[$r][1] = 'ElektroPlan PWA öffnen'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'read'; + $r++; + + $this->rights[$r][0] = $this->numero + 1; // 500038 + $this->rights[$r][1] = 'ElektroPlan Einstellungen verwalten'; + $this->rights[$r][2] = 'a'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'admin'; + $r++; + + // Menü-Einträge + $this->menu = array(); + $r = 0; + + $this->menu[$r] = array( + 'fk_menu' => 'fk_mainmenu=tools', + 'type' => 'left', + 'titre' => 'Eplan', + 'prefix' => '', + 'mainmenu' => 'tools', + 'leftmenu' => 'eplan', + 'url' => '/custom/eplan/admin/setup.php', + 'langs' => 'eplan@eplan', + 'position' => 100, + 'enabled' => 'isModEnabled("eplan")', + 'perms' => '$user->hasRight("eplan","read")', + 'target' => '', + 'user' => 0, + ); + $r++; + } + + public function init($options = '') + { + $result = $this->_load_tables('/install/mysql/', 'eplan'); + $result = $this->_init(array(), $options); + return $result; + } + + public function remove($options = '') + { + return $this->_remove(array(), $options); + } +} diff --git a/langs/de_DE/eplan.lang b/langs/de_DE/eplan.lang new file mode 100644 index 0000000..942f355 --- /dev/null +++ b/langs/de_DE/eplan.lang @@ -0,0 +1,24 @@ +# Eplan — Deutsch +Module500037Name = Eplan +Module500037Desc = Verknüpfung zur ElektroPlan PWA — Raumaufmaß mit Bluetooth-Laser + +EplanSetup = Eplan Einstellungen +EplanPwaUrl = PWA-URL +EplanPwaUrlDesc = Vollständige URL zur ElektroPlan PWA (z.B. https://elektroplan.example.de) +EplanPwaUrlPlaceholder = https://elektroplan.example.de +EplanSettingsSaved = Einstellungen gespeichert +Einstellungen = Einstellungen + +EplanOpenPwa = ElektroPlan öffnen +EplanOpenPwaDesc = Öffnet die ElektroPlan PWA in einem neuen Tab. Auf Mobilgeräten kann die App installiert werden. +EplanInstallHint = Tipp: Auf dem Handy "Zum Startbildschirm hinzufügen" wählen, um die App zu installieren. +EplanNotConfigured = ElektroPlan PWA-URL ist noch nicht konfiguriert. + +EplanAbout = Über ElektroPlan +EplanAboutText = ElektroPlan ist eine PWA für mobiles Raumaufmaß. Mit Finger-Skizzen und Bosch GLM Bluetooth-Laser können Räume auf der Baustelle vermessen und maßstabsgetreue Grundrisse erstellt werden. +EplanFeatures = Funktionen +EplanFeature1 = Räume per Rechteck anlegen und bearbeiten +EplanFeature2 = Bluetooth-Laser (Bosch GLM) für exakte Maße +EplanFeature3 = Offline-fähig — funktioniert ohne Internet +EplanFeature4 = PDF- und DXF-Export (CAD-kompatibel) +EplanFeature5 = Mehrere Räume pro Projekt vermessen diff --git a/langs/en_US/eplan.lang b/langs/en_US/eplan.lang new file mode 100644 index 0000000..46efbe0 --- /dev/null +++ b/langs/en_US/eplan.lang @@ -0,0 +1,24 @@ +# Eplan — English +Module500037Name = Eplan +Module500037Desc = Link to ElektroPlan PWA — Room measurement with Bluetooth laser + +EplanSetup = Eplan Settings +EplanPwaUrl = PWA URL +EplanPwaUrlDesc = Full URL to the ElektroPlan PWA (e.g. https://elektroplan.example.com) +EplanPwaUrlPlaceholder = https://elektroplan.example.com +EplanSettingsSaved = Settings saved +Einstellungen = Settings + +EplanOpenPwa = Open ElektroPlan +EplanOpenPwaDesc = Opens the ElektroPlan PWA in a new tab. On mobile devices the app can be installed. +EplanInstallHint = Tip: On mobile select "Add to Home Screen" to install the app. +EplanNotConfigured = ElektroPlan PWA URL is not configured yet. + +EplanAbout = About ElektroPlan +EplanAboutText = ElektroPlan is a PWA for mobile room measurement. Using Bosch GLM Bluetooth laser rooms can be measured on-site and scale floor plans created. +EplanFeatures = Features +EplanFeature1 = Create and edit rooms via rectangles +EplanFeature2 = Bluetooth laser (Bosch GLM) for precise measurements +EplanFeature3 = Offline capable — works without internet +EplanFeature4 = PDF and DXF export (CAD compatible) +EplanFeature5 = Measure multiple rooms per project diff --git a/lib/eplan.lib.php b/lib/eplan.lib.php new file mode 100644 index 0000000..ae90734 --- /dev/null +++ b/lib/eplan.lib.php @@ -0,0 +1,14 @@ +load("eplan@eplan"); + $head = array(); + $h = 0; + $head[$h][0] = dol_buildpath('/eplan/admin/setup.php', 1); + $head[$h][1] = $langs->trans("Einstellungen"); + $head[$h][2] = 'settings'; + $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'eplan@eplan'); + return $head; +}