modules_delivery.php 4.1 KB

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