* * 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 stockkonversion/core/modules/modStockKonversion.class.php * \ingroup stockkonversion * \brief Modul-Descriptor für StockKonversion * * Umrechnungsfaktor zwischen Einkaufs- und Verkaufseinheit. * Beispiel: 1 Packung (EK) = 12 Stück (Lager/VK) */ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; class modStockKonversion extends DolibarrModules { public function __construct($db) { global $conf, $langs; $this->db = $db; $this->numero = 500035; $this->rights_class = 'stockkonversion'; $this->family = 'products'; $this->module_position = '90'; $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "StockKonversionDescription"; $this->descriptionlong = "StockKonversionDescriptionLong"; $this->editor_name = 'Alles Watt laeuft'; $this->editor_url = ''; $this->version = '1.0.0'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->picto = 'stockkonversion@stockkonversion'; // Hook auf Lagerbewegung registrieren $this->module_parts = array( 'hooks' => array( 'data' => array( 'mouvementstock', ), ), ); $this->dirs = array(); $this->config_page_url = array("setup.php@stockkonversion"); // Abhängigkeit: Lagermodul muss aktiv sein $this->depends = array('modStock'); $this->requiredby = array(); $this->conflictwith = array(); $this->langfiles = array("stockkonversion@stockkonversion"); $this->phpmin = array(7, 1); $this->need_dolibarr_version = array(19, -3); $this->need_javascript_ajax = 0; $this->warnings_activation = array(); $this->warnings_activation_ext = array(); $this->const = array(); if (!isModEnabled("stockkonversion")) { $conf->stockkonversion = new stdClass(); $conf->stockkonversion->enabled = 0; } $this->tabs = array(); // Keine Menüs — Zugang nur über Admin-Einstellungen $this->menu = array(); // Recht: Lesen (wird im Hook geprüft) $this->rights = array(); $r = 0; $this->rights[$r][0] = $this->numero . sprintf("%02d", 11); $this->rights[$r][1] = 'Stockkonversion lesen und verwenden'; $this->rights[$r][4] = 'read'; $this->rights[$r][5] = ''; $r++; } /** * Modul aktivieren: Extrafeld anlegen */ public function init($options = '') { global $conf, $langs; // Extrafeld "umrechnungsfaktor" auf Produkt anlegen include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); // addExtraField ist idempotent — existiert das Feld bereits, wird es nicht doppelt angelegt $result = $extrafields->addExtraField( 'umrechnungsfaktor', // attrname 'Umrechnungsfaktor (EK->Lager)', // label 'int', // type 100, // pos 10, // size 'product', // elementtype 0, // unique 0, // required '1', // default value '', // param 1, // alwayseditable '', // perms 0, // list (0 = nicht in Listen anzeigen) 0, // fieldcheck '', // computed '', // entity 'stockkonversion@stockkonversion', // langfile 'isModEnabled("stockkonversion")', // enabled 0, // totalizable 0, // printable '', // moreparams '' // help ); if ($result < 0) { dol_syslog("StockKonversion: Fehler beim Anlegen des Extrafeldes: ".$extrafields->error, LOG_ERR); } $this->remove($options); $sql = array(); return $this->_init($sql, $options); } /** * Modul deaktivieren * Extrafeld wird NICHT gelöscht (Daten erhalten) */ public function remove($options = '') { $sql = array(); return $this->_remove($sql, $options); } }