modules_task.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?php
  2. /* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2010 Florian Henry <florian.henry<àopen-concept.pro>
  4. * Copyright (C) 2014 Marcos García <marcosgdf@gmail.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. * or see https://www.gnu.org/
  19. */
  20. /**
  21. * \file htdocs/core/modules/project/task/modules_task.php
  22. * \ingroup project
  23. * \brief File that contain parent class for task models
  24. * and parent class for task numbering models
  25. */
  26. require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
  27. /**
  28. * Parent class for projects models
  29. */
  30. abstract class ModelePDFTask 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. global $conf;
  48. $type = 'project_task';
  49. $list = array();
  50. include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  51. $list = getListOfModels($db, $type, $maxfilenamelength);
  52. return $list;
  53. }
  54. }
  55. /**
  56. * Classe mere des modeles de numerotation des references de projets
  57. */
  58. abstract class ModeleNumRefTask
  59. {
  60. /**
  61. * @var string Error code (or message)
  62. */
  63. public $error = '';
  64. /**
  65. * Return if a module can be used or not
  66. *
  67. * @return boolean true if module can be used
  68. */
  69. public function isEnabled()
  70. {
  71. return true;
  72. }
  73. /**
  74. * Renvoi la description par defaut du modele de numerotation
  75. *
  76. * @return string Texte descripif
  77. */
  78. public function info()
  79. {
  80. global $langs;
  81. $langs->load("projects");
  82. return $langs->trans("NoDescription");
  83. }
  84. /**
  85. * Return an example of numbering
  86. *
  87. * @return string Example
  88. */
  89. public function getExample()
  90. {
  91. global $langs;
  92. $langs->load("projects");
  93. return $langs->trans("NoExample");
  94. }
  95. /**
  96. * Checks if the numbers already in the database do not
  97. * cause conflicts that would prevent this numbering working.
  98. *
  99. * @return boolean false if conflict, true if ok
  100. */
  101. public function canBeActivated()
  102. {
  103. return true;
  104. }
  105. /**
  106. * Renvoi prochaine valeur attribuee
  107. *
  108. * @param Societe $objsoc Object third party
  109. * @param Project $project Object project
  110. * @return string Valeur
  111. */
  112. public function getNextValue($objsoc, $project)
  113. {
  114. global $langs;
  115. return $langs->trans("NotAvailable");
  116. }
  117. /**
  118. * Renvoi version du module numerotation
  119. *
  120. * @return string Valeur
  121. */
  122. public function getVersion()
  123. {
  124. global $langs;
  125. $langs->load("admin");
  126. if ($this->version == 'development') {
  127. return $langs->trans("VersionDevelopment");
  128. }
  129. if ($this->version == 'experimental') {
  130. return $langs->trans("VersionExperimental");
  131. }
  132. if ($this->version == 'dolibarr') {
  133. return DOL_VERSION;
  134. }
  135. return $langs->trans("NotAvailable");
  136. }
  137. }