- Add cleanupDisabledCronNotifications() method - Automatically mark notifications as read when cronjob is disabled - Fixes issue where "Cron-Job verpasst" kept reappearing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
107 lines
3 KiB
PHP
Executable file
107 lines
3 KiB
PHP
Executable file
<?php
|
|
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
* \defgroup globalnotify Module GlobalNotify
|
|
* \brief Global notification system for all modules
|
|
* \file core/modules/modGlobalNotify.class.php
|
|
* \ingroup globalnotify
|
|
* \brief Description and activation file for module GlobalNotify
|
|
*/
|
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
|
|
|
/**
|
|
* Class modGlobalNotify
|
|
* Description and activation class for module GlobalNotify
|
|
*/
|
|
class modGlobalNotify extends DolibarrModules
|
|
{
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param DoliDB $db Database handler
|
|
*/
|
|
public function __construct($db)
|
|
{
|
|
global $langs, $conf;
|
|
$this->db = $db;
|
|
|
|
$this->numero = 500100;
|
|
$this->rights_class = 'globalnotify';
|
|
$this->family = "technic";
|
|
$this->module_position = '90';
|
|
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
|
$this->description = "Global notification system - displays alerts from all modules";
|
|
$this->descriptionlong = "Provides a unified notification bell in the top bar that collects and displays alerts from any module (cron errors, warnings, action required, etc.)";
|
|
$this->editor_name = 'Data IT Solution';
|
|
$this->editor_url = 'https://data-it-solution.de';
|
|
$this->version = '1.4.0';
|
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
|
$this->picto = 'bell';
|
|
|
|
$this->module_parts = array(
|
|
'hooks' => array('main', 'toprightmenu'),
|
|
'css' => array('/globalnotify/css/globalnotify.css'),
|
|
'js' => array('/globalnotify/js/globalnotify.js'),
|
|
);
|
|
|
|
$this->dirs = array("/globalnotify/temp");
|
|
|
|
$this->config_page_url = array("setup.php@globalnotify");
|
|
|
|
$this->hidden = false;
|
|
$this->depends = array();
|
|
$this->requiredby = array();
|
|
$this->conflictwith = array();
|
|
|
|
$this->langfiles = array("globalnotify@globalnotify");
|
|
|
|
$this->const = array();
|
|
|
|
if (!isset($conf->globalnotify) || !isset($conf->globalnotify->enabled)) {
|
|
$conf->globalnotify = new stdClass();
|
|
$conf->globalnotify->enabled = 0;
|
|
}
|
|
|
|
$this->tabs = array();
|
|
$this->dictionaries = array();
|
|
$this->boxes = array();
|
|
$this->cronjobs = array();
|
|
|
|
$this->rights = array();
|
|
|
|
$this->menu = array();
|
|
}
|
|
|
|
/**
|
|
* Function called when module is enabled
|
|
*
|
|
* @param string $options Options when enabling module
|
|
* @return int 1 if OK, 0 if KO
|
|
*/
|
|
public function init($options = '')
|
|
{
|
|
$result = $this->_load_tables('/install/mysql/', 'globalnotify');
|
|
$sql = array();
|
|
return $this->_init($sql, $options);
|
|
}
|
|
|
|
/**
|
|
* Function called when module is disabled
|
|
*
|
|
* @param string $options Options when disabling module
|
|
* @return int 1 if OK, 0 if KO
|
|
*/
|
|
public function remove($options = '')
|
|
{
|
|
$sql = array();
|
|
return $this->_remove($sql, $options);
|
|
}
|
|
}
|