prelevement.lib.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 BonPrelevement $object Object related to tabs
  29. * @return array Array of tabs to show
  30. */
  31. function prelevement_prepare_head(BonPrelevement $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/card.php?id='.$object->id;
  38. $head[$h][1] = $langs->trans("Card");
  39. $head[$h][2] = 'prelevement';
  40. $h++;
  41. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id;
  42. $head[$h][1] = $langs->trans("Bills");
  43. $head[$h][2] = 'invoices';
  44. $h++;
  45. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$object->id;
  46. $head[$h][1] = $langs->trans("Rejects");
  47. $head[$h][2] = 'rejects';
  48. $h++;
  49. $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$object->id;
  50. $head[$h][1] = $langs->trans("Statistics");
  51. $head[$h][2] = 'statistics';
  52. $h++;
  53. // Show more tabs from modules
  54. // Entries must be declared in modules descriptor with line
  55. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  56. // $this->tabs = array('entity:-tabname); to remove a tab
  57. complete_head_from_modules($conf,$langs,$object,$head,$h,'prelevement');
  58. complete_head_from_modules($conf,$langs,$object,$head,$h,'prelevement','remove');
  59. return $head;
  60. }
  61. /**
  62. * Check need data to create standigns orders receipt file
  63. *
  64. * @return int -1 if ko 0 if ok
  65. */
  66. function prelevement_check_config()
  67. {
  68. global $conf;
  69. if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
  70. if(empty($conf->global->PRELEVEMENT_ICS)) return -1;
  71. if(empty($conf->global->PRELEVEMENT_USER)) return -1;
  72. return 0;
  73. }