modules_takepos.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
  5. * Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
  6. * Copyright (C) 2020 Open-DSI <support@open-dsi.fr>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. * or see https://www.gnu.org/
  21. */
  22. /**
  23. * \file htdocs/core/modules/takepos/modules_takepos.php
  24. * \ingroup takepos
  25. * \brief File containing the parent class for the numbering of cash register receipts
  26. */
  27. /**
  28. * \class ModeleNumRefTakepos
  29. * \brief Classe mere des modeles de numerotation des tickets de caisse
  30. */
  31. abstract class ModeleNumRefTakepos
  32. {
  33. /**
  34. * @var string Error code (or message)
  35. */
  36. public $error = '';
  37. public $version = '';
  38. /**
  39. * Return if a module can be used or not
  40. *
  41. * @return boolean true if module can be used
  42. */
  43. public function isEnabled()
  44. {
  45. return true;
  46. }
  47. /**
  48. * Renvoi la description par defaut du modele de numerotation
  49. *
  50. * @return string Texte descripif
  51. */
  52. public function info()
  53. {
  54. global $langs;
  55. $langs->load("cashdesk@cashdesk");
  56. return $langs->trans("NoDescription");
  57. }
  58. /**
  59. * Return an example of numbering
  60. *
  61. * @return string Example
  62. */
  63. public function getExample()
  64. {
  65. global $langs;
  66. $langs->load('cashdesk@cashdesk');
  67. return $langs->trans('NoExample');
  68. }
  69. /**
  70. * Checks if the numbers already in the database do not
  71. * cause conflicts that would prevent this numbering working.
  72. *
  73. * @return boolean false if conflict, true if ok
  74. */
  75. public function canBeActivated()
  76. {
  77. return true;
  78. }
  79. /**
  80. * Renvoi prochaine valeur attribuee
  81. *
  82. * @param Societe $objsoc Object thirdparty
  83. * @param Facture $invoice Object invoice
  84. * @param string $mode 'next' for next value or 'last' for last value
  85. * @return string Value if KO, <0 if KO
  86. */
  87. public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
  88. {
  89. global $langs;
  90. return $langs->trans('NotAvailable');
  91. }
  92. /**
  93. * Renvoi version du modele de numerotation
  94. *
  95. * @return string Valeur
  96. */
  97. public function getVersion()
  98. {
  99. global $langs;
  100. $langs->load("admin");
  101. if ($this->version == 'development') {
  102. return $langs->trans('VersionDevelopment');
  103. }
  104. if ($this->version == 'experimental') {
  105. return $langs->trans('VersionExperimental');
  106. }
  107. if ($this->version == 'dolibarr') {
  108. return DOL_VERSION;
  109. }
  110. if ($this->version) {
  111. return $this->version;
  112. }
  113. return $langs->trans('NotAvailable');
  114. }
  115. }