eplan/core/modules/modEplan.class.php
Eduard Wisch b35cd5d22d
All checks were successful
Deploy Eplan / deploy (push) Successful in 9s
Reiter am Kunden nur bei vorhandenen Auftraegen (1.1.1) [deploy]
Der Reiter Aufmass stand auf jeder Kundenkarte, auch ohne einen einzigen
Auftrag — der Reiter listet Auftraege und fuehrt je Auftrag per Link in
die externe Aufmass-PWA, ohne Auftrag ist er also leer. Auf Prod haben
25 von 99 Kunden einen Auftrag. Er erscheint jetzt nur bei Bestand, mit
Anzahl. Am AUFTRAG bleibt er unveraendert fest.

Als Hook (class/actions_eplan.class.php, completeTabsHead) statt festem
Tab, Muster wie bei den anderen Modulen dieser Reihe.

⚠ Nur per Code-Review und SQL-Gegenprobe verifiziert, nicht per Browser-
Klick: das lokale Testmodul war nie vollstaendig aktiviert (keine
Rechte-Zeilen), und ein Rechte-Nachtrag mitten in der Sitzung greift
wegen des Dolibarr-Sitzungs-Caches nicht sofort. Nach dem Deploy einmal
an einem Kunden mit Auftrag gegenpruefen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 21:28:36 +02:00

113 lines
4.1 KiB
PHP

<?php
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
* GPL v3+ — siehe COPYING
*/
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));
// Beschreibung: Dolibarr nimmt automatisch Module500037Desc/DescLong
// aus eplan.lang wenn vorhanden — Hardcoded ist nur Fallback.
$this->description = "Module500037Desc";
$this->descriptionlong = "Module500037DescLong";
$this->editor_name = 'Alles Watt läuft';
$this->editor_url = '';
$this->version = '1.1.1';
$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('data' => array('thirdpartycard'), 'entity' => '0'),
'moduleforexternal' => 0,
);
$this->dirs = array();
$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),
1 => array('EPLAN_TAB_ON_ORDER', 'chaine', '1', 'Tab Aufmaß auf Aufträgen', 0, 'current', 0),
2 => array('EPLAN_TAB_ON_THIRDPARTY', 'chaine', '1', 'Tab Aufmaß auf Kundenkarten', 0, 'current', 0),
);
// Tabs auf Auftrag + Kundenkarte
$this->tabs = array(
'order:+aufmass:Aufmaß:eplan@eplan:$user->hasRight("eplan","read"):/custom/eplan/aufmass_order.php?id=__ID__',
// Am KUNDEN setzt den Reiter die Hook-Klasse (nur bei vorhandenen Auftraegen —
// ohne Auftrag gibt es nichts zu vermessen). Der Reiter am AUFTRAG bleibt fest.
);
// Rechte
$this->rights = array();
$r = 0;
$this->rights[$r][0] = $this->numero + 0;
$this->rights[$r][1] = 'EplanRightRead';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'read';
$r++;
$this->rights[$r][0] = $this->numero + 1;
$this->rights[$r][1] = 'EplanRightWrite';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'write';
$r++;
$this->rights[$r][0] = $this->numero + 2;
$this->rights[$r][1] = 'EplanRightAdmin';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'admin';
$r++;
// Menü
$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,
);
}
public function init($options = '')
{
$this->_load_tables('/install/mysql/', 'eplan');
return $this->_init(array(), $options);
}
public function remove($options = '')
{
return $this->_remove(array(), $options);
}
}