dolibarr/htdocs/core/modules/modLabel.class.php

112 lines
3.8 KiB
PHP
Raw Normal View History

2011-09-21 18:40:52 +02:00
<?php
2018-10-27 14:43:12 +02:00
/* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@inodbox.com>
2011-09-21 15:05:32 +02:00
* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
2011-09-21 15:05:32 +02:00
* (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
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2011-09-21 15:05:32 +02:00
*/
/**
* \defgroup label Module labels
* \brief Module pour gerer les formats d'impression des etiquettes
* \file htdocs/core/modules/modLabel.class.php
2011-09-21 15:05:32 +02:00
* \ingroup other
2021-03-20 13:55:43 +01:00
* \brief Description and activation file for the module Labels
2011-09-21 15:05:32 +02:00
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
2011-09-21 15:05:32 +02:00
/**
2015-09-07 15:55:26 +02:00
* Class to describe and enable module Label
2011-09-21 15:05:32 +02:00
*/
class modLabel extends DolibarrModules
{
/**
2011-09-26 16:22:35 +02:00
* Constructor. Define names, constants, directories, boxes, permissions
*
2012-01-04 21:23:50 +01:00
* @param DoliDB $db Database handler
2011-09-21 15:05:32 +02:00
*/
2019-02-25 20:35:59 +01:00
public function __construct($db)
2011-09-21 15:05:32 +02:00
{
2012-01-04 21:23:50 +01:00
$this->db = $db;
$this->numero = 60;
2011-09-21 15:05:32 +02:00
$this->family = "technic";
$this->module_position = '75';
2011-09-21 15:05:32 +02:00
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
2020-02-03 03:01:23 +01:00
$this->description = "Management of stickers";
2017-08-22 18:34:58 +02:00
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
2011-09-21 15:05:32 +02:00
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto = 'generic';
2011-09-21 15:05:32 +02:00
// Data directories to create when module is enabled
$this->dirs = array("/label/temp");
2018-07-09 17:22:34 +02:00
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
$this->requiredby = array(); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
2022-09-27 20:48:47 +02:00
$this->phpmin = array(7, 0); // Minimum version of PHP required by module
2011-09-21 15:05:32 +02:00
// Config pages
2014-06-16 06:17:46 +02:00
// $this->config_page_url = array("label.php");
2011-09-21 15:05:32 +02:00
// Constants
$this->const = array();
// Boxes
$this->boxes = array();
// Permissions
$this->rights = array();
$this->rights_class = 'label';
$this->rights[1][0] = 601; // id de la permission
$this->rights[1][1] = 'Read stickers';
$this->rights[1][3] = 0; // La permission est-elle une permission par defaut
2011-09-21 15:05:32 +02:00
$this->rights[1][4] = 'lire';
$this->rights[2][0] = 602; // id de la permission
$this->rights[2][1] = 'Create/modify stickers';
2011-09-21 15:05:32 +02:00
$this->rights[2][3] = 0; // La permission est-elle une permission par defaut
$this->rights[2][4] = 'creer';
$this->rights[4][0] = 609; // id de la permission
$this->rights[4][1] = 'Delete stickers';
2011-09-21 15:05:32 +02:00
$this->rights[4][3] = 0; // La permission est-elle une permission par defaut
$this->rights[4][4] = 'supprimer';
}
/**
2012-01-04 21:23:50 +01:00
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
2012-01-04 21:23:50 +01:00
* @return int 1 if OK, 0 if KO
2011-09-21 15:05:32 +02:00
*/
public function init($options = '')
{
2011-09-21 15:05:32 +02:00
// Permissions
$this->remove($options);
2011-09-21 15:05:32 +02:00
$sql = array();
return $this->_init($sql, $options);
}
2011-09-21 15:05:32 +02:00
}