39 global $db, $langs, $conf, $user;
43 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/card.php?id='.$object->id;
44 $head[$h][1] = $langs->trans(
"BankAccount");
45 $head[$h][2] =
'bankname';
48 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/bankentries_list.php?id=".$object->id;
49 $head[$h][1] = $langs->trans(
"BankTransactions");
50 $head[$h][2] =
'journal';
55 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/treso.php?account=".$object->id;
56 $head[$h][1] = $langs->trans(
"PlannedTransactions");
57 $head[$h][2] =
'cash';
61 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/annuel.php?account=".$object->id;
62 $head[$h][1] = $langs->trans(
"IOMonthlyReporting");
63 $head[$h][2] =
'annual';
66 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/graph.php?account=".$object->id;
67 $head[$h][1] = $langs->trans(
"Graph");
68 $head[$h][2] =
'graph';
71 if ($object->courant !=
Account::TYPE_CASH || !empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) {
75 $sql =
"SELECT COUNT(DISTINCT(b.num_releve)) as nb";
76 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
77 $sql .=
" WHERE b.fk_account = ".((int) $object->id);
81 $obj = $db->fetch_object(
$resql);
83 $nbReceipts = $obj->nb;
88 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/releve.php?account=".((int) $object->id);
89 $head[$h][1] = $langs->trans(
"AccountStatements");
90 if (($nbReceipts) > 0) {
91 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbReceipts).
'</span>';
93 $head[$h][2] =
'statement';
98 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
99 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
101 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
102 $nbLinks =
Link::count($db, $object->element, $object->id);
103 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/document.php?account=".$object->id;
104 $head[$h][1] = $langs->trans(
"Documents");
105 if (($nbFiles + $nbLinks) > 0) {
106 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
108 $head[$h][2] =
'document';
134 global $langs, $conf, $user;
138 $head[$h][0] = DOL_URL_ROOT.
'/admin/bank.php';
139 $head[$h][1] = $langs->trans(
"Miscellaneous");
140 $head[$h][2] =
'general';
143 $head[$h][0] = DOL_URL_ROOT.
'/admin/chequereceipts.php';
144 $head[$h][1] = $langs->trans(
"CheckReceiptShort");
145 $head[$h][2] =
'checkreceipts';
155 $head[$h][0] = DOL_URL_ROOT.
'/admin/bank_extrafields.php';
156 $head[$h][1] = $langs->trans(
"ExtraFields");
157 $head[$h][2] =
'attributes';
176 global $langs, $conf, $user, $db;
180 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/releve.php?account='.$object->id.
'&num='.$num;
181 $head[$h][1] = $langs->trans(
"AccountStatement");
182 $head[$h][2] =
'statement';
186 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
187 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
189 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
190 $nbLinks =
Link::count($db, $object->element, $object->id);
192 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/account_statement_document.php?account=".$object->id.
"&num=".$num;
193 $head[$h][1] = $langs->trans(
"Documents");
194 if (($nbFiles + $nbLinks) > 0) {
195 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
197 $head[$h][2] =
'document';
216 global $db, $langs, $conf;
221 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?id='.$object->id;
222 $head[$h][1] = $langs->trans(
"VariousPayment");
223 $head[$h][2] =
'card';
232 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
233 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
235 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
236 $nbLinks =
Link::count($db, $object->element, $object->id);
237 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/document.php?id='.$object->id;
238 $head[$h][1] = $langs->trans(
'Documents');
239 if (($nbFiles + $nbLinks) > 0) {
240 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
242 $head[$h][2] =
'documents';
245 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/info.php?id='.$object->id;
246 $head[$h][1] = $langs->trans(
"Info");
247 $head[$h][2] =
'info';
263 $swift = $account->bic;
264 if (preg_match(
"/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/", $swift)) {
279 require_once DOL_DOCUMENT_ROOT.
'/includes/php-iban/oophp-iban.php';
281 $ibantocheck = ($account->iban ? $account->iban : $account->iban_prefix);
283 $iban =
new PHP_IBAN\IBAN($ibantocheck);
284 $check = $iban->Verify();
301 $country_code = $account->getCountryCode();
306 if (empty($account->number)) {
307 $account->number = $account->num_compte;
309 if (empty($account->cle)) {
310 $account->cle = $account->cle_rib;
313 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);
315 if ($country_code ==
'FR') {
316 $coef = array(62, 34, 3);
318 $rib = strtolower(trim($account->code_banque).trim($account->code_guichet).trim($account->number).trim($account->cle));
321 $rib = strtr($rib,
"abcdefghijklmnopqrstuvwxyz",
"12345678912345678923456789");
325 for ($i = 0, $s = 0; $i < 3; $i++) {
326 $code = substr($rib, 7 * $i, 7);
327 $s += (0 + (int) $code) * $coef[$i];
330 $cle_rib = 97 - ($s % 97);
331 if ($cle_rib == $account->cle) {
337 if ($country_code ==
'BE') {
340 if ($country_code ==
'ES') {
341 $CCC = strtolower(trim($account->number));
342 $rib = strtolower(trim($account->code_banque).trim($account->code_guichet));
343 $cle_rib = strtolower(
checkES($rib, $CCC));
344 if ($cle_rib == strtolower($account->cle)) {
349 if ($country_code ==
'AU') {
350 if (strlen($account->code_banque) > 7) {
352 } elseif (strlen($account->code_banque) < 6) {
362 if (empty($account->number)) {
380 if (empty($IentOfi) || empty($InumCta) || strlen($IentOfi) != 8 || strlen($InumCta) != 10) {
385 $ccc = $IentOfi.$InumCta;
386 $numbers =
"1234567890";
390 while ($i <= strlen($ccc) - 1) {
391 if (strpos($numbers, substr($ccc, $i, 1)) ===
false) {
398 $values = array(1, 2, 4, 8, 5, 10, 9, 7, 3, 6);
401 for ($i = 2; $i < 10; $i++) {
402 $sum += $values[$i] * substr($IentOfi, $i - 2, 1);
405 $key = 11 - $sum % 11;
418 for ($i = 0; $i < 11; $i++) {
419 $sum += $values[$i] * (int) substr($InumCta, $i, 1);
422 $key = 11 - $sum % 11;