html.formbank.class.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
  4. * Copyright (C) 2016 Marcos García <marcosgdf@gmail.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 <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/core/class/html.formbank.class.php
  21. * \ingroup core
  22. * \brief File of class with all html predefined components
  23. */
  24. /**
  25. * Class to manage generation of HTML components for bank module
  26. */
  27. class FormBank
  28. {
  29. /**
  30. * @var DoliDB Database handler.
  31. */
  32. public $db;
  33. /**
  34. * @var string Error code (or message)
  35. */
  36. public $error='';
  37. /**
  38. * Constructor
  39. *
  40. * @param DoliDB $db Database handler
  41. */
  42. public function __construct($db)
  43. {
  44. $this->db = $db;
  45. }
  46. /**
  47. * Retourne la liste des types de comptes financiers
  48. *
  49. * @param integer $selected Type pre-selectionne
  50. * @param string $htmlname Nom champ formulaire
  51. * @return void
  52. */
  53. public function selectTypeOfBankAccount($selected = Account::TYPE_CURRENT, $htmlname = 'type')
  54. {
  55. $account = new Account($this->db);
  56. print Form::selectarray($htmlname, $account->type_lib, $selected);
  57. }
  58. /**
  59. * Returns the name of the Iban label. India uses 'IFSC' and the rest of the world 'IBAN' name.
  60. *
  61. * @param Account $account Account object
  62. * @return string
  63. */
  64. public static function getIBANLabel(Account $account)
  65. {
  66. if ($account->getCountryCode() == 'IN') {
  67. return 'IFSC';
  68. }
  69. return 'IBANNumber';
  70. }
  71. }