* * 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. */ /** * \defgroup mahnung Modul Mahnwesen * \brief Mahnwesen-Modul (3-stufig nach BGB §288) * \file htdocs/custom/mahnung/core/modules/modMahnung.class.php * \ingroup mahnung */ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** * Beschreibungs- und Aktivierungsklasse fuer Modul Mahnung */ class modMahnung extends DolibarrModules { /** * @param DoliDB $db Datenbank-Handler */ public function __construct($db) { global $conf, $langs; $this->db = $db; // Eindeutige Modul-ID. 500034..500036 sind durch das Bericht-Modul belegt // (numero=500033, dessen rights id-Range 500033..500036 abdeckt), daher 500037. $this->numero = 500037; // Schluessel fuer Rechte und Menues $this->rights_class = 'mahnung'; $this->family = 'financial'; $this->module_position = '50'; $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = 'MahnungDescription'; $this->descriptionlong = 'MahnungDescription'; $this->editor_name = 'Alles Watt laeuft'; $this->editor_url = ''; $this->version = '0.1.0'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // FontAwesome 5 Free (Dolibarr-Bundle, KB #435). 'fa-envelope-open-o' ist FA4-Notation // und rendert in Dolibarr lautlos kein Glyph; 'fa-envelope-open-text' ist FA5-Free. $this->picto = 'fa-envelope-open-text'; $this->module_parts = array( 'triggers' => 1, 'login' => 0, 'substitutions' => 0, 'menus' => 0, 'tpl' => 0, 'barcode' => 0, 'models' => 0, 'printing' => 0, 'theme' => 0, 'css' => array(), 'js' => array(), // Hook-Klasse: class/actions_mahnung.class.php (Standard-Lookup-Pfad) 'hooks' => array( 'data' => array( 'invoicecard', 'thirdpartycard', ), 'entity' => '0', ), 'moduleforexternal' => 0, 'websitetemplates' => 0, 'captcha' => 0, ); // Datenverzeichnisse bei Modul-Aktivierung $this->dirs = array('/mahnung/temp'); // Konfigurationsseite $this->config_page_url = array('setup.php@mahnung'); $this->hidden = getDolGlobalInt('MODULE_MAHNUNG_DISABLED'); $this->depends = array(); $this->requiredby = array(); $this->conflictwith = array(); $this->langfiles = array('mahnung@mahnung'); $this->phpmin = array(7, 4); $this->need_dolibarr_version = array(19, -3); $this->need_javascript_ajax = 1; $this->warnings_activation = array(); $this->warnings_activation_ext = array(); // Modul-Konstanten $this->const = array( 0 => array( 'MAHNUNG_BASISZINS', 'chaine', '1.27', 'BGB-Basiszins in Prozent (manuell halbjaehrlich pflegen)', 0, 'allentities', 1, ), 1 => array( 'MAHNUNG_NTFY_TOPIC', 'chaine', 'vk-builds', 'Ntfy-Topic fuer Mahnungs-Benachrichtigungen', 0, 'current', 1, ), 2 => array( 'MAHNUNG_AUFSCHLAG_B2C', 'chaine', '5.0', 'Verzugszins-Aufschlag B2C in Prozent (BGB §288 Abs. 1)', 0, 'allentities', 1, ), 3 => array( 'MAHNUNG_AUFSCHLAG_B2B', 'chaine', '9.0', 'Verzugszins-Aufschlag B2B in Prozent (BGB §288 Abs. 2)', 0, 'allentities', 1, ), 4 => array( 'MAHNUNG_PAUSCHALE_B2B', 'chaine', '40.00', 'Pauschale B2B nach BGB §288 Abs. 5 in EUR', 0, 'allentities', 1, ), ); if (!isModEnabled('mahnung')) { $conf->mahnung = new stdClass(); $conf->mahnung->enabled = 0; } // Tabs auf bestehenden Karten (Phase 5: aktivieren) $this->tabs = array(); $this->dictionaries = array(); $this->boxes = array(); // Cron-Job: Vorschlagsliste taeglich 06:00 $this->cronjobs = array( 0 => array( 'label' => 'MahnungCronBuildVorschlag', 'jobtype' => 'method', 'class' => '/mahnung/class/mahnungcron.class.php', 'objectname' => 'MahnungCron', 'method' => 'buildVorschlagsliste', 'parameters' => '', 'comment' => 'Sucht ueberfaellige Rechnungen, ermittelt vorgeschlagene Mahnstufen, sendet Ntfy-Push', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 0, 'test' => 'isModEnabled("mahnung")', 'priority' => 50, ), ); // Berechtigungen $this->rights = array(); $r = 0; $this->rights[$r][0] = $this->numero.'01'; $this->rights[$r][1] = 'PermMahnungRead'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 1; $this->rights[$r][4] = 'read'; $r++; $this->rights[$r][0] = $this->numero.'02'; $this->rights[$r][1] = 'PermMahnungWrite'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'write'; $r++; $this->rights[$r][0] = $this->numero.'03'; $this->rights[$r][1] = 'PermMahnungSend'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'send'; $r++; $this->rights[$r][0] = $this->numero.'04'; $this->rights[$r][1] = 'PermMahnungDelete'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'delete'; $r++; $this->rights[$r][0] = $this->numero.'05'; $this->rights[$r][1] = 'PermMahnungSetup'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'setup'; $r++; // Linkes Menue unter "Rechnungen" (mainmenu=billing) $this->menu = array(); $r = 0; $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=billing', 'type' => 'left', 'titre' => 'MahnungMenu', 'prefix' => img_picto('', 'fa-envelope-open-text', 'class="pictofixedwidth valignmiddle paddingright"'), 'mainmenu' => 'billing', 'leftmenu' => 'mahnung', 'url' => '/custom/mahnung/list.php?mainmenu=billing&leftmenu=mahnung', 'langs' => 'mahnung@mahnung', 'position' => 300, 'enabled' => 'isModEnabled("mahnung")', 'perms' => '$user->hasRight("mahnung", "read")', 'target' => '', 'user' => 2, ); $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=billing,fk_leftmenu=mahnung', 'type' => 'left', 'titre' => 'MahnungVorschlagsliste', 'mainmenu' => 'billing', 'leftmenu' => 'mahnung_vorschlag', 'url' => '/custom/mahnung/list.php?mainmenu=billing&leftmenu=mahnung&mode=vorschlag', 'langs' => 'mahnung@mahnung', 'position' => 301, 'enabled' => 'isModEnabled("mahnung")', 'perms' => '$user->hasRight("mahnung", "read")', 'target' => '', 'user' => 2, ); $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=billing,fk_leftmenu=mahnung', 'type' => 'left', 'titre' => 'MahnungArchiv', 'mainmenu' => 'billing', 'leftmenu' => 'mahnung_archiv', 'url' => '/custom/mahnung/list.php?mainmenu=billing&leftmenu=mahnung&mode=archiv', 'langs' => 'mahnung@mahnung', 'position' => 302, 'enabled' => 'isModEnabled("mahnung")', 'perms' => '$user->hasRight("mahnung", "read")', 'target' => '', 'user' => 2, ); } /** * Aufruf bei Modul-Aktivierung: Tabellen anlegen, Konstanten/Rechte/Menues schreiben. * * @param string $options Optionen ('', 'noboxes') * @return int<-1,1> 1 = OK, <=0 = Fehler */ public function init($options = '') { // Tabellen anlegen aus sql/-Verzeichnis $result = $this->_load_tables('/mahnung/sql/'); if ($result < 0) { return -1; } $sql = array(); return $this->_init($sql, $options); } /** * Aufruf bei Modul-Deaktivierung. Tabellen bleiben erhalten (Datensicherheit). * * @param string $options Optionen * @return int<-1,1> 1 = OK, <=0 = Fehler */ public function remove($options = '') { $sql = array(); return $this->_remove($sql, $options); } }