html.formbank.class.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
  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 <https://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. include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
  25. /**
  26. * Class to manage generation of HTML components for bank module
  27. */
  28. class FormBank
  29. {
  30. /**
  31. * @var DoliDB Database handler.
  32. */
  33. public $db;
  34. /**
  35. * @var string Error code (or message)
  36. */
  37. public $error = '';
  38. /**
  39. * Constructor
  40. *
  41. * @param DoliDB $db Database handler
  42. */
  43. public function __construct($db)
  44. {
  45. $this->db = $db;
  46. }
  47. /**
  48. * Retourne la liste des types de comptes financiers
  49. *
  50. * @param integer $selected Type pre-selectionne
  51. * @param string $htmlname Nom champ formulaire
  52. * @return void
  53. */
  54. public function selectTypeOfBankAccount($selected = Account::TYPE_CURRENT, $htmlname = 'type')
  55. {
  56. $account = new Account($this->db);
  57. print Form::selectarray($htmlname, $account->type_lib, $selected);
  58. }
  59. /**
  60. * Returns the name of the Iban label. India uses 'IFSC' and the rest of the world 'IBAN' name.
  61. *
  62. * @param Account $account Account object
  63. * @return string
  64. */
  65. public static function getIBANLabel(Account $account)
  66. {
  67. if ($account->getCountryCode() == 'IN') {
  68. return 'IFSC';
  69. }
  70. return 'IBANNumber';
  71. }
  72. }