html.formbank.class.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. var $db;
  30. var $error;
  31. /**
  32. * Constructor
  33. *
  34. * @param DoliDB $db Database handler
  35. */
  36. public function __construct($db)
  37. {
  38. $this->db = $db;
  39. }
  40. /**
  41. * Retourne la liste des types de comptes financiers
  42. *
  43. * @param integer $selected Type pre-selectionne
  44. * @param string $htmlname Nom champ formulaire
  45. * @return void
  46. */
  47. public function selectTypeOfBankAccount($selected = Account::TYPE_CURRENT, $htmlname = 'type')
  48. {
  49. $account = new Account($this->db);
  50. print Form::selectarray($htmlname, $account->type_lib, $selected);
  51. }
  52. /**
  53. * Returns the name of the Iban label. India uses 'IFSC' and the rest of the world 'IBAN' name.
  54. *
  55. * @param Account $account Account object
  56. * @return string
  57. */
  58. public static function getIBANLabel(Account $account)
  59. {
  60. if ($account->getCountryCode() == 'IN') {
  61. return 'IFSC';
  62. }
  63. return 'IBANNumber';
  64. }
  65. }