modules_ticket.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. /* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
  4. * Copyright (C) 2020 Charlene Benke <charlie@patas-monkey.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/ticket/modules_ticket.php
  22. * \ingroup ticket
  23. * \brief File that contain parent class for projects models
  24. * and parent class for projects numbering models
  25. */
  26. require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
  27. /**
  28. * Parent class for documents models
  29. */
  30. abstract class ModelePDFTicket extends CommonDocGenerator
  31. {
  32. // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
  33. /**
  34. * Return list of active generation modules
  35. *
  36. * @param DoliDB $db Database handler
  37. * @param integer $maxfilenamelength Max length of value to show
  38. * @return array List of templates
  39. */
  40. public static function liste_modeles($db, $maxfilenamelength = 0)
  41. {
  42. // phpcs:enable
  43. global $conf;
  44. $type = 'ticket';
  45. $list = array();
  46. include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  47. $list = getListOfModels($db, $type, $maxfilenamelength);
  48. return $list;
  49. }
  50. }
  51. /**
  52. * Classe mere des modeles de numerotation des references de projets
  53. */
  54. abstract class ModeleNumRefTicket
  55. {
  56. /**
  57. * @var string Error code (or message)
  58. */
  59. public $error = '';
  60. /**
  61. * Return if a module can be used or not
  62. *
  63. * @return boolean true if module can be used
  64. */
  65. public function isEnabled()
  66. {
  67. return true;
  68. }
  69. /**
  70. * Renvoi la description par defaut du modele de numerotation
  71. *
  72. * @return string Texte descripif
  73. */
  74. public function info()
  75. {
  76. global $langs;
  77. $langs->load("ticket");
  78. return $langs->trans("NoDescription");
  79. }
  80. /**
  81. * Return an example of numbering
  82. *
  83. * @return string Example
  84. */
  85. public function getExample()
  86. {
  87. global $langs;
  88. $langs->load("ticket");
  89. return $langs->trans("NoExample");
  90. }
  91. /**
  92. * Checks if the numbers already in the database do not
  93. * cause conflicts that would prevent this numbering working.
  94. *
  95. * @return boolean false if conflict, true if ok
  96. */
  97. public function canBeActivated()
  98. {
  99. return true;
  100. }
  101. /**
  102. * Renvoi prochaine valeur attribuee
  103. *
  104. * @param Societe $objsoc Object third party
  105. * @param Ticket $ticket Object ticket
  106. * @return string Valeur
  107. */
  108. public function getNextValue($objsoc, $ticket)
  109. {
  110. global $langs;
  111. return $langs->trans("NotAvailable");
  112. }
  113. /**
  114. * Renvoi version du module numerotation
  115. *
  116. * @return string Valeur
  117. */
  118. public function getVersion()
  119. {
  120. global $langs;
  121. $langs->load("admin");
  122. if ($this->version == 'development') {
  123. return $langs->trans("VersionDevelopment");
  124. }
  125. if ($this->version == 'experimental') {
  126. return $langs->trans("VersionExperimental");
  127. }
  128. if ($this->version == 'dolibarr') {
  129. return DOL_VERSION;
  130. }
  131. if ($this->version) {
  132. return $this->version;
  133. }
  134. return $langs->trans("NotAvailable");
  135. }
  136. }