modDocumentGeneration.class.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. /* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. * or see http://www.gnu.org/
  18. */
  19. /**
  20. * \defgroup document Module mass mailings
  21. * \brief Module pour gerer des generations de documents
  22. * \file htdocs/core/modules/modDocument.class.php
  23. * \ingroup document
  24. * \brief Fichier de description et activation du module Generation document
  25. */
  26. include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
  27. /**
  28. * Classe de description et activation du module Document
  29. */
  30. class modDocumentGeneration extends DolibarrModules
  31. {
  32. /**
  33. * Constructor. Define names, constants, directories, boxes, permissions
  34. *
  35. * @param DoliDB $db Database handler
  36. */
  37. function __construct($db)
  38. {
  39. $this->db = $db;
  40. $this->numero = 1520;
  41. $this->family = "technic";
  42. // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
  43. $this->name = preg_replace('/^mod/i','',get_class($this));
  44. $this->description = "Direct mail document generation";
  45. // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
  46. $this->version = 'development';
  47. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  48. $this->special = 0;
  49. $this->picto='email';
  50. // Data directories to create when module is enabled
  51. $this->dirs = array("/documentgeneration/temp");
  52. // Config pages
  53. //$this->config_page_url = array("document.php");
  54. // Dependencies
  55. $this->depends = array();
  56. $this->requiredby = array();
  57. $this->conflictwith = array();
  58. $this->langfiles = array("orders","bills","companies","mails");
  59. // Constantes
  60. $this->const = array();
  61. // Boites
  62. $this->boxes = array();
  63. // Permissions
  64. $this->rights = array();
  65. $this->rights_class = 'document';
  66. $r=0;
  67. $this->rights[$r][0] = 1521;
  68. $this->rights[$r][1] = 'Lire les documents';
  69. $this->rights[$r][2] = 'r';
  70. $this->rights[$r][3] = 1;
  71. $this->rights[$r][4] = 'lire';
  72. $r++;
  73. $this->rights[$r][0] = 1522;
  74. $this->rights[$r][1] = 'Supprimer les documents clients';
  75. $this->rights[$r][2] = 'd';
  76. $this->rights[$r][3] = 0;
  77. $this->rights[$r][4] = 'supprimer';
  78. }
  79. /**
  80. * Function called when module is enabled.
  81. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
  82. * It also creates data directories
  83. *
  84. * @param string $options Options when enabling module ('', 'noboxes')
  85. * @return int 1 if OK, 0 if KO
  86. */
  87. function init($options='')
  88. {
  89. global $conf;
  90. // Permissions
  91. $this->remove($options);
  92. $sql = array();
  93. return $this->_init($sql,$options);
  94. }
  95. }