mod_codecompta_panicum.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. * or see https://www.gnu.org/
  18. */
  19. /**
  20. * \file htdocs/core/modules/societe/mod_codecompta_panicum.php
  21. * \ingroup societe
  22. * \brief File of class to manage accountancy code of thirdparties with Panicum rules
  23. */
  24. require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php';
  25. /**
  26. * Class to manage accountancy code of thirdparties with Panicum rules
  27. */
  28. class mod_codecompta_panicum extends ModeleAccountancyCode
  29. {
  30. /**
  31. * @var string model name
  32. */
  33. public $name = 'Panicum';
  34. /**
  35. * Dolibarr version of the loaded document
  36. * @var string
  37. */
  38. public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
  39. public $position = 10;
  40. /**
  41. * Constructor
  42. */
  43. public function __construct()
  44. {
  45. }
  46. /**
  47. * Return description of module
  48. *
  49. * @param Translate $langs Object langs
  50. * @return string Description of module
  51. */
  52. public function info($langs)
  53. {
  54. return $langs->trans("ModuleCompanyCode".$this->name);
  55. }
  56. /**
  57. * Return an example of result returned by getNextValue
  58. *
  59. * @param Translate $langs Object langs
  60. * @param Societe $objsoc Object thirdparty
  61. * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
  62. * @return string Example
  63. */
  64. public function getExample($langs, $objsoc = 0, $type = -1)
  65. {
  66. return '';
  67. }
  68. // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
  69. /**
  70. * Set accountancy account code for a third party into this->code
  71. *
  72. * @param DoliDB $db Database handler
  73. * @param Societe $societe Third party object
  74. * @param int $type 'customer' or 'supplier'
  75. * @return int >=0 if OK, <0 if KO
  76. */
  77. public function get_code($db, $societe, $type = '')
  78. {
  79. // phpcs:enable
  80. $this->code = '';
  81. if (is_object($societe)) {
  82. if ($type == 'supplier') {
  83. $this->code = (($societe->code_compta_fournisseur != "") ? $societe->code_compta_fournisseur : '');
  84. } else {
  85. $this->code = (($societe->code_compta != "") ? $societe->code_compta : '');
  86. }
  87. }
  88. return 0; // return ok
  89. }
  90. }