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

118 lines
3.4 KiB
PHP
Raw Normal View History

2011-09-21 18:40:52 +02:00
<?php
2011-09-21 15:05:32 +02:00
/* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2012-12-30 15:13:49 +01:00
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
2011-09-21 15:05:32 +02:00
*
* 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
2011-12-17 21:58:44 +01:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
2011-09-21 15:05:32 +02:00
*/
/**
* \defgroup document Module mass mailings
* \brief Module pour gerer des generations de documents
* \file htdocs/core/modules/modDocument.class.php
2011-09-21 15:05:32 +02:00
* \ingroup document
* \brief Fichier de description et activation du module Generation document
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
2011-09-21 15:05:32 +02:00
/**
2012-10-03 00:30:50 +02:00
* Classe de description et activation du module Document
2011-09-21 15:05:32 +02:00
*/
class modDocumentGeneration extends DolibarrModules
2011-09-21 15:05:32 +02:00
{
/**
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
*/
function __construct($db)
2011-09-21 15:05:32 +02:00
{
2012-01-04 21:23:50 +01:00
$this->db = $db;
$this->numero = 1520;
2011-09-21 15:05:32 +02:00
$this->family = "technic";
// 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));
$this->description = "Direct mail document generation";
2011-09-21 15:05:32 +02:00
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0;
$this->picto='email';
// Data directories to create when module is enabled
$this->dirs = array("/documentgeneration/temp");
2011-09-21 15:05:32 +02:00
// Config pages
//$this->config_page_url = array("document.php");
// Dependencies
$this->depends = array();
$this->requiredby = array();
$this->conflictwith = array();
$this->langfiles = array("orders","bills","companies","mails");
2011-09-21 15:05:32 +02:00
// Constantes
$this->const = array();
// Boites
$this->boxes = array();
// Permissions
$this->rights = array();
$this->rights_class = 'document';
$r=0;
$this->rights[$r][0] = 1521;
2011-09-21 15:05:32 +02:00
$this->rights[$r][1] = 'Lire les documents';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'lire';
$r++;
$this->rights[$r][0] = 1522;
2011-09-21 15:05:32 +02:00
$this->rights[$r][1] = 'Supprimer les documents clients';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][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')
* @return int 1 if OK, 0 if KO
2011-09-21 15:05:32 +02:00
*/
2012-01-04 21:23:50 +01:00
function init($options='')
2011-09-21 15:05:32 +02:00
{
global $conf;
// Permissions
$this->remove($options);
2011-09-21 15:05:32 +02:00
$sql = array();
2012-01-04 21:23:50 +01:00
return $this->_init($sql,$options);
2011-09-21 15:05:32 +02:00
}
}