prelevement.lib.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
  3. * Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.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. * or see http://www.gnu.org/
  19. */
  20. /**
  21. * \file htdocs/core/lib/prelevement.lib.php
  22. * \brief Ensemble de fonctions de base pour le module prelevement
  23. * \ingroup propal
  24. */
  25. /**
  26. * Prepare array with list of tabs
  27. *
  28. * @param Object $object Object related to tabs
  29. * @return array Array of tabs to shoc
  30. */
  31. function prelevement_prepare_head($object)
  32. {
  33. global $langs, $conf, $user;
  34. $langs->load("withdrawals");
  35. $h = 0;
  36. $head = array();
  37. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$object->id;
  38. $head[$h][1] = $langs->trans("Card");
  39. $head[$h][2] = 'prelevement';
  40. $h++;
  41. if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
  42. {
  43. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$object->id;
  44. $head[$h][1] = $langs->trans("Preview");
  45. $head[$h][2] = 'preview';
  46. $h++;
  47. }
  48. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$object->id;
  49. $head[$h][1] = $langs->trans("Lines");
  50. $head[$h][2] = 'lines';
  51. $h++;
  52. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id;
  53. $head[$h][1] = $langs->trans("Bills");
  54. $head[$h][2] = 'invoices';
  55. $h++;
  56. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$object->id;
  57. $head[$h][1] = $langs->trans("Rejects");
  58. $head[$h][2] = 'rejects';
  59. $h++;
  60. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$object->id;
  61. $head[$h][1] = $langs->trans("Statistics");
  62. $head[$h][2] = 'statistics';
  63. $h++;
  64. // Show more tabs from modules
  65. // Entries must be declared in modules descriptor with line
  66. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  67. // $this->tabs = array('entity:-tabname); to remove a tab
  68. complete_head_from_modules($conf,$langs,$object,$head,$h,'prelevement');
  69. complete_head_from_modules($conf,$langs,$object,$head,$h,'prelevement','remove');
  70. return $head;
  71. }
  72. /**
  73. * Check need data to create standigns orders receipt file
  74. *
  75. * @return int -1 if ko 0 if ok
  76. */
  77. function prelevement_check_config()
  78. {
  79. global $conf;
  80. if(empty($conf->global->PRELEVEMENT_USER)) return -1;
  81. if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
  82. if(empty($conf->global->PRELEVEMENT_NUMERO_NATIONAL_EMETTEUR)) return -1;
  83. return 0;
  84. }