* * 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 . */ /** * \file produktverwaltung/admin/setup.php * \ingroup produktverwaltung * \brief ProduktVerwaltung setup page - Ref-Schema Konfiguration */ // Load Dolibarr environment $res = 0; if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; } $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; } if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; } if (!$res && file_exists("../../main.inc.php")) { $res = @include "../../main.inc.php"; } if (!$res && file_exists("../../../main.inc.php")) { $res = @include "../../../main.inc.php"; } if (!$res) { die("Include of main fails"); } require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once '../lib/produktverwaltung.lib.php'; $langs->loadLangs(array("admin", "produktverwaltung@produktverwaltung")); if (!$user->admin) { accessforbidden(); } $action = GETPOST('action', 'aZ09'); // Default Ref-Schema $defaultSchema = 'KAT-HER-[TYP-]SPEC[-SERIE] KAT = Produktkategorie (2-4 Zeichen), z.B. LSS, FI, STK, NYM HER = Hersteller (2-4 Zeichen), z.B. HAG, EAT, WAG, BJ TYP = Variante (optional), z.B. FLX, STD, AP, UP SPEC = Spezifikation/Groesse, z.B. B16, 3F, 5x1_5, 60x110 SERIE = Produktserie (optional), z.B. 221, 2273, 914'; $defaultExample = 'LSS-HAG-B16-1P = Hager Leitungsschutzschalter B16A 1-polig STK-WAG-FLX-3F-221 = Wago Flex 3-fach (Serie 221) NYM-5x1_5 = NYM-J Mantelleitung 5x1,5mm² RAH-BJ-1F-914 = Busch-Jaeger Rahmen 1-fach Balance SI'; /* * Actions */ if ($action == 'update' && $user->admin) { $showSchema = GETPOST('PRODUKTVERWALTUNG_SHOW_SCHEMA', 'alpha'); $refSchema = GETPOST('PRODUKTVERWALTUNG_REF_SCHEMA', 'restricthtml'); $refExample = GETPOST('PRODUKTVERWALTUNG_REF_EXAMPLE', 'restricthtml'); $defaultExpanded = GETPOST('PRODUKTVERWALTUNG_DEFAULT_EXPANDED', 'alpha'); dolibarr_set_const($db, 'PRODUKTVERWALTUNG_SHOW_SCHEMA', $showSchema, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'PRODUKTVERWALTUNG_REF_SCHEMA', $refSchema, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'PRODUKTVERWALTUNG_REF_EXAMPLE', $refExample, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'PRODUKTVERWALTUNG_DEFAULT_EXPANDED', $defaultExpanded, 'chaine', 0, '', $conf->entity); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } /* * View */ $form = new Form($db); llxHeader('', $langs->trans("ProduktVerwaltungSetup"), '', '', 0, 0, '', '', '', 'mod-produktverwaltung page-admin'); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("ProduktVerwaltungSetup"), $linkback, 'title_setup'); $head = produktverwaltungAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans("ProduktVerwaltungSetup"), -1, "fa-sitemap"); // Current values $showSchema = getDolGlobalString('PRODUKTVERWALTUNG_SHOW_SCHEMA', '1'); $defaultExpanded = getDolGlobalString('PRODUKTVERWALTUNG_DEFAULT_EXPANDED', '0'); $refSchema = getDolGlobalString('PRODUKTVERWALTUNG_REF_SCHEMA', $defaultSchema); $refExample = getDolGlobalString('PRODUKTVERWALTUNG_REF_EXAMPLE', $defaultExample); print '
'; print ''; print ''; print ''; // Section title print ''; print ''; print ''; // Show schema on main page print ''; print ''; print ''; print ''; // Default expanded print ''; print ''; print ''; print ''; // Schema pattern print ''; print ''; print ''; print ''; // Examples print ''; print ''; print ''; print ''; print '
'.$langs->trans("RefSchemaTitle").'
'.$langs->trans("RefSchemaShow").''; print $form->selectyesno('PRODUKTVERWALTUNG_SHOW_SCHEMA', $showSchema, 1); print '
'.$langs->trans("DefaultExpanded").''; print $form->selectyesno('PRODUKTVERWALTUNG_DEFAULT_EXPANDED', $defaultExpanded, 1); print '
'.$langs->trans("RefSchemaPattern").''; print ''; print '
'.$langs->trans("RefSchemaHelp").''; print '
'.$langs->trans("RefSchemaExample").''; print ''; print '
'; print '
'; print ''; print '
'; print '
'; print dol_get_fiche_end(); llxFooter(); $db->close();