modules_member.class.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
  5. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. * or see https://www.gnu.org/
  20. */
  21. /**
  22. * \file htdocs/core/modules/member/modules_member.class.php
  23. * \ingroup members
  24. * \brief File with parent class for generating members to PDF
  25. */
  26. require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
  27. /**
  28. * Parent class to manage intervention document templates
  29. */
  30. abstract class ModelePDFMember extends CommonDocGenerator
  31. {
  32. /**
  33. * @var string Error code (or message)
  34. */
  35. public $error = '';
  36. // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
  37. /**
  38. * Return list of active generation modules
  39. *
  40. * @param DoliDB $db Database handler
  41. * @param integer $maxfilenamelength Max length of value to show
  42. * @return array List of templates
  43. */
  44. public static function liste_modeles($db, $maxfilenamelength = 0)
  45. {
  46. // phpcs:enable
  47. $type = 'member';
  48. $list = array();
  49. include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  50. $list = getListOfModels($db, $type, $maxfilenamelength);
  51. return $list;
  52. }
  53. }
  54. /**
  55. * Classe mere des modeles de numerotation des references de members
  56. */
  57. abstract class ModeleNumRefMembers
  58. {
  59. /**
  60. * @var string Error code (or message)
  61. */
  62. public $error = '';
  63. /**
  64. * Return if a module can be used or not
  65. *
  66. * @return boolean true if module can be used
  67. */
  68. public function isEnabled()
  69. {
  70. return true;
  71. }
  72. /**
  73. * Renvoi la description par defaut du modele de numerotation
  74. *
  75. * @return string Texte descripif
  76. */
  77. public function info()
  78. {
  79. global $langs;
  80. $langs->load("members");
  81. return $langs->trans("NoDescription");
  82. }
  83. /**
  84. * Return an example of numbering
  85. *
  86. * @return string Example
  87. */
  88. public function getExample()
  89. {
  90. global $langs;
  91. $langs->load("members");
  92. return $langs->trans("NoExample");
  93. }
  94. /**
  95. * Checks if the numbers already in the database do not
  96. * cause conflicts that would prevent this numbering working.
  97. *
  98. * @return boolean false if conflict, true if ok
  99. */
  100. public function canBeActivated()
  101. {
  102. return true;
  103. }
  104. /**
  105. * Renvoi prochaine valeur attribuee
  106. *
  107. * @param Societe $objsoc Object third party
  108. * @param Object $object Object we need next value for
  109. * @return string Valeur
  110. */
  111. public function getNextValue($objsoc, $object)
  112. {
  113. global $langs;
  114. return $langs->trans("NotAvailable");
  115. }
  116. /**
  117. * Renvoi version du module numerotation
  118. *
  119. * @return string Valeur
  120. */
  121. public function getVersion()
  122. {
  123. global $langs;
  124. $langs->load("admin");
  125. if ($this->version == 'development') {
  126. return $langs->trans("VersionDevelopment");
  127. } elseif ($this->version == 'experimental') {
  128. return $langs->trans("VersionExperimental");
  129. } elseif ($this->version == 'dolibarr') {
  130. return DOL_VERSION;
  131. } elseif ($this->version) {
  132. return $this->version;
  133. } else {
  134. return $langs->trans("NotAvailable");
  135. }
  136. }
  137. }