modIncoterm.class.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \defgroup incoterm Module MyModule
  21. *
  22. * \file htdocs/core/modules/modIncoterm.class.php
  23. * \ingroup incoterm
  24. * \brief Description and activation file for the module MyModule
  25. */
  26. include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
  27. /**
  28. * Description and activation class for module MyModule
  29. */
  30. class modIncoterm extends DolibarrModules
  31. {
  32. /**
  33. * Constructor. Define names, constants, directories, boxes, permissions
  34. *
  35. * @param DoliDB $db Database handler
  36. */
  37. public function __construct($db)
  38. {
  39. global $langs, $conf;
  40. $this->db = $db;
  41. // Id for module (must be unique).
  42. // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
  43. $this->numero = 62000;
  44. // Key text used to identify module (for permissions, menus, etc...)
  45. $this->rights_class = 'incoterm';
  46. // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
  47. $this->family = "srm";
  48. $this->name = preg_replace('/^mod/i', '', get_class($this));
  49. $this->description = "Incoterm management";
  50. $this->version = 'dolibarr';
  51. // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
  52. $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
  53. $this->picto = 'incoterm';
  54. $this->module_parts = array();
  55. $this->dirs = array();
  56. $this->config_page_url = array();
  57. // Dependencies
  58. $this->hidden = false; // A condition to hide module
  59. $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
  60. $this->requiredby = array(); // List of module ids to disable if this one is disabled
  61. $this->conflictwith = array(); // List of module class names as string this module is in conflict with
  62. $this->phpmin = array(5, 6); // Minimum version of PHP required by module
  63. $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module
  64. $this->langfiles = array("incoterm");
  65. $this->const = array(
  66. array('INCOTERM_ACTIVATE', 'chaine', 0, 'Description de INCOTERM_ACTIVATE')
  67. );
  68. $this->tabs = array();
  69. // Dictionaries
  70. if (!isset($conf->incoterm->enabled)) {
  71. $conf->incoterm = new stdClass();
  72. $conf->incoterm->enabled = 0;
  73. }
  74. $this->dictionaries = array(
  75. 'langs'=>'incoterm',
  76. 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor
  77. 'tablib'=>array("Incoterms"), // Label of tables
  78. 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields
  79. 'tabsqlsort'=>array("rowid ASC"), // Sort order
  80. 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary)
  81. 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record)
  82. 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert)
  83. 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid')
  84. 'tabcond'=>array($conf->incoterm->enabled)
  85. );
  86. $this->boxes = array(); // List of boxes
  87. $r = 0;
  88. // Permissions
  89. $this->rights = array(); // Permission array used by this module
  90. $r = 0;
  91. // Main menu entries
  92. $this->menus = array(); // List of menus to add
  93. $r = 0;
  94. }
  95. }