feat: Dolibarr-Modul Eplan — Initial [deploy]
Some checks failed
Deploy Eplan / deploy (push) Failing after 0s
Some checks failed
Deploy Eplan / deploy (push) Failing after 0s
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) <noreply@anthropic.com>
This commit is contained in:
commit
3f36379265
6 changed files with 333 additions and 0 deletions
59
.forgejo/workflows/deploy.yml
Normal file
59
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -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
|
||||
92
admin/setup.php
Normal file
92
admin/setup.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
* 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 '<div class="div-table-responsive-no-min">';
|
||||
|
||||
if (!empty($pwa_url)) {
|
||||
print '<div style="background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%); border-radius: 12px; padding: 30px; margin-bottom: 24px; color: #fff;">';
|
||||
print '<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;">';
|
||||
print '<div>';
|
||||
print '<h2 style="margin: 0 0 8px; font-size: 22px; font-weight: 700;">ElektroPlan</h2>';
|
||||
print '<p style="margin: 0 0 4px; opacity: 0.9; font-size: 14px;">'.$langs->trans("EplanOpenPwaDesc").'</p>';
|
||||
print '<p style="margin: 0; opacity: 0.7; font-size: 12px;"><i class="fas fa-mobile-alt"></i> '.$langs->trans("EplanInstallHint").'</p>';
|
||||
print '</div>';
|
||||
print '<div>';
|
||||
print '<a href="'.dol_escape_htmltag($pwa_url).'" target="_blank" rel="noopener" ';
|
||||
print 'style="display: inline-block; background: #fff; color: #1565C0; padding: 14px 32px; border-radius: 8px; font-size: 16px; font-weight: 700; text-decoration: none;">';
|
||||
print '<i class="fas fa-external-link-alt" style="margin-right: 8px;"></i>';
|
||||
print $langs->trans("EplanOpenPwa");
|
||||
print '</a>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
} else {
|
||||
print '<div class="warning" style="margin-bottom: 20px;">';
|
||||
print '<i class="fas fa-exclamation-triangle"></i> ';
|
||||
print $langs->trans("EplanNotConfigured");
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="save">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="oddeven"><td class="titlefield">';
|
||||
print '<strong>'.$langs->trans("EplanPwaUrl").'</strong>';
|
||||
print '<br><span class="opacitymedium small">'.$langs->trans("EplanPwaUrlDesc").'</span>';
|
||||
print '</td><td>';
|
||||
print '<input type="url" name="EPLAN_PWA_URL" value="'.dol_escape_htmltag($pwa_url).'" ';
|
||||
print 'placeholder="'.$langs->trans("EplanPwaUrlPlaceholder").'" style="width: 100%; max-width: 500px;" class="flat">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '<div class="center" style="margin-top: 16px;">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
print '<br><div class="fichecenter"><div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<tr><td class="titlefield" colspan="2"><strong>'.$langs->trans("EplanAbout").'</strong></td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("EplanAboutText").'</td></tr>';
|
||||
print '<tr><td class="titlefield" colspan="2"><strong>'.$langs->trans("EplanFeatures").'</strong></td></tr>';
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
print '<tr class="oddeven"><td colspan="2"><i class="fas fa-check" style="color: #4CAF50; margin-right: 8px;"></i>';
|
||||
print $langs->trans("EplanFeature".$i).'</td></tr>';
|
||||
}
|
||||
print '</table></div></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
llxFooter();
|
||||
$db->close();
|
||||
120
core/modules/modEplan.class.php
Normal file
120
core/modules/modEplan.class.php
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
* 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' => '<i class="fas fa-drafting-compass pictofixedwidth"></i>',
|
||||
'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);
|
||||
}
|
||||
}
|
||||
24
langs/de_DE/eplan.lang
Normal file
24
langs/de_DE/eplan.lang
Normal file
|
|
@ -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
|
||||
24
langs/en_US/eplan.lang
Normal file
24
langs/en_US/eplan.lang
Normal file
|
|
@ -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
|
||||
14
lib/eplan.lib.php
Normal file
14
lib/eplan.lib.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
function eplanAdminPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
$langs->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;
|
||||
}
|
||||
Loading…
Reference in a new issue