modules_evaluation.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 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. * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
  7. * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
  8. * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. * or see https://www.gnu.org/
  23. */
  24. /**
  25. * \file htdocs/core/modules/hrm/modules_evaluation.php
  26. * \ingroup hrm
  27. * \brief File that contains parent class for evaluations document models and parent class for evaluations numbering models
  28. */
  29. require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
  31. /**
  32. * Parent class for documents models
  33. */
  34. abstract class ModelePDFEvaluation extends CommonDocGenerator
  35. {
  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 = 'evaluation';
  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. * Parent class to manage numbering of Evaluation
  57. */
  58. abstract class ModeleNumRefEvaluation
  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. * Returns the default description of the numbering template
  75. *
  76. * @return string Texte descripif
  77. */
  78. public function info()
  79. {
  80. global $langs;
  81. $langs->load("hrm");
  82. return $langs->trans("NoDescription");
  83. }
  84. /**
  85. * Returns an example of numbering
  86. *
  87. * @return string Example
  88. */
  89. public function getExample()
  90. {
  91. global $langs;
  92. $langs->load("hrm");
  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. * @param Object $object Object we need next value for
  100. * @return boolean false if conflict, true if ok
  101. */
  102. public function canBeActivated($object)
  103. {
  104. return true;
  105. }
  106. /**
  107. * Returns next assigned value
  108. *
  109. * @param Object $object Object we need next value for
  110. * @return string Valeur
  111. */
  112. public function getNextValue($object)
  113. {
  114. global $langs;
  115. return $langs->trans("NotAvailable");
  116. }
  117. /**
  118. * Returns version of numbering module
  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. if ($this->version) {
  136. return $this->version;
  137. }
  138. return $langs->trans("NotAvailable");
  139. }
  140. }