37 global $db, $langs, $conf, $user;
41 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/card.php?id='.$object->id;
42 $head[$h][1] = $langs->trans(
"BankAccount");
43 $head[$h][2] =
'bankname';
46 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/bankentries_list.php?id=".$object->id;
47 $head[$h][1] = $langs->trans(
"BankTransactions");
48 $head[$h][2] =
'journal';
53 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/treso.php?account=".$object->id;
54 $head[$h][1] = $langs->trans(
"PlannedTransactions");
55 $head[$h][2] =
'cash';
59 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/annuel.php?account=".$object->id;
60 $head[$h][1] = $langs->trans(
"IOMonthlyReporting");
61 $head[$h][2] =
'annual';
64 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/graph.php?account=".$object->id;
65 $head[$h][1] = $langs->trans(
"Graph");
66 $head[$h][2] =
'graph';
74 $sql =
"SELECT COUNT(DISTINCT(b.num_releve)) as nb";
75 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
76 $sql .=
" WHERE b.fk_account = ".$object->id;
81 $obj = $db->fetch_object(
$resql);
82 if ($obj) $nbReceipts = $obj->nb;
86 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/releve.php?account=".$object->id;
87 $head[$h][1] = $langs->trans(
"AccountStatements");
88 if (($nbReceipts) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbReceipts).
'</span>';
89 $head[$h][2] =
'statement';
94 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
95 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
97 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
98 $nbLinks =
Link::count($db, $object->element, $object->id);
99 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/document.php?account=".$object->id;
100 $head[$h][1] = $langs->trans(
"Documents");
101 if (($nbFiles + $nbLinks) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
102 $head[$h][2] =
'document';
128 global $langs, $conf, $user;
132 $head[$h][0] = DOL_URL_ROOT.
'/admin/bank.php';
133 $head[$h][1] = $langs->trans(
"Miscellaneous");
134 $head[$h][2] =
'general';
137 $head[$h][0] = DOL_URL_ROOT.
'/admin/chequereceipts.php';
138 $head[$h][1] = $langs->trans(
"CheckReceiptShort");
139 $head[$h][2] =
'checkreceipts';
149 $head[$h][0] = DOL_URL_ROOT.
'/admin/bank_extrafields.php';
150 $head[$h][1] = $langs->trans(
"ExtraFields");
151 $head[$h][2] =
'attributes';
170 global $langs, $conf, $user, $db;
174 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/releve.php?account='.$object->id.
'&num='.$num;
175 $head[$h][1] = $langs->trans(
"AccountStatement");
176 $head[$h][2] =
'statement';
180 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
181 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
183 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
184 $nbLinks =
Link::count($db, $object->element, $object->id);
186 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/account_statement_document.php?account=".$object->id.
"&num=".$num;
187 $head[$h][1] = $langs->trans(
"Documents");
188 if (($nbFiles + $nbLinks) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
189 $head[$h][2] =
'document';
208 global $db, $langs, $conf;
213 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?id='.$object->id;
214 $head[$h][1] = $langs->trans(
"VariousPayment");
215 $head[$h][2] =
'card';
224 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
225 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
227 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
228 $nbLinks =
Link::count($db, $object->element, $object->id);
229 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/document.php?id='.$object->id;
230 $head[$h][1] = $langs->trans(
'Documents');
231 if (($nbFiles + $nbLinks) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
232 $head[$h][2] =
'documents';
235 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/info.php?id='.$object->id;
236 $head[$h][1] = $langs->trans(
"Info");
237 $head[$h][2] =
'info';
253 $swift = $account->bic;
254 if (preg_match(
"/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/", $swift)) {
269 require_once DOL_DOCUMENT_ROOT.
'/includes/php-iban/oophp-iban.php';
271 $iban =
new IBAN($account->iban);
272 $check = $iban->Verify();
274 if ($check)
return true;
286 $country_code = $account->getCountryCode();
291 if (empty($account->number))
292 $account->number = $account->num_compte;
293 if (empty($account->cle))
294 $account->cle = $account->cle_rib;
296 dol_syslog(
"bank.lib::checkBanForAccount account->code_banque=".$account->code_banque.
" account->code_guichet=".$account->code_guichet.
" account->number=".$account->number.
" account->cle=".$account->cle.
" account->iban=".$account->iban.
" country_code=".$country_code, LOG_DEBUG);
298 if ($country_code ==
'FR') {
299 $coef = array(62, 34, 3);
301 $rib = strtolower(trim($account->code_banque).trim($account->code_guichet).trim($account->number).trim($account->cle));
304 $rib = strtr($rib,
"abcdefghijklmnopqrstuvwxyz",
"12345678912345678923456789");
308 for ($i = 0, $s = 0; $i < 3; $i++) {
309 $code = substr($rib, 7 * $i, 7);
310 $s += (0 + (int) $code) * $coef[$i];
313 $cle_rib = 97 - ($s % 97);
314 if ($cle_rib == $account->cle) {
320 if ($country_code ==
'BE') {
323 if ($country_code ==
'ES') {
324 $CCC = strtolower(trim($account->number));
325 $rib = strtolower(trim($account->code_banque).trim($account->code_guichet));
326 $cle_rib = strtolower(
checkES($rib, $CCC));
327 if ($cle_rib == strtolower($account->cle)) {
332 if ($country_code ==
'AU') {
333 if (strlen($account->code_banque) > 7)
335 elseif (strlen($account->code_banque) < 6)
343 if (empty($account->number)) {
361 if (empty($IentOfi) || empty($InumCta) || strlen($IentOfi) != 8 || strlen($InumCta) != 10) {
366 $ccc = $IentOfi.$InumCta;
367 $numbers =
"1234567890";
371 while ($i <= strlen($ccc) - 1) {
372 if (strpos($numbers, substr($ccc, $i, 1)) ===
false) {
379 $values = array(1, 2, 4, 8, 5, 10, 9, 7, 3, 6);
382 for ($i = 2; $i < 10; $i++) {
383 $sum += $values[$i] * substr($IentOfi, $i - 2, 1);
386 $key = 11 - $sum % 11;
397 for ($i = 0; $i < 11; $i++) {
398 $sum += $values[$i] * (int) substr($InumCta, $i, 1);
401 $key = 11 - $sum % 11;
checkES($IentOfi, $InumCta)
Returns the key for Spanish Banks Accounts.
bank_admin_prepare_head($object)
Prepare array with list of tabs.
bank_prepare_head(Account $object)
Prepare array with list of tabs.
account_statement_prepare_head($object, $num)
Prepare array with list of tabs.
various_payment_prepare_head($object)
Prepare array with list of tabs.
checkSwiftForAccount($account)
Check SWIFT informations for a bank account.
Class to manage bank accounts.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
const TYPE_CASH
Cash account.
static count($db, $objecttype, $objectid)
Return nb of links.
checkBanForAccount($account)
Check account number informations for a bank account.
checkIbanForAccount($account)
Check IBAN number informations for a bank account.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).