36 global $db, $langs, $conf, $user;
40 $head[$h][0] = DOL_URL_ROOT .
'/compta/bank/card.php?id=' . $object->id;
41 $head[$h][1] = $langs->trans(
"Card");
42 $head[$h][2] =
'bankname';
45 $head[$h][0] = DOL_URL_ROOT .
"/compta/bank/bankentries_list.php?id=" . $object->id;
46 $head[$h][1] = $langs->trans(
"BankTransactions");
47 $head[$h][2] =
'journal';
52 $head[$h][0] = DOL_URL_ROOT .
"/compta/bank/treso.php?account=" . $object->id;
53 $head[$h][1] = $langs->trans(
"PlannedTransactions");
54 $head[$h][2] =
'cash';
58 $head[$h][0] = DOL_URL_ROOT .
"/compta/bank/annuel.php?account=" . $object->id;
59 $head[$h][1] = $langs->trans(
"IOMonthlyReporting");
60 $head[$h][2] =
'annual';
63 $head[$h][0] = DOL_URL_ROOT .
"/compta/bank/graph.php?account=" . $object->id;
64 $head[$h][1] = $langs->trans(
"Graph");
65 $head[$h][2] =
'graph';
73 $sql =
"SELECT COUNT(DISTINCT(b.num_releve)) as nb";
74 $sql.=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
75 $sql.=
" WHERE b.fk_account = ".$object->id;
80 $obj = $db->fetch_object(
$resql);
81 if ($obj) $nbReceipts = $obj->nb;
85 $head[$h][0] = DOL_URL_ROOT.
"/compta/bank/releve.php?account=".$object->id;
86 $head[$h][1] = $langs->trans(
"AccountStatements");
87 if (($nbReceipts) > 0) $head[$h][1].=
' <span class="badge">'.($nbReceipts).
'</span>';
88 $head[$h][2] =
'statement';
93 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
94 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
96 $nbFiles = count(
dol_dir_list($upload_dir,
'files',0,
'',
'(\.meta|_preview.*\.png)$'));
97 $nbLinks=
Link::count($db, $object->element, $object->id);
98 $head[$h][0] = DOL_URL_ROOT .
"/compta/bank/document.php?account=" . $object->id;
99 $head[$h][1] = $langs->trans(
"Documents");
100 if (($nbFiles+$nbLinks) > 0) $head[$h][1].=
' <span class="badge">'.($nbFiles+$nbLinks).
'</span>';
101 $head[$h][2] =
'document';
127 global $langs, $conf, $user;
131 $head[$h][0] = DOL_URL_ROOT .
'/admin/bank.php';
132 $head[$h][1] = $langs->trans(
"Miscellaneous");
133 $head[$h][2] =
'general';
136 $head[$h][0] = DOL_URL_ROOT .
'/admin/chequereceipts.php';
137 $head[$h][1] = $langs->trans(
"CheckReceiptShort");
138 $head[$h][2] =
'checkreceipts';
148 $head[$h][0] = DOL_URL_ROOT.
'/admin/bank_extrafields.php';
149 $head[$h][1] = $langs->trans(
"ExtraFields");
150 $head[$h][2] =
'attributes';
167 global $db, $langs, $conf;
172 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/card.php?id='.$object->id;
173 $head[$h][1] = $langs->trans(
"Card");
174 $head[$h][2] =
'card';
183 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
184 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
186 $nbFiles = count(
dol_dir_list($upload_dir,
'files',0,
'',
'(\.meta|_preview.*\.png)$'));
187 $nbLinks=
Link::count($db, $object->element, $object->id);
188 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/document.php?id='.$object->id;
189 $head[$h][1] = $langs->trans(
'Documents');
190 if (($nbFiles+$nbLinks) > 0) $head[$h][1].=
' <span class="badge">'.($nbFiles+$nbLinks).
'</span>';
191 $head[$h][2] =
'documents';
194 $head[$h][0] = DOL_URL_ROOT.
'/compta/bank/various_payment/info.php?id='.$object->id;
195 $head[$h][1] = $langs->trans(
"Info");
196 $head[$h][2] =
'info';
212 $swift = $account->bic;
213 if (preg_match(
"/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/", $swift)) {
228 require_once DOL_DOCUMENT_ROOT.
'/includes/php-iban/oophp-iban.php';
230 $iban =
new IBAN($account->iban);
231 $check = $iban->Verify();
233 if ($check)
return true;
245 $country_code = $account->getCountryCode();
250 if (empty($account->number))
251 $account->number = $account->num_compte;
252 if (empty($account->cle))
253 $account->cle = $account->cle_rib;
255 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);
257 if ($country_code ==
'FR') {
258 $coef = array(62, 34, 3);
260 $rib = strtolower(trim($account->code_banque) . trim($account->code_guichet) . trim($account->number) . trim($account->cle));
263 $rib = strtr($rib,
"abcdefghijklmnopqrstuvwxyz",
"12345678912345678923456789");
267 for ($i = 0, $s = 0; $i < 3; $i++) {
268 $code = substr($rib, 7 * $i, 7);
269 $s += (0 + (int) $code) * $coef[$i];
272 $cle_rib = 97 - ($s % 97);
273 if ($cle_rib == $account->cle) {
279 if ($country_code ==
'BE') {
283 if ($country_code ==
'ES') {
284 $CCC = strtolower(trim($account->number));
285 $rib = strtolower(trim($account->code_banque) . trim($account->code_guichet));
286 $cle_rib = strtolower(
checkES($rib, $CCC));
287 if ($cle_rib == strtolower($account->cle)) {
292 if ($country_code ==
'AU') {
293 if (strlen($account->code_banque) > 7)
295 else if (strlen($account->code_banque) < 6)
304 if (empty($account->number)) {
322 if (empty($IentOfi) || empty($InumCta) || strlen($IentOfi) != 8 || strlen($InumCta) != 10) {
327 $ccc = $IentOfi . $InumCta;
328 $numbers =
"1234567890";
332 while ($i <= strlen($ccc) - 1) {
333 if (strpos($numbers, substr($ccc, $i, 1)) ===
false) {
340 $values = array(1, 2, 4, 8, 5, 10, 9, 7, 3, 6);
343 for ($i = 2; $i < 10; $i++) {
344 $sum += $values[$i] * substr($IentOfi, $i - 2, 1);
347 $key = 11 - $sum % 11;
358 for ($i = 0; $i < 11; $i++) {
359 $sum += $values[$i] * (int) substr($InumCta, $i, 1);
362 $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.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->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) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
bank_prepare_head(Account $object)
Prepare array with list of tabs.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add')
Complete or removed entries into a head array (used to build tabs).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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='')
Write log message into outputs.
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.