dolibarr  17.0.4
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  if ($val == 'BankCode') {
519  $name = 'code_banque';
520  $sizecss = 'minwidth100';
521  $content = $object->code_banque;
522  } elseif ($val == 'DeskCode') {
523  $name = 'code_guichet';
524  $sizecss = 'minwidth100';
525  $content = $object->code_guichet;
526  } elseif ($val == 'BankAccountNumber') {
527  $name = 'number';
528  $sizecss = 'minwidth200';
529  $content = $object->number;
530  } elseif ($val == 'BankAccountNumberKey') {
531  $name = 'cle_rib';
532  $sizecss = 'minwidth50';
533  $content = $object->cle_rib;
534  }
535 
536  print '<td>'.$langs->trans($val).'</td>';
537  print '<td><input type="text" class="flat '.$sizecss.'" name="'.$name.'" value="'.(GETPOST($name) ?GETPOST($name, 'alpha') : $content).'"></td>';
538  print '</tr>';
539  }
540  $ibankey = FormBank::getIBANLabel($object);
541  $bickey = "BICNumber";
542  if ($object->getCountryCode() == 'IN') {
543  $bickey = "SWIFT";
544  }
545 
546  // IBAN
547  print '<tr><td>'.$langs->trans($ibankey).'</td>';
548  print '<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOST('iban') ?GETPOST('iban', 'alpha') : $object->iban).'"></td></tr>';
549 
550  print '<tr><td>'.$langs->trans($bickey).'</td>';
551  print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOST('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
552 
553  if (isModEnabled('paymentbybanktransfer')) {
554  print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';
555  print '<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. (empty(GETPOST('pti_in_ctti')) ? '' : ' checked ') . '>&nbsp;';
556  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
557  print '</td></tr>';
558  }
559 
560  print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
561  print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
562  print (GETPOST('domiciliation') ?GETPOST('domiciliation') : $object->domiciliation);
563  print "</textarea></td></tr>";
564 
565  print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
566  print '<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST('proprio') ?GETPOST('proprio', 'alpha') : $object->proprio).'">';
567  print '</td></tr>';
568 
569  print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
570  print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
571  print (GETPOST('owner_address') ?GETPOST('owner_address', 'alpha') : $object->owner_address);
572  print "</textarea></td></tr>";
573 
574  print '</table>';
575  print '<br>';
576  }
577 
578  print '<table class="border centpercent">';
579  // Accountancy code
580  $fieldrequired = '';
581  if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
582  $fieldrequired = 'fieldrequired ';
583  }
584 
585  if (isModEnabled('accounting')) {
586  print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
587  print '<td>';
588  print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
589  print '</td></tr>';
590  } else {
591  print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
592  print '<td><input type="text" name="account_number" value="'.(GETPOST("account_number") ?GETPOST('account_number', 'alpha') : $object->account_number).'"></td></tr>';
593  }
594 
595  // Accountancy journal
596  if (isModEnabled('accounting')) {
597  print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
598  print '<td>';
599  print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
600  print '</td></tr>';
601  }
602 
603  print '</table>';
604 
605  print dol_get_fiche_end();
606 
607  print $form->buttonsSaveCancel("CreateAccount");
608 
609  print '</form>';
610 } else {
611  // View and edit mode
612  if ((GETPOST("id", 'int') || GETPOST("ref")) && $action != 'edit') {
613  // Show tabs
614  $head = bank_prepare_head($object);
615  print dol_get_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
616 
617  $formconfirm = '';
618 
619  // Confirmation to delete
620  if ($action == 'delete') {
621  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("DeleteAccount"), $langs->trans("ConfirmDeleteAccount"), "confirm_delete");
622  }
623 
624  // Print form confirm
625  print $formconfirm;
626 
627  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
628 
629  $morehtmlref = '';
630  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
631 
632 
633  print '<div class="fichecenter">';
634  print '<div class="fichehalfleft">';
635  print '<div class="underbanner clearboth"></div>';
636 
637  print '<table class="border tableforfield" width="100%">';
638 
639  // Type
640  print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
641  print '<td>'.$object->type_lib[$object->type].'</td></tr>';
642 
643  // Currency
644  print '<tr><td>'.$langs->trans("Currency").'</td>';
645  print '<td>';
646  $selectedcode = $object->currency_code;
647  if (!$selectedcode) {
648  $selectedcode = $conf->currency;
649  }
650  print $langs->trans("Currency".$selectedcode);
651  print '</td></tr>';
652 
653  // Conciliate
654  print '<tr><td>'.$langs->trans("Conciliable").'</td>';
655  print '<td>';
656  $conciliate = $object->canBeConciliated();
657  if ($conciliate == -2) {
658  print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("CashAccount").')</span>';
659  } elseif ($conciliate == -3) {
660  print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
661  } else {
662  print ($object->rappro == 1 ? $langs->trans("Yes") : ($langs->trans("No").' <span class="opacitymedium">('.$langs->trans("ConciliationDisabled").')</span>'));
663  }
664  print '</td></tr>';
665 
666  print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
667  print '<td>'.$object->min_allowed.'</td></tr>';
668 
669  print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
670  print '<td>'.$object->min_desired.'</td></tr>';
671 
672  // Accountancy code
673  print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
674  print '<td>';
675  if (isModEnabled('accounting')) {
676  $accountingaccount = new AccountingAccount($db);
677  $accountingaccount->fetch('', $object->account_number, 1);
678 
679  print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
680  } else {
681  print $object->account_number;
682  }
683  print '</td></tr>';
684 
685  // Accountancy journal
686  if (isModEnabled('accounting')) {
687  print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
688  print '<td>';
689 
690  if ($object->fk_accountancy_journal > 0) {
691  $accountingjournal = new AccountingJournal($db);
692  $accountingjournal->fetch($object->fk_accountancy_journal);
693 
694  print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
695  }
696  print '</td></tr>';
697  }
698 
699  // Other attributes
700  $cols = 2;
701  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
702 
703  print '</table>';
704 
705  print '</div>';
706  print '<div class="fichehalfright">';
707  print '<div class="underbanner clearboth"></div>';
708 
709  print '<table class="border tableforfield centpercent">';
710 
711  // Categories
712  if (isModEnabled('categorie')) {
713  print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
714  print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
715  print "</td></tr>";
716  }
717 
718  print '<tr><td class="tdtop titlefield">'.$langs->trans("Comment").'</td>';
719  print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
720 
721  print '</table>';
722 
723  if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
724  //print '<div class="underbanner clearboth"></div>';
725 
726  print '<table class="border tableforfield centpercent">';
727 
728  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("BankName").'</td>';
729  print '<td>'.$object->bank.'</td></tr>';
730 
731  // Show fields of bank account
732  foreach ($object->getFieldsToShow() as $val) {
733  if ($val == 'BankCode') {
734  $content = $object->code_banque;
735  } elseif ($val == 'DeskCode') {
736  $content = $object->code_guichet;
737  } elseif ($val == 'BankAccountNumber') {
738  $content = $object->number;
739  } elseif ($val == 'BankAccountNumberKey') {
740  $content = $object->cle_rib;
741  }
742 
743  print '<tr><td>'.$langs->trans($val).'</td>';
744  print '<td>'.$content.'</td>';
745  print '</tr>';
746  }
747 
748  $ibankey = FormBank::getIBANLabel($object);
749  $bickey = "BICNumber";
750  if ($object->getCountryCode() == 'IN') {
751  $bickey = "SWIFT";
752  }
753 
754  print '<tr><td>'.$langs->trans($ibankey).'</td>';
755  print '<td>'.getIbanHumanReadable($object).'&nbsp;';
756  if (!empty($object->iban)) {
757  if (!checkIbanForAccount($object)) {
758  print img_picto($langs->trans("IbanNotValid"), 'warning');
759  } else {
760  print img_picto($langs->trans("IbanValid"), 'info');
761  }
762  }
763  print '</td></tr>';
764 
765  print '<tr><td>'.$langs->trans($bickey).'</td>';
766  print '<td>'.$object->bic.'&nbsp;';
767  if (!empty($object->bic)) {
768  if (!checkSwiftForAccount($object)) {
769  print img_picto($langs->trans("SwiftNotValid"), 'warning');
770  } else {
771  print img_picto($langs->trans("SwiftValid"), 'info');
772  }
773  }
774  print '</td></tr>';
775 
776  if (isModEnabled('prelevement')) {
777  print '<tr><td>'.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').'</td>';
778  print '<td>'.$object->ics.'</td>';
779  print '</tr>';
780  }
781 
782  // TODO ICS is not used with bank transfer !
783  if (isModEnabled('paymentbybanktransfer')) {
784  print '<tr><td>'.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').'</td>';
785  print '<td>'.$object->ics_transfer.'</td>';
786  print '</tr>';
787 
788  print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td><td>';
789  print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")) . '&nbsp;';
790  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
791  print "</td></tr>\n";
792  }
793 
794  print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
795  print nl2br($object->domiciliation);
796  print "</td></tr>\n";
797 
798  print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td>';
799  print $object->proprio;
800  print "</td></tr>\n";
801 
802  print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
803  print nl2br($object->owner_address);
804  print "</td></tr>\n";
805 
806  print '</table>';
807  }
808 
809  print '</div>';
810  print '</div>';
811 
812  print '<div class="clearboth"></div>';
813 
814  print dol_get_fiche_end();
815 
816  /*
817  * Action bar
818  */
819  print '<div class="tabsAction">';
820 
821  if ($user->rights->banque->configurer) {
822  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
823  }
824 
825  $canbedeleted = $object->can_be_deleted(); // Renvoi vrai si compte sans mouvements
826  if ($user->rights->banque->configurer && $canbedeleted) {
827  print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
828  }
829 
830  print '</div>';
831  }
832 
833  /* ************************************************************************** */
834  /* */
835  /* Edition */
836  /* */
837  /* ************************************************************************** */
838 
839  if (GETPOST('id', 'int') && $action == 'edit' && $user->rights->banque->configurer) {
840  print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'bank_account');
841 
842  if ($conf->use_javascript_ajax) {
843  print "\n".'<script type="text/javascript">';
844  print 'jQuery(document).ready(function () {
845  jQuery("#type").change(function() {
846  document.formsoc.action.value="edit";
847  document.formsoc.submit();
848  });
849  })'."\n";
850 
851  print 'jQuery(document).ready(function () {
852  jQuery("#selectaccount_country_id").change(function() {
853  document.formsoc.action.value="edit";
854  document.formsoc.submit();
855  });
856  })';
857  print '</script>'."\n";
858  }
859 
860  print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post" name="formsoc">';
861  print '<input type="hidden" name="token" value="'.newToken().'">';
862  print '<input type="hidden" name="action" value="update">';
863  print '<input type="hidden" name="id" value="'.GETPOST("id", 'int').'">'."\n\n";
864 
865  print dol_get_fiche_head(array(), 0, '', 0);
866 
867  //print '<div class="underbanner clearboth"></div>';
868 
869  print '<table class="border centpercent tableforfieldcreate">';
870 
871  // Ref
872  print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
873  print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : $object->ref).'"></td></tr>';
874 
875  // Label
876  print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
877  print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET('label') ? GETPOST('label', 'alpha') : $object->label).'"></td></tr>';
878 
879  // Type
880  print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
881  print '<td class="maxwidth200onsmartphone">';
882  $formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type), 'type');
883  print '</td></tr>';
884 
885  // Currency
886  print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
887  print '<input type="hidden" value="'.$object->currency_code.'">';
888  print '</td>';
889  print '<td class="maxwidth200onsmartphone">';
890  $selectedcode = $object->currency_code;
891  if (!$selectedcode) {
892  $selectedcode = $conf->currency;
893  }
894  print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
895  print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
896  //print $langs->trans("Currency".$conf->currency);
897  //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
898  print '</td></tr>';
899 
900  // Status
901  print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
902  print '<td class="maxwidth200onsmartphone">';
903  print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos", "int") : $object->clos));
904  print '</td></tr>';
905 
906  // Country
907  $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
908  $selectedcode = $object->country_code;
909  if (GETPOSTISSET("account_country_id")) {
910  $selectedcode = GETPOST("account_country_id");
911  } elseif (empty($selectedcode)) {
912  $selectedcode = $mysoc->country_code;
913  }
914  $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
915 
916  print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
917  print '<td class="maxwidth200onsmartphone">';
918  print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id');
919  if ($user->admin) {
920  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
921  }
922  print '</td></tr>';
923 
924  // State
925  print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
926  if ($selectedcode) {
927  print img_picto('', 'state', 'class="pictofixedwidth"');
928  print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $object->state_id, $selectedcode, 'account_state_id');
929  } else {
930  print $countrynotdefined;
931  }
932  print '</td></tr>';
933 
934  // Conciliable
935  print '<tr><td>'.$langs->trans("Conciliable").'</td>';
936  print '<td>';
937  $conciliate = $object->canBeConciliated();
938  if ($conciliate == -2) {
939  print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
940  } elseif ($conciliate == -3) {
941  print $langs->trans("No").' ('.$langs->trans("Closed").')';
942  } else {
943  print '<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ? '' : ' checked="checked"').'"> <label for="norappro">'.$langs->trans("DisableConciliation").'</label>';
944  }
945  print '</td></tr>';
946 
947  // Balance
948  print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
949  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>';
950 
951  print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
952  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>';
953 
954  // Web
955  print '<tr><td>'.$langs->trans("Web").'</td>';
956  print '<td>';
957  print img_picto('', 'globe', 'class="pictofixedwidth"');
958  print '<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET("url") ? GETPOST("url") : $object->url).'">';
959  print '</td></tr>';
960 
961  // Tags-Categories
962  if (isModEnabled('categorie')) {
963  print '<tr><td>'.$langs->trans("Categories").'</td><td>';
964  $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
965  $c = new Categorie($db);
966  $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
967  if (is_array($cats)) {
968  foreach ($cats as $cat) {
969  $arrayselected[] = $cat->id;
970  }
971  }
972  print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
973  print "</td></tr>";
974  }
975 
976  // Comment
977  print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
978  print '<td>';
979  // Editor wysiwyg
980  require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
981  $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%');
982  $doleditor->Create();
983  print '</td></tr>';
984 
985  // Other attributes
986  $parameters = array();
987  $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
988  print $hookmanager->resPrint;
989  if (empty($reshook)) {
990  print $object->showOptionals($extrafields, 'edit', $parameters);
991  }
992 
993  print '</table>';
994  print '<br>';
995 
996 
997  //print '<div class="underbanner clearboth"></div>';
998 
999  print '<table class="border centpercent">';
1000 
1001  // Accountancy code
1002  $tdextra = ' class="titlefieldcreate"';
1003 
1004  if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
1005  $tdextra = ' class="fieldrequired titlefieldcreate"';
1006  }
1007 
1008  print '<tr><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
1009  print '<td>';
1010  if (isModEnabled('accounting')) {
1011  print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
1012  } else {
1013  print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">';
1014  }
1015  print '</td></tr>';
1016 
1017  // Accountancy journal
1018  if (isModEnabled('accounting')) {
1019  print '<tr><td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>';
1020  print '<td>';
1021  print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
1022  print '</td></tr>';
1023  }
1024 
1025  print '</table>';
1026 
1027  $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value
1028  if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
1029  print '<br>';
1030 
1031  //print '<div class="underbanner clearboth"></div>';
1032 
1033  print '<table class="border centpercent">';
1034 
1035  // If bank account
1036  print '<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
1037  print '<td><input size="30" type="text" class="flat" name="bank" value="'.$object->bank.'"></td>';
1038  print '</tr>';
1039 
1040  // Show fields of bank account
1041  foreach ($object->getFieldsToShow() as $val) {
1042  if ($val == 'BankCode') {
1043  $name = 'code_banque';
1044  $size = 8;
1045  $content = $object->code_banque;
1046  } elseif ($val == 'DeskCode') {
1047  $name = 'code_guichet';
1048  $size = 8;
1049  $content = $object->code_guichet;
1050  } elseif ($val == 'BankAccountNumber') {
1051  $name = 'number';
1052  $size = 18;
1053  $content = $object->number;
1054  } elseif ($val == 'BankAccountNumberKey') {
1055  $name = 'cle_rib';
1056  $size = 3;
1057  $content = $object->cle_rib;
1058  }
1059 
1060  print '<tr><td>'.$langs->trans($val).'</td>';
1061  print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
1062  print '</tr>';
1063  }
1064 
1065  $ibankey = FormBank::getIBANLabel($object);
1066  $bickey = "BICNumber";
1067  if ($object->getCountryCode() == 'IN') {
1068  $bickey = "SWIFT";
1069  }
1070 
1071  // IBAN
1072  print '<tr><td>'.$langs->trans($ibankey).'</td>';
1073  print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET('iban') ? GETPOST('iban', 'alphanohtml') : $object->iban).'"></td></tr>';
1074 
1075  print '<tr><td>'.$langs->trans($bickey).'</td>';
1076  print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET('bic') ? GETPOST('bic', 'alphanohtml') : $object->bic).'"></td></tr>';
1077 
1078  if (isModEnabled('prelevement')) {
1079  print '<tr><td>'.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').'</td>';
1080  print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET('ics') ? GETPOST('ics', 'alphanohtml') : $object->ics).'"></td></tr>';
1081  }
1082 
1083  if (isModEnabled('paymentbybanktransfer')) {
1084  print '<tr><td>'.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').'</td>';
1085  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>';
1086 
1087  print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';
1088  print '<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. ($object->pti_in_ctti ? ' checked ' : '') . '>&nbsp;';
1089  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
1090  print '</td></tr>';
1091  }
1092 
1093  print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
1094  print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
1095  print $object->domiciliation;
1096  print "</textarea></td></tr>";
1097 
1098  print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
1099  print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.'"></td>';
1100  print '</tr>';
1101 
1102  print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
1103  print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
1104  print $object->owner_address;
1105  print "</textarea></td></tr>";
1106 
1107  print '</table>';
1108  }
1109 
1110  print dol_get_fiche_end();
1111 
1112  print $form->buttonsSaveCancel("Modify");
1113 
1114  print '</form>';
1115  }
1116 }
1117 
1118 // End of page
1119 llxFooter();
1120 $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.
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.