dolibarr  x.y.z
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
7  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
8  * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
9  * Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
10  * Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>.
24  */
25 
32 // Load Dolibarr environment
33 require '../../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
39 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
40 if (isModEnabled('categorie')) {
41  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
42 }
43 if (isModEnabled('accounting')) {
44  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
45 }
46 if (isModEnabled('accounting')) {
47  require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
48 }
49 if (isModEnabled('accounting')) {
50  require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
51 }
52 
53 // Load translation files required by the page
54 $langs->loadLangs(array("banks", "bills", "categories", "companies", "compta"));
55 
56 $action = GETPOST('action', 'aZ09');
57 $cancel = GETPOST('cancel', 'alpha');
58 
59 $object = new Account($db);
60 $extrafields = new ExtraFields($db);
61 
62 // fetch optionals attributes and labels
63 $extrafields->fetch_name_optionals_label($object->table_element);
64 
65 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
66 $hookmanager->initHooks(array('bankcard', 'globalcard'));
67 
68 // Security check
69 $id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha');
70 $fieldid = GETPOST("id", 'int') ? 'rowid' : 'ref';
71 
72 if (GETPOST("id", 'int') || GETPOST("ref")) {
73  if (GETPOST("id", 'int')) {
74  $object->fetch(GETPOST("id", 'int'));
75  }
76  if (GETPOST("ref")) {
77  $object->fetch(0, GETPOST("ref"));
78  }
79 }
80 
81 $result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
82 
83 
84 /*
85  * Actions
86  */
87 
88 $parameters = array();
89 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
90 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
91 
92 if (empty($reshook)) {
93  $backurlforlist = DOL_URL_ROOT.'/compta/bank/list.php';
94 
95  if (empty($backtopage) || ($cancel && empty($id))) {
96  if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
97  if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
98  $backtopage = $backurlforlist;
99  } else {
100  $backtopage = DOL_URL_ROOT.'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
101  }
102  }
103  }
104 
105  if ($cancel) {
106  if (!empty($backtopageforcancel)) {
107  header("Location: ".$backtopageforcancel);
108  exit;
109  } elseif (!empty($backtopage)) {
110  header("Location: ".$backtopage);
111  exit;
112  }
113  $action = '';
114  }
115 
116  if ($action == 'add') {
117  $error = 0;
118 
119  $db->begin();
120 
121  // Create account
122  $object = new Account($db);
123 
124  $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
125  $object->label = trim(GETPOST("label", 'alphanohtml'));
126  $object->courant = GETPOST("type");
127  $object->clos = GETPOST("clos");
128  $object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
129  $object->url = trim(GETPOST("url", 'alpha'));
130 
131  $object->bank = trim(GETPOST("bank"));
132  $object->code_banque = trim(GETPOST("code_banque"));
133  $object->code_guichet = trim(GETPOST("code_guichet"));
134  $object->number = trim(GETPOST("number"));
135  $object->cle_rib = trim(GETPOST("cle_rib"));
136  $object->bic = trim(GETPOST("bic"));
137  $object->iban = trim(GETPOST("iban"));
138  $object->domiciliation = trim(GETPOST("domiciliation", "alphanohtml"));
139  $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1;
140 
141  $object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
142  $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml'));
143 
144  $object->ics = trim(GETPOST("ics", 'alpha'));
145  $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'));
146 
147  $account_number = GETPOST('account_number', 'alphanohtml');
148  if (empty($account_number) || $account_number == '-1') {
149  $object->account_number = '';
150  } else {
151  $object->account_number = $account_number;
152  }
153  $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
154  if ($fk_accountancy_journal <= 0) {
155  $object->fk_accountancy_journal = '';
156  } else {
157  $object->fk_accountancy_journal = $fk_accountancy_journal;
158  }
159 
160  $object->solde = price2num(GETPOST("solde"));
161  $object->date_solde = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST("reyear", 'int'));
162 
163  $object->currency_code = trim(GETPOST("account_currency_code"));
164 
165  $object->state_id = GETPOST("account_state_id", 'int');
166  $object->country_id = GETPOST("account_country_id", 'int');
167 
168  $object->min_allowed = GETPOST("account_min_allowed", 'int');
169  $object->min_desired = GETPOST("account_min_desired", 'int');
170  $object->comment = trim(GETPOST("account_comment", 'restricthtml'));
171 
172  $object->fk_user_author = $user->id;
173 
174  if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
175  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
176  $action = 'create'; // Force chargement page en mode creation
177  $error++;
178  }
179  if (empty($object->ref)) {
180  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
181  $action = 'create'; // Force chargement page en mode creation
182  $error++;
183  }
184  if (empty($object->label)) {
185  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
186  $action = 'create'; // Force chargement page en mode creation
187  $error++;
188  }
189 
190  // Fill array 'array_options' with data from add form
191  $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
192 
193  if (!$error) {
194  $id = $object->create($user);
195  if ($id > 0) {
196  // Category association
197  $categories = GETPOST('categories', 'array');
198  $object->setCategories($categories);
199 
200  $_GET["id"] = $id; // Force chargement page en mode visu
201 
202  $action = '';
203  } else {
204  $error++;
205  setEventMessages($object->error, $object->errors, 'errors');
206 
207  $action = 'create'; // Force chargement page en mode creation
208  }
209  }
210 
211  if (!$error) {
212  $db->commit();
213  } else {
214  $db->rollback();
215  }
216  }
217 
218  if ($action == 'update') {
219  $error = 0;
220 
221  // Update account
222  $object = new Account($db);
223  $object->fetch(GETPOST("id", 'int'));
224 
225  $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
226  $object->label = trim(GETPOST("label", 'alphanohtml'));
227  $object->courant = GETPOST("type");
228  $object->clos = GETPOST("clos");
229  $object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
230  $object->url = trim(GETPOST("url", 'alpha'));
231 
232  $object->bank = trim(GETPOST("bank"));
233  $object->code_banque = trim(GETPOST("code_banque"));
234  $object->code_guichet = trim(GETPOST("code_guichet"));
235  $object->number = trim(GETPOST("number"));
236  $object->cle_rib = trim(GETPOST("cle_rib"));
237  $object->bic = trim(GETPOST("bic"));
238  $object->iban = trim(GETPOST("iban"));
239  $object->domiciliation = trim(GETPOST("domiciliation", "alphanohtml"));
240  $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1;
241 
242  $object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
243  $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml'));
244 
245  $object->ics = trim(GETPOST("ics", 'alpha'));
246  $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'));
247 
248  $account_number = GETPOST('account_number', 'alphanohtml');
249  if (empty($account_number) || $account_number == '-1') {
250  $object->account_number = '';
251  } else {
252  $object->account_number = $account_number;
253  }
254  $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
255  if ($fk_accountancy_journal <= 0) {
256  $object->fk_accountancy_journal = '';
257  } else {
258  $object->fk_accountancy_journal = $fk_accountancy_journal;
259  }
260 
261  $object->currency_code = trim(GETPOST("account_currency_code"));
262 
263  $object->state_id = GETPOST("account_state_id", 'int');
264  $object->country_id = GETPOST("account_country_id", 'int');
265 
266  $object->min_allowed = GETPOST("account_min_allowed", 'int');
267  $object->min_desired = GETPOST("account_min_desired", 'int');
268  $object->comment = trim(GETPOST("account_comment", 'restricthtml'));
269 
270  if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
271  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
272  $action = 'edit'; // Force chargement page en mode creation
273  $error++;
274  }
275  if (empty($object->ref)) {
276  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
277  $action = 'edit'; // Force chargement page en mode creation
278  $error++;
279  }
280  if (empty($object->label)) {
281  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
282  $action = 'edit'; // Force chargement page en mode creation
283  $error++;
284  }
285 
286  $db->begin();
287 
288  if (!$error) {
289  // Fill array 'array_options' with data from add form
290  $ret = $extrafields->setOptionalsFromPost(null, $object);
291  }
292 
293  if (!$error) {
294  $result = $object->update($user);
295  if ($result >= 0) {
296  // Category association
297  $categories = GETPOST('categories', 'array');
298  $object->setCategories($categories);
299 
300  $_GET["id"] = GETPOST("id", 'int'); // Force chargement page en mode visu
301  } else {
302  $error++;
303  setEventMessages($object->error, $object->errors, 'errors');
304  $action = 'edit'; // Force chargement page edition
305  }
306  }
307 
308  if (!$error) {
309  $db->commit();
310  } else {
311  $db->rollback();
312  }
313  }
314 
315  if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->banque->configurer) {
316  // Delete
317  $object = new Account($db);
318  $object->fetch(GETPOST("id", "int"));
319  $result = $object->delete($user);
320 
321  if ($result > 0) {
322  setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
323  header("Location: " . DOL_URL_ROOT . "/compta/bank/list.php");
324  exit;
325  } else {
326  setEventMessages($object->error, $object->errors, 'errors');
327  $action = '';
328  }
329  }
330 }
331 
332 
333 /*
334  * View
335  */
336 
337 $form = new Form($db);
338 $formbank = new FormBank($db);
339 $formcompany = new FormCompany($db);
340 if (isModEnabled('accounting')) {
341  $formaccounting = new FormAccounting($db);
342 }
343 
344 $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
345 
346 $help_url = 'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
347 if ($action == 'create') {
348  $title = $langs->trans("NewFinancialAccount");
349 } elseif (!empty($object->ref)) {
350  $title = $object->ref." - ".$langs->trans("Card");
351 }
352 llxHeader("", $title, $help_url);
353 
354 // Creation
355 if ($action == 'create') {
356  print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account');
357 
358  if ($conf->use_javascript_ajax) {
359  print "\n".'<script type="text/javascript">';
360  print 'jQuery(document).ready(function () {
361  jQuery("#type").change(function() {
362  document.formsoc.action.value="create";
363  document.formsoc.submit();
364  });
365  jQuery("#selectaccount_country_id").change(function() {
366  document.formsoc.action.value="create";
367  document.formsoc.submit();
368  });
369  })';
370  print '</script>'."\n";
371  }
372 
373  print '<form action="'.$_SERVER["PHP_SELF"].'" name="formsoc" method="post">';
374  print '<input type="hidden" name="token" value="'.newToken().'">';
375  print '<input type="hidden" name="action" value="add">';
376  print '<input type="hidden" name="clos" value="0">';
377 
378  print dol_get_fiche_head('');
379 
380  print '<table class="border centpercent tableforfieldcreate">';
381 
382  // Ref
383  print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
384  print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
385 
386  // Label
387  print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
388  print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST('label', 'alpha')).'"></td></tr>';
389 
390  // Type
391  print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
392  print '<td>';
393  $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type');
394  print '</td></tr>';
395 
396  // Currency
397  print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
398  print '<td>';
399  $selectedcode = $object->currency_code;
400  if (!$selectedcode) {
401  $selectedcode = $conf->currency;
402  }
403  print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
404  //print $langs->trans("Currency".$conf->currency);
405  //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
406  print '</td></tr>';
407 
408  // Status
409  print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
410  print '<td>';
411  print $form->selectarray("clos", $object->status, (GETPOST('clos', 'int') != '' ? GETPOST('clos', 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
412  print '</td></tr>';
413 
414  // Country
415  $selectedcode = '';
416  if (GETPOSTISSET("account_country_id")) {
417  $selectedcode = GETPOST("account_country_id") ? GETPOST("account_country_id") : $object->country_code;
418  } elseif (empty($selectedcode)) {
419  $selectedcode = $mysoc->country_code;
420  }
421  $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
422 
423  print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
424  print '<td>';
425  print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id');
426  if ($user->admin) {
427  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
428  }
429  print '</td></tr>';
430 
431  // State
432  print '<tr><td>'.$langs->trans('State').'</td><td>';
433  if ($selectedcode) {
434  print img_picto('', 'state', 'class="pictofixedwidth"');
435  print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : '', $selectedcode, 'account_state_id');
436  } else {
437  print $countrynotdefined;
438  }
439  print '</td></tr>';
440 
441  // Web
442  print '<tr><td>'.$langs->trans("Web").'</td>';
443  print '<td>';
444  print img_picto('', 'globe', 'class="pictofixedwidth"');
445  print '<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST("url").'">';
446  print '</td></tr>';
447 
448  // Tags-Categories
449  if (isModEnabled('categorie')) {
450  print '<tr><td>'.$langs->trans("Categories").'</td><td>';
451  $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
452 
453  $arrayselected = array();
454  $c = new Categorie($db);
455  $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
456  if (is_array($cats)) {
457  foreach ($cats as $cat) {
458  $arrayselected[] = $cat->id;
459  }
460  }
461  print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
462  print "</td></tr>";
463  }
464 
465  // Comment
466  print '<tr><td>'.$langs->trans("Comment").'</td>';
467  print '<td>';
468  // Editor wysiwyg
469  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
470  $doleditor = new DolEditor('account_comment', (GETPOST("account_comment") ?GETPOST("account_comment") : $object->comment), '', 90, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_4, '90%');
471  $doleditor->Create();
472  print '</td></tr>';
473 
474  // Other attributes
475  $parameters = array();
476  $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
477  print $hookmanager->resPrint;
478  if (empty($reshook)) {
479  print $object->showOptionals($extrafields, 'create', $parameters);
480  }
481 
482  print '</table>';
483 
484  print '<br>';
485 
486  print '<table class="border centpercent">';
487 
488  // Sold
489  print '<tr><td class="titlefieldcreate">'.$langs->trans("InitialBankBalance").'</td>';
490  print '<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde") ?GETPOST("solde") : price2num($object->solde)).'"></td></tr>';
491 
492  print '<tr><td>'.$langs->trans("Date").'</td>';
493  print '<td>';
494  print $form->selectDate('', 're', 0, 0, 0, 'formsoc');
495  print '</td></tr>';
496 
497  print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
498  print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOST("account_min_allowed") ?GETPOST("account_min_allowed") : $object->min_allowed).'"></td></tr>';
499 
500  print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
501  print '<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOST("account_min_desired") ?GETPOST("account_min_desired") : $object->min_desired).'"></td></tr>';
502 
503  print '</table>';
504  print '<br>';
505 
506  $type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value
507  if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
508  print '<table class="border centpercent">';
509 
510  // If bank account
511  print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
512  print '<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST('bank') ?GETPOST('bank', 'alpha') : $object->bank).'"></td>';
513  print '</tr>';
514 
515  // Show fields of bank account
516  $sizecss = '';
517  foreach ($object->getFieldsToShow() as $val) {
518  $content = '';
519  if ($val == 'BankCode') {
520  $name = 'code_banque';
521  $sizecss = 'minwidth100';
522  $content = $object->code_banque;
523  } elseif ($val == 'DeskCode') {
524  $name = 'code_guichet';
525  $sizecss = 'minwidth100';
526  $content = $object->code_guichet;
527  } elseif ($val == 'BankAccountNumber') {
528  $name = 'number';
529  $sizecss = 'minwidth200';
530  $content = $object->number;
531  } elseif ($val == 'BankAccountNumberKey') {
532  $name = 'cle_rib';
533  $sizecss = 'minwidth50';
534  $content = $object->cle_rib;
535  }
536 
537  print '<td>'.$langs->trans($val).'</td>';
538  print '<td><input type="text" class="flat '.$sizecss.'" name="'.$name.'" value="'.(GETPOSTISSET($name) ? GETPOST($name, 'alpha') : $content).'"></td>';
539  print '</tr>';
540  }
541  $ibankey = FormBank::getIBANLabel($object);
542  $bickey = "BICNumber";
543  if ($object->getCountryCode() == 'IN') {
544  $bickey = "SWIFT";
545  }
546 
547  // IBAN
548  print '<tr><td>'.$langs->trans($ibankey).'</td>';
549  print '<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET('iban') ?GETPOST('iban', 'alpha') : $object->iban).'"></td></tr>';
550 
551  print '<tr><td>'.$langs->trans($bickey).'</td>';
552  print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
553 
554  if (isModEnabled('paymentbybanktransfer')) {
555  print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';
556  print '<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. (empty(GETPOST('pti_in_ctti')) ? '' : ' checked ') . '>&nbsp;';
557  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
558  print '</td></tr>';
559  }
560 
561  print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
562  print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
563  print (GETPOSTISSET('domiciliation') ?GETPOST('domiciliation') : $object->domiciliation);
564  print "</textarea></td></tr>";
565 
566  print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
567  print '<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST('proprio') ?GETPOST('proprio', 'alpha') : $object->proprio).'">';
568  print '</td></tr>';
569 
570  print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
571  print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
572  print (GETPOST('owner_address') ?GETPOST('owner_address', 'alpha') : $object->owner_address);
573  print "</textarea></td></tr>";
574 
575  print '</table>';
576  print '<br>';
577  }
578 
579  print '<table class="border centpercent">';
580  // Accountancy code
581  $fieldrequired = '';
582  if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
583  $fieldrequired = 'fieldrequired ';
584  }
585 
586  if (isModEnabled('accounting')) {
587  print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
588  print '<td>';
589  print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
590  print '</td></tr>';
591  } else {
592  print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
593  print '<td><input type="text" name="account_number" value="'.(GETPOST("account_number") ?GETPOST('account_number', 'alpha') : $object->account_number).'"></td></tr>';
594  }
595 
596  // Accountancy journal
597  if (isModEnabled('accounting')) {
598  print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
599  print '<td>';
600  print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
601  print '</td></tr>';
602  }
603 
604  print '</table>';
605 
606  print dol_get_fiche_end();
607 
608  print $form->buttonsSaveCancel("CreateAccount");
609 
610  print '</form>';
611 } else {
612  // View and edit mode
613  if ((GETPOST("id", 'int') || GETPOST("ref")) && $action != 'edit') {
614  // Show tabs
615  $head = bank_prepare_head($object);
616  print dol_get_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
617 
618  $formconfirm = '';
619 
620  // Confirmation to delete
621  if ($action == 'delete') {
622  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("DeleteAccount"), $langs->trans("ConfirmDeleteAccount"), "confirm_delete");
623  }
624 
625  // Print form confirm
626  print $formconfirm;
627 
628  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
629 
630  $morehtmlref = '';
631  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
632 
633 
634  print '<div class="fichecenter">';
635  print '<div class="fichehalfleft">';
636  print '<div class="underbanner clearboth"></div>';
637 
638  print '<table class="border tableforfield" width="100%">';
639 
640  // Type
641  print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
642  print '<td>'.$object->type_lib[$object->type].'</td></tr>';
643 
644  // Currency
645  print '<tr><td>'.$langs->trans("Currency").'</td>';
646  print '<td>';
647  $selectedcode = $object->currency_code;
648  if (!$selectedcode) {
649  $selectedcode = $conf->currency;
650  }
651  print $langs->trans("Currency".$selectedcode);
652  print '</td></tr>';
653 
654  // Conciliate
655  print '<tr><td>'.$langs->trans("Conciliable").'</td>';
656  print '<td>';
657  $conciliate = $object->canBeConciliated();
658  if ($conciliate == -2) {
659  print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("CashAccount").')</span>';
660  } elseif ($conciliate == -3) {
661  print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
662  } else {
663  print ($object->rappro == 1 ? $langs->trans("Yes") : ($langs->trans("No").' <span class="opacitymedium">('.$langs->trans("ConciliationDisabled").')</span>'));
664  }
665  print '</td></tr>';
666 
667  print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
668  print '<td>'.$object->min_allowed.'</td></tr>';
669 
670  print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
671  print '<td>'.$object->min_desired.'</td></tr>';
672 
673  // Accountancy code
674  print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
675  print '<td>';
676  if (isModEnabled('accounting')) {
677  $accountingaccount = new AccountingAccount($db);
678  $accountingaccount->fetch('', $object->account_number, 1);
679 
680  print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
681  } else {
682  print $object->account_number;
683  }
684  print '</td></tr>';
685 
686  // Accountancy journal
687  if (isModEnabled('accounting')) {
688  print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
689  print '<td>';
690 
691  if ($object->fk_accountancy_journal > 0) {
692  $accountingjournal = new AccountingJournal($db);
693  $accountingjournal->fetch($object->fk_accountancy_journal);
694 
695  print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
696  }
697  print '</td></tr>';
698  }
699 
700  // Other attributes
701  $cols = 2;
702  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
703 
704  print '</table>';
705 
706  print '</div>';
707  print '<div class="fichehalfright">';
708  print '<div class="underbanner clearboth"></div>';
709 
710  print '<table class="border tableforfield centpercent">';
711 
712  // Categories
713  if (isModEnabled('categorie')) {
714  print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
715  print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
716  print "</td></tr>";
717  }
718 
719  print '<tr><td class="tdtop titlefield">'.$langs->trans("Comment").'</td>';
720  print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
721 
722  print '</table>';
723 
724  if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
725  //print '<div class="underbanner clearboth"></div>';
726 
727  print '<table class="border tableforfield centpercent">';
728 
729  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("BankName").'</td>';
730  print '<td>'.$object->bank.'</td></tr>';
731 
732  // Show fields of bank account
733  foreach ($object->getFieldsToShow() as $val) {
734  $content = '';
735  if ($val == 'BankCode') {
736  $content = $object->code_banque;
737  } elseif ($val == 'DeskCode') {
738  $content = $object->code_guichet;
739  } elseif ($val == 'BankAccountNumber') {
740  $content = $object->number;
741  } elseif ($val == 'BankAccountNumberKey') {
742  $content = $object->cle_rib;
743  }
744 
745  print '<tr><td>'.$langs->trans($val).'</td>';
746  print '<td>'.$content.'</td>';
747  print '</tr>';
748  }
749 
750  $ibankey = FormBank::getIBANLabel($object);
751  $bickey = "BICNumber";
752  if ($object->getCountryCode() == 'IN') {
753  $bickey = "SWIFT";
754  }
755 
756  print '<tr><td>'.$langs->trans($ibankey).'</td>';
757  print '<td>'.getIbanHumanReadable($object).'&nbsp;';
758  if (!empty($object->iban)) {
759  if (!checkIbanForAccount($object)) {
760  print img_picto($langs->trans("IbanNotValid"), 'warning');
761  } else {
762  print img_picto($langs->trans("IbanValid"), 'info');
763  }
764  }
765  print '</td></tr>';
766 
767  print '<tr><td>'.$langs->trans($bickey).'</td>';
768  print '<td>'.$object->bic.'&nbsp;';
769  if (!empty($object->bic)) {
770  if (!checkSwiftForAccount($object)) {
771  print img_picto($langs->trans("SwiftNotValid"), 'warning');
772  } else {
773  print img_picto($langs->trans("SwiftValid"), 'info');
774  }
775  }
776  print '</td></tr>';
777 
778  if (isModEnabled('prelevement')) {
779  print '<tr><td>'.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').'</td>';
780  print '<td>'.$object->ics.'</td>';
781  print '</tr>';
782  }
783 
784  // TODO ICS is not used with bank transfer !
785  if (isModEnabled('paymentbybanktransfer')) {
786  print '<tr><td>'.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').'</td>';
787  print '<td>'.$object->ics_transfer.'</td>';
788  print '</tr>';
789 
790  print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td><td>';
791  print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")) . '&nbsp;';
792  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
793  print "</td></tr>\n";
794  }
795 
796  print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
797  print nl2br($object->domiciliation);
798  print "</td></tr>\n";
799 
800  print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td>';
801  print $object->proprio;
802  print "</td></tr>\n";
803 
804  print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
805  print nl2br($object->owner_address);
806  print "</td></tr>\n";
807 
808  print '</table>';
809  }
810 
811  print '</div>';
812  print '</div>';
813 
814  print '<div class="clearboth"></div>';
815 
816  print dol_get_fiche_end();
817 
818  /*
819  * Action bar
820  */
821  print '<div class="tabsAction">';
822 
823  if ($user->rights->banque->configurer) {
824  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
825  }
826 
827  $canbedeleted = $object->can_be_deleted(); // Renvoi vrai si compte sans mouvements
828  if ($user->rights->banque->configurer && $canbedeleted) {
829  print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
830  }
831 
832  print '</div>';
833  }
834 
835  /* ************************************************************************** */
836  /* */
837  /* Edition */
838  /* */
839  /* ************************************************************************** */
840 
841  if (GETPOST('id', 'int') && $action == 'edit' && $user->rights->banque->configurer) {
842  print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'bank_account');
843 
844  if ($conf->use_javascript_ajax) {
845  print "\n".'<script type="text/javascript">';
846  print 'jQuery(document).ready(function () {
847  jQuery("#type").change(function() {
848  document.formsoc.action.value="edit";
849  document.formsoc.submit();
850  });
851  })'."\n";
852 
853  print 'jQuery(document).ready(function () {
854  jQuery("#selectaccount_country_id").change(function() {
855  document.formsoc.action.value="edit";
856  document.formsoc.submit();
857  });
858  })';
859  print '</script>'."\n";
860  }
861 
862  print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post" name="formsoc">';
863  print '<input type="hidden" name="token" value="'.newToken().'">';
864  print '<input type="hidden" name="action" value="update">';
865  print '<input type="hidden" name="id" value="'.GETPOST("id", 'int').'">'."\n\n";
866 
867  print dol_get_fiche_head(array(), 0, '', 0);
868 
869  //print '<div class="underbanner clearboth"></div>';
870 
871  print '<table class="border centpercent tableforfieldcreate">';
872 
873  // Ref
874  print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
875  print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : $object->ref).'"></td></tr>';
876 
877  // Label
878  print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
879  print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET('label') ? GETPOST('label', 'alpha') : $object->label).'"></td></tr>';
880 
881  // Type
882  print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
883  print '<td class="maxwidth200onsmartphone">';
884  $formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type), 'type');
885  print '</td></tr>';
886 
887  // Currency
888  print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
889  print '<input type="hidden" value="'.$object->currency_code.'">';
890  print '</td>';
891  print '<td class="maxwidth200onsmartphone">';
892  $selectedcode = $object->currency_code;
893  if (!$selectedcode) {
894  $selectedcode = $conf->currency;
895  }
896  print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
897  print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
898  //print $langs->trans("Currency".$conf->currency);
899  //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
900  print '</td></tr>';
901 
902  // Status
903  print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
904  print '<td class="maxwidth200onsmartphone">';
905  print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos", "int") : $object->clos));
906  print '</td></tr>';
907 
908  // Country
909  $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
910  $selectedcode = $object->country_code;
911  if (GETPOSTISSET("account_country_id")) {
912  $selectedcode = GETPOST("account_country_id");
913  } elseif (empty($selectedcode)) {
914  $selectedcode = $mysoc->country_code;
915  }
916  $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
917 
918  print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
919  print '<td class="maxwidth200onsmartphone">';
920  print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id');
921  if ($user->admin) {
922  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
923  }
924  print '</td></tr>';
925 
926  // State
927  print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
928  if ($selectedcode) {
929  print img_picto('', 'state', 'class="pictofixedwidth"');
930  print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $object->state_id, $selectedcode, 'account_state_id');
931  } else {
932  print $countrynotdefined;
933  }
934  print '</td></tr>';
935 
936  // Conciliable
937  print '<tr><td>'.$langs->trans("Conciliable").'</td>';
938  print '<td>';
939  $conciliate = $object->canBeConciliated();
940  if ($conciliate == -2) {
941  print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
942  } elseif ($conciliate == -3) {
943  print $langs->trans("No").' ('.$langs->trans("Closed").')';
944  } else {
945  print '<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ? '' : ' checked="checked"').'"> <label for="norappro">'.$langs->trans("DisableConciliation").'</label>';
946  }
947  print '</td></tr>';
948 
949  // Balance
950  print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
951  print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOSTISSET("account_min_allowed") ? GETPOST("account_min_allowed") : $object->min_allowed).'"></td></tr>';
952 
953  print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
954  print '<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOSTISSET("account_min_desired") ? GETPOST("account_min_desired") : $object->min_desired).'"></td></tr>';
955 
956  // Web
957  print '<tr><td>'.$langs->trans("Web").'</td>';
958  print '<td>';
959  print img_picto('', 'globe', 'class="pictofixedwidth"');
960  print '<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET("url") ? GETPOST("url") : $object->url).'">';
961  print '</td></tr>';
962 
963  // Tags-Categories
964  if (isModEnabled('categorie')) {
965  print '<tr><td>'.$langs->trans("Categories").'</td><td>';
966  $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
967  $c = new Categorie($db);
968  $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
969  if (is_array($cats)) {
970  foreach ($cats as $cat) {
971  $arrayselected[] = $cat->id;
972  }
973  }
974  print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
975  print "</td></tr>";
976  }
977 
978  // Comment
979  print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
980  print '<td>';
981  // Editor wysiwyg
982  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
983  $doleditor = new DolEditor('account_comment', (GETPOST("account_comment") ?GETPOST("account_comment") : $object->comment), '', 90, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_4, '95%');
984  $doleditor->Create();
985  print '</td></tr>';
986 
987  // Other attributes
988  $parameters = array();
989  $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
990  print $hookmanager->resPrint;
991  if (empty($reshook)) {
992  print $object->showOptionals($extrafields, 'edit', $parameters);
993  }
994 
995  print '</table>';
996  print '<br>';
997 
998 
999  //print '<div class="underbanner clearboth"></div>';
1000 
1001  print '<table class="border centpercent">';
1002 
1003  // Accountancy code
1004  $tdextra = ' class="titlefieldcreate"';
1005 
1006  if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
1007  $tdextra = ' class="fieldrequired titlefieldcreate"';
1008  }
1009 
1010  print '<tr><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
1011  print '<td>';
1012  if (isModEnabled('accounting')) {
1013  print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
1014  } else {
1015  print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">';
1016  }
1017  print '</td></tr>';
1018 
1019  // Accountancy journal
1020  if (isModEnabled('accounting')) {
1021  print '<tr><td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>';
1022  print '<td>';
1023  print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
1024  print '</td></tr>';
1025  }
1026 
1027  print '</table>';
1028 
1029  $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value
1030  if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
1031  print '<br>';
1032 
1033  //print '<div class="underbanner clearboth"></div>';
1034 
1035  print '<table class="border centpercent">';
1036 
1037  // If bank account
1038  print '<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
1039  print '<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.'"></td>';
1040  print '</tr>';
1041 
1042  // Show fields of bank account
1043  foreach ($object->getFieldsToShow() as $val) {
1044  $content = '';
1045  if ($val == 'BankCode') {
1046  $name = 'code_banque';
1047  $css = 'with100';
1048  $content = $object->code_banque;
1049  } elseif ($val == 'DeskCode') {
1050  $name = 'code_guichet';
1051  $css = 'with100';
1052  $content = $object->code_guichet;
1053  } elseif ($val == 'BankAccountNumber') {
1054  $name = 'number';
1055  $css = 'with200';
1056  $content = $object->number;
1057  } elseif ($val == 'BankAccountNumberKey') {
1058  $name = 'cle_rib';
1059  $css = 'with50';
1060  $content = $object->cle_rib;
1061  }
1062 
1063  print '<tr><td>'.$langs->trans($val).'</td>';
1064  print '<td><input type="text" class="flat '.$css.'" name="'.$name.'" value="'.dol_escape_htmltag($content).'"></td>';
1065  print '</tr>';
1066  }
1067 
1068  $ibankey = FormBank::getIBANLabel($object);
1069  $bickey = "BICNumber";
1070  if ($object->getCountryCode() == 'IN') {
1071  $bickey = "SWIFT";
1072  }
1073 
1074  // IBAN
1075  print '<tr><td>'.$langs->trans($ibankey).'</td>';
1076  print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET('iban') ? GETPOST('iban', 'alphanohtml') : $object->iban).'"></td></tr>';
1077 
1078  print '<tr><td>'.$langs->trans($bickey).'</td>';
1079  print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET('bic') ? GETPOST('bic', 'alphanohtml') : $object->bic).'"></td></tr>';
1080 
1081  if (isModEnabled('prelevement')) {
1082  print '<tr><td>'.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').'</td>';
1083  print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET('ics') ? GETPOST('ics', 'alphanohtml') : $object->ics).'"></td></tr>';
1084  }
1085 
1086  if (isModEnabled('paymentbybanktransfer')) {
1087  print '<tr><td>'.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').'</td>';
1088  print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics_transfer" value="'.(GETPOSTISSET('ics_transfer') ? GETPOST('ics_transfer', 'alphanohtml') : $object->ics_transfer).'"></td></tr>';
1089 
1090  print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';
1091  print '<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. ($object->pti_in_ctti ? ' checked ' : '') . '>&nbsp;';
1092  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
1093  print '</td></tr>';
1094  }
1095 
1096  print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
1097  print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
1098  print $object->domiciliation;
1099  print "</textarea></td></tr>";
1100 
1101  print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
1102  print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.'"></td>';
1103  print '</tr>';
1104 
1105  print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
1106  print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
1107  print $object->owner_address;
1108  print "</textarea></td></tr>";
1109 
1110  print '</table>';
1111  }
1112 
1113  print dol_get_fiche_end();
1114 
1115  print $form->buttonsSaveCancel("Modify");
1116 
1117  print '</form>';
1118  }
1119 }
1120 
1121 // End of page
1122 llxFooter();
1123 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
checkIbanForAccount(Account $account)
Check IBAN number informations for a bank account.
Definition: bank.lib.php:295
checkSwiftForAccount($account)
Check SWIFT informations for a bank account.
Definition: bank.lib.php:279
bank_prepare_head(Account $object)
Prepare array with list of tabs.
Definition: bank.lib.php:37
Class to manage bank accounts.
const TYPE_SAVINGS
Savings account.
const TYPE_CURRENT
Current account.
Class to manage accounting accounts.
Class to manage accounting accounts.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage standard extra fields.
Class to manage generation of HTML components for accounting management.
Class to manage generation of HTML components for bank module.
static getIBANLabel(Account $account)
Returns the name of the Iban label.
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
$parameters
Actions.
Definition: card.php:79
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='')
Clean a string from all punctuation characters to use it as a ref or login.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$formconfirm
if ($action == 'delbookkeepingyear') {
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.