dolibarr  17.0.4
prelevement.lib.php
Go to the documentation of this file.
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@inodbox.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  * or see https://www.gnu.org/
19  */
20 
35 {
36  global $langs, $conf, $user;
37  $langs->load("withdrawals");
38 
39  $h = 0;
40  $head = array();
41 
42  $titleoftab = "WithdrawalsReceipts";
43  if ($object->type == 'bank-transfer') {
44  $titleoftab = "BankTransferReceipts";
45  }
46 
47  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$object->id;
48  $head[$h][1] = $langs->trans($titleoftab);
49  $head[$h][2] = 'prelevement';
50  $h++;
51 
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 
57  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$object->id;
58  $head[$h][1] = $langs->trans("Rejects");
59  $head[$h][2] = 'rejects';
60  $h++;
61 
62  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$object->id;
63  $head[$h][1] = $langs->trans("Statistics");
64  $head[$h][2] = 'statistics';
65  $h++;
66 
67  // Show more tabs from modules
68  // Entries must be declared in modules descriptor with line
69  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
70  // $this->tabs = array('entity:-tabname); to remove a tab
71  complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement');
72 
73  complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement', 'remove');
74 
75  return $head;
76 }
77 
85 function prelevement_check_config($type = 'direct-debit')
86 {
87  global $conf, $db;
88  if ($type == 'bank-transfer') {
89  if (empty($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT)) {
90  return -1;
91  }
92  //if (empty($conf->global->PRELEVEMENT_ICS)) return -1;
93  if (empty($conf->global->PAYMENTBYBANKTRANSFER_USER)) {
94  return -1;
95  }
96  } else {
97  if (empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) {
98  return -1;
99  }
100  //if (empty($conf->global->PRELEVEMENT_ICS)) return -1;
101  if (empty($conf->global->PRELEVEMENT_USER)) {
102  return -1;
103  }
104  }
105  return 0;
106 }
Class to manage withdrawal receipts.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
prelevement_prepare_head(BonPrelevement $object)
Prepare array with list of tabs.
prelevement_check_config($type='direct-debit')
Check need data to create standigns orders receipt file.