card.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  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 Frédéric France <frederic.france@netlogic.fr>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  23. */
  24. /**
  25. * \file htdocs/compta/bank/card.php
  26. * \ingroup bank
  27. * \brief Page to create/view a bank account
  28. */
  29. require '../../main.inc.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
  34. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
  35. require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
  36. if (!empty($conf->categorie->enabled)) {
  37. require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
  38. }
  39. if (!empty($conf->accounting->enabled)) {
  40. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
  41. }
  42. if (!empty($conf->accounting->enabled)) {
  43. require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
  44. }
  45. if (!empty($conf->accounting->enabled)) {
  46. require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
  47. }
  48. // Load translation files required by the page
  49. $langs->loadLangs(array("banks", "bills", "categories", "companies", "compta"));
  50. $action = GETPOST('action', 'aZ09');
  51. $cancel = GETPOST('cancel', 'alpha');
  52. $object = new Account($db);
  53. $extrafields = new ExtraFields($db);
  54. // fetch optionals attributes and labels
  55. $extrafields->fetch_name_optionals_label($object->table_element);
  56. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  57. $hookmanager->initHooks(array('bankcard', 'globalcard'));
  58. // Security check
  59. $id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha');
  60. $fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid';
  61. $result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
  62. /*
  63. * Actions
  64. */
  65. if ($cancel) {
  66. $action = '';
  67. }
  68. if ($action == 'add') {
  69. $error = 0;
  70. $db->begin();
  71. // Create account
  72. $object = new Account($db);
  73. $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
  74. $object->label = trim(GETPOST("label", 'alphanohtml'));
  75. $object->courant = GETPOST("type");
  76. $object->clos = GETPOST("clos");
  77. $object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
  78. $object->url = trim(GETPOST("url", 'alpha'));
  79. $object->bank = trim(GETPOST("bank"));
  80. $object->code_banque = trim(GETPOST("code_banque"));
  81. $object->code_guichet = trim(GETPOST("code_guichet"));
  82. $object->number = trim(GETPOST("number"));
  83. $object->cle_rib = trim(GETPOST("cle_rib"));
  84. $object->bic = trim(GETPOST("bic"));
  85. $object->iban = trim(GETPOST("iban"));
  86. $object->domiciliation = trim(GETPOST("domiciliation", "nohtml"));
  87. $object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
  88. $object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
  89. $object->ics = trim(GETPOST("ics", 'alpha'));
  90. $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'));
  91. $account_number = GETPOST('account_number', 'alphanohtml');
  92. if (empty($account_number) || $account_number == '-1') {
  93. $object->account_number = '';
  94. } else {
  95. $object->account_number = $account_number;
  96. }
  97. $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
  98. if ($fk_accountancy_journal <= 0) {
  99. $object->fk_accountancy_journal = '';
  100. } else {
  101. $object->fk_accountancy_journal = $fk_accountancy_journal;
  102. }
  103. $object->solde = price2num(GETPOST("solde"));
  104. $object->date_solde = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST("reyear", 'int'));
  105. $object->currency_code = trim(GETPOST("account_currency_code"));
  106. $object->state_id = GETPOST("account_state_id", 'int');
  107. $object->country_id = GETPOST("account_country_id", 'int');
  108. $object->min_allowed = GETPOST("account_min_allowed", 'int');
  109. $object->min_desired = GETPOST("account_min_desired", 'int');
  110. $object->comment = trim(GETPOST("account_comment", 'restricthtml'));
  111. $object->fk_user_author = $user->id;
  112. if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
  113. setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
  114. $action = 'create'; // Force chargement page en mode creation
  115. $error++;
  116. }
  117. if (empty($object->ref)) {
  118. setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
  119. $action = 'create'; // Force chargement page en mode creation
  120. $error++;
  121. }
  122. if (empty($object->label)) {
  123. setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
  124. $action = 'create'; // Force chargement page en mode creation
  125. $error++;
  126. }
  127. // Fill array 'array_options' with data from add form
  128. $ret = $extrafields->setOptionalsFromPost(null, $object);
  129. if (!$error) {
  130. $id = $object->create($user);
  131. if ($id > 0) {
  132. // Category association
  133. $categories = GETPOST('categories', 'array');
  134. $object->setCategories($categories);
  135. $_GET["id"] = $id; // Force chargement page en mode visu
  136. $action = '';
  137. } else {
  138. $error++;
  139. setEventMessages($object->error, $object->errors, 'errors');
  140. $action = 'create'; // Force chargement page en mode creation
  141. }
  142. }
  143. if (!$error) {
  144. $db->commit();
  145. } else {
  146. $db->rollback();
  147. }
  148. }
  149. if ($action == 'update') {
  150. $error = 0;
  151. // Update account
  152. $object = new Account($db);
  153. $object->fetch(GETPOST("id", 'int'));
  154. $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
  155. $object->label = trim(GETPOST("label", 'alphanohtml'));
  156. $object->courant = GETPOST("type");
  157. $object->clos = GETPOST("clos");
  158. $object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
  159. $object->url = trim(GETPOST("url", 'alpha'));
  160. $object->bank = trim(GETPOST("bank"));
  161. $object->code_banque = trim(GETPOST("code_banque"));
  162. $object->code_guichet = trim(GETPOST("code_guichet"));
  163. $object->number = trim(GETPOST("number"));
  164. $object->cle_rib = trim(GETPOST("cle_rib"));
  165. $object->bic = trim(GETPOST("bic"));
  166. $object->iban = trim(GETPOST("iban"));
  167. $object->domiciliation = trim(GETPOST("domiciliation", "nohtml"));
  168. $object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
  169. $object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
  170. $object->ics = trim(GETPOST("ics", 'alpha'));
  171. $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'));
  172. $account_number = GETPOST('account_number', 'alpha');
  173. if (empty($account_number) || $account_number == '-1') {
  174. $object->account_number = '';
  175. } else {
  176. $object->account_number = $account_number;
  177. }
  178. $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
  179. if ($fk_accountancy_journal <= 0) {
  180. $object->fk_accountancy_journal = '';
  181. } else {
  182. $object->fk_accountancy_journal = $fk_accountancy_journal;
  183. }
  184. $object->currency_code = trim(GETPOST("account_currency_code"));
  185. $object->state_id = GETPOST("account_state_id", 'int');
  186. $object->country_id = GETPOST("account_country_id", 'int');
  187. $object->min_allowed = GETPOST("account_min_allowed", 'int');
  188. $object->min_desired = GETPOST("account_min_desired", 'int');
  189. $object->comment = trim(GETPOST("account_comment", 'restricthtml'));
  190. if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
  191. setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
  192. $action = 'edit'; // Force chargement page en mode creation
  193. $error++;
  194. }
  195. if (empty($object->ref)) {
  196. setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
  197. $action = 'edit'; // Force chargement page en mode creation
  198. $error++;
  199. }
  200. if (empty($object->label)) {
  201. setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
  202. $action = 'edit'; // Force chargement page en mode creation
  203. $error++;
  204. }
  205. $db->begin();
  206. if (!$error) {
  207. // Fill array 'array_options' with data from add form
  208. $ret = $extrafields->setOptionalsFromPost(null, $object);
  209. }
  210. if (!$error) {
  211. $result = $object->update($user);
  212. if ($result >= 0) {
  213. // Category association
  214. $categories = GETPOST('categories', 'array');
  215. $object->setCategories($categories);
  216. $_GET["id"] = $_POST["id"]; // Force chargement page en mode visu
  217. } else {
  218. $error++;
  219. setEventMessages($object->error, $object->errors, 'errors');
  220. $action = 'edit'; // Force chargement page edition
  221. }
  222. }
  223. if (!$error) {
  224. $db->commit();
  225. } else {
  226. $db->rollback();
  227. }
  228. }
  229. if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->banque->configurer) {
  230. // Delete
  231. $object = new Account($db);
  232. $object->fetch(GETPOST("id", "int"));
  233. $result = $object->delete($user);
  234. if ($result > 0) {
  235. setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
  236. header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
  237. exit;
  238. } else {
  239. setEventMessages($object->error, $object->errors, 'errors');
  240. $action = '';
  241. }
  242. }
  243. /*
  244. * View
  245. */
  246. $form = new Form($db);
  247. $formbank = new FormBank($db);
  248. $formcompany = new FormCompany($db);
  249. if (!empty($conf->accounting->enabled)) {
  250. $formaccounting = new FormAccounting($db);
  251. }
  252. $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
  253. $title = $langs->trans("FinancialAccount")." - ".$langs->trans("Card");
  254. $help_url = "EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses";
  255. llxHeader("", $title, $help_url);
  256. // Creation
  257. if ($action == 'create') {
  258. $object = new Account($db);
  259. print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account');
  260. if ($conf->use_javascript_ajax) {
  261. print "\n".'<script type="text/javascript" language="javascript">';
  262. print 'jQuery(document).ready(function () {
  263. jQuery("#selecttype").change(function() {
  264. document.formsoc.action.value="create";
  265. document.formsoc.submit();
  266. });
  267. jQuery("#selectaccount_country_id").change(function() {
  268. document.formsoc.action.value="create";
  269. document.formsoc.submit();
  270. });
  271. })';
  272. print '</script>'."\n";
  273. }
  274. print '<form action="'.$_SERVER["PHP_SELF"].'" name="formsoc" method="post">';
  275. print '<input type="hidden" name="token" value="'.newToken().'">';
  276. print '<input type="hidden" name="action" value="add">';
  277. print '<input type="hidden" name="clos" value="0">';
  278. print dol_get_fiche_head('');
  279. print '<table class="border centpercent">';
  280. // Ref
  281. print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
  282. print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(GETPOST("ref") ?GETPOST("ref", 'alpha') : $object->ref).'" maxlength="12" autofocus></td></tr>';
  283. // Label
  284. print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
  285. print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
  286. // Type
  287. print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
  288. print '<td>';
  289. $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST("type") : Account::TYPE_CURRENT, "type");
  290. print '</td></tr>';
  291. // Currency
  292. print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
  293. print '<td>';
  294. $selectedcode = $object->currency_code;
  295. if (!$selectedcode) {
  296. $selectedcode = $conf->currency;
  297. }
  298. print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
  299. //print $langs->trans("Currency".$conf->currency);
  300. //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
  301. print '</td></tr>';
  302. // Status
  303. print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
  304. print '<td>';
  305. print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int') != '' ?GETPOST("clos", 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
  306. print '</td></tr>';
  307. // Country
  308. $selectedcode = '';
  309. if (GETPOSTISSET("account_country_id")) {
  310. $selectedcode = GETPOST("account_country_id") ? GETPOST("account_country_id") : $object->country_code;
  311. } elseif (empty($selectedcode)) {
  312. $selectedcode = $mysoc->country_code;
  313. }
  314. $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
  315. print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
  316. print '<td>';
  317. print $form->select_country($selectedcode, 'account_country_id');
  318. if ($user->admin) {
  319. print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
  320. }
  321. print '</td></tr>';
  322. // State
  323. print '<tr><td>'.$langs->trans('State').'</td><td>';
  324. if ($selectedcode) {
  325. $formcompany->select_departement(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : '', $selectedcode, 'account_state_id');
  326. } else {
  327. print $countrynotdefined;
  328. }
  329. print '</td></tr>';
  330. // Web
  331. print '<tr><td>'.$langs->trans("Web").'</td>';
  332. print '<td><input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'"></td></tr>';
  333. // Tags-Categories
  334. if ($conf->categorie->enabled) {
  335. print '<tr><td>'.$langs->trans("Categories").'</td><td>';
  336. $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
  337. $arrayselected = array();
  338. $c = new Categorie($db);
  339. $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
  340. if (is_array($cats)) {
  341. foreach ($cats as $cat) {
  342. $arrayselected[] = $cat->id;
  343. }
  344. }
  345. print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
  346. print "</td></tr>";
  347. }
  348. // Comment
  349. print '<tr><td>'.$langs->trans("Comment").'</td>';
  350. print '<td>';
  351. // Editor wysiwyg
  352. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  353. $doleditor = new DolEditor('account_comment', (GETPOST("account_comment") ?GETPOST("account_comment") : $object->comment), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4, '90%');
  354. $doleditor->Create();
  355. print '</td></tr>';
  356. // Other attributes
  357. $parameters = array();
  358. $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  359. print $hookmanager->resPrint;
  360. if (empty($reshook)) {
  361. print $object->showOptionals($extrafields, 'edit', $parameters);
  362. }
  363. print '</table>';
  364. print '<br>';
  365. print '<table class="border centpercent">';
  366. // Sold
  367. print '<tr><td class="titlefieldcreate">'.$langs->trans("InitialBankBalance").'</td>';
  368. print '<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde") ?GETPOST("solde") : price2num($object->solde)).'"></td></tr>';
  369. print '<tr><td>'.$langs->trans("Date").'</td>';
  370. print '<td>';
  371. print $form->selectDate('', 're', 0, 0, 0, 'formsoc');
  372. print '</td></tr>';
  373. print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
  374. 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>';
  375. print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
  376. 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>';
  377. print '</table>';
  378. print '<br>';
  379. $type = GETPOST('type');
  380. if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
  381. print '<table class="border centpercent">';
  382. // If bank account
  383. print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
  384. print '<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST('bank') ?GETPOST('bank', 'alpha') : $object->bank).'"></td>';
  385. print '</tr>';
  386. // Show fields of bank account
  387. $sizecss = '';
  388. foreach ($object->getFieldsToShow() as $val) {
  389. if ($val == 'BankCode') {
  390. $name = 'code_banque';
  391. $sizecss = 'minwidth100';
  392. $content = $object->code_banque;
  393. } elseif ($val == 'DeskCode') {
  394. $name = 'code_guichet';
  395. $sizecss = 'minwidth100';
  396. $content = $object->code_guichet;
  397. } elseif ($val == 'BankAccountNumber') {
  398. $name = 'number';
  399. $sizecss = 'minwidth200';
  400. $content = $object->number;
  401. } elseif ($val == 'BankAccountNumberKey') {
  402. $name = 'cle_rib';
  403. $sizecss = 'minwidth50';
  404. $content = $object->cle_rib;
  405. }
  406. print '<td>'.$langs->trans($val).'</td>';
  407. print '<td><input type="text" class="flat '.$sizecss.'" name="'.$name.'" value="'.(GETPOST($name) ?GETPOST($name, 'alpha') : $content).'"></td>';
  408. print '</tr>';
  409. }
  410. $ibankey = FormBank::getIBANLabel($object);
  411. $bickey = "BICNumber";
  412. if ($object->getCountryCode() == 'IN') {
  413. $bickey = "SWIFT";
  414. }
  415. // IBAN
  416. print '<tr><td>'.$langs->trans($ibankey).'</td>';
  417. print '<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOST('iban') ?GETPOST('iban', 'alpha') : $object->iban).'"></td></tr>';
  418. print '<tr><td>'.$langs->trans($bickey).'</td>';
  419. print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOST('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
  420. print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
  421. print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
  422. print (GETPOST('domiciliation') ?GETPOST('domiciliation') : $object->domiciliation);
  423. print "</textarea></td></tr>";
  424. print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
  425. print '<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST('proprio') ?GETPOST('proprio', 'alpha') : $object->proprio).'">';
  426. print '</td></tr>';
  427. print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
  428. print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
  429. print (GETPOST('owner_address') ?GETPOST('owner_address', 'alpha') : $object->owner_address);
  430. print "</textarea></td></tr>";
  431. print '</table>';
  432. print '<br>';
  433. }
  434. print '<table class="border centpercent">';
  435. // Accountancy code
  436. $fieldrequired = '';
  437. if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
  438. $fieldrequired = 'fieldrequired ';
  439. }
  440. if (!empty($conf->accounting->enabled)) {
  441. print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
  442. print '<td>';
  443. print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
  444. print '</td></tr>';
  445. } else {
  446. print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
  447. print '<td><input type="text" name="account_number" value="'.(GETPOST("account_number") ?GETPOST('account_number', 'alpha') : $object->account_number).'"></td></tr>';
  448. }
  449. // Accountancy journal
  450. if (!empty($conf->accounting->enabled)) {
  451. print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
  452. print '<td>';
  453. print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
  454. print '</td></tr>';
  455. }
  456. print '</table>';
  457. print dol_get_fiche_end();
  458. print '<div class="center">';
  459. print '<input type="submit" class="button" value="'.$langs->trans("CreateAccount").'">';
  460. print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  461. print '<input type="button" class="button button-cancel" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
  462. print '</div>';
  463. print '</form>';
  464. } else {
  465. /* ************************************************************************** */
  466. /* */
  467. /* Visu et edition */
  468. /* */
  469. /* ************************************************************************** */
  470. if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') {
  471. $object = new Account($db);
  472. if ($_GET["id"]) {
  473. $object->fetch($_GET["id"]);
  474. }
  475. if ($_GET["ref"]) {
  476. $object->fetch(0, $_GET["ref"]);
  477. $_GET["id"] = $object->id;
  478. }
  479. // Show tabs
  480. $head = bank_prepare_head($object);
  481. print dol_get_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
  482. $formconfirm = '';
  483. // Confirmation to delete
  484. if ($action == 'delete') {
  485. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("DeleteAccount"), $langs->trans("ConfirmDeleteAccount"), "confirm_delete");
  486. }
  487. // Print form confirm
  488. print $formconfirm;
  489. $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  490. $morehtmlref = '';
  491. dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
  492. print '<div class="fichecenter">';
  493. print '<div class="fichehalfleft">';
  494. print '<div class="underbanner clearboth"></div>';
  495. print '<table class="border tableforfield" width="100%">';
  496. // Type
  497. print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
  498. print '<td>'.$object->type_lib[$object->type].'</td></tr>';
  499. // Currency
  500. print '<tr><td>'.$langs->trans("Currency").'</td>';
  501. print '<td>';
  502. $selectedcode = $object->currency_code;
  503. if (!$selectedcode) {
  504. $selectedcode = $conf->currency;
  505. }
  506. print $langs->trans("Currency".$selectedcode);
  507. print '</td></tr>';
  508. // Conciliate
  509. print '<tr><td>'.$langs->trans("Conciliable").'</td>';
  510. print '<td>';
  511. $conciliate = $object->canBeConciliated();
  512. if ($conciliate == -2) {
  513. print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("CashAccount").')</span>';
  514. } elseif ($conciliate == -3) {
  515. print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
  516. } else {
  517. print ($object->rappro == 1 ? $langs->trans("Yes") : ($langs->trans("No").' <span class="opacitymedium">('.$langs->trans("ConciliationDisabled").')</span>'));
  518. }
  519. print '</td></tr>';
  520. print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
  521. print '<td>'.$object->min_allowed.'</td></tr>';
  522. print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
  523. print '<td>'.$object->min_desired.'</td></tr>';
  524. // Accountancy code
  525. print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
  526. print '<td>';
  527. if (!empty($conf->accounting->enabled)) {
  528. $accountingaccount = new AccountingAccount($db);
  529. $accountingaccount->fetch('', $object->account_number, 1);
  530. print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
  531. } else {
  532. print $object->account_number;
  533. }
  534. print '</td></tr>';
  535. // Accountancy journal
  536. if (!empty($conf->accounting->enabled)) {
  537. print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
  538. print '<td>';
  539. if ($object->fk_accountancy_journal > 0) {
  540. $accountingjournal = new AccountingJournal($db);
  541. $accountingjournal->fetch($object->fk_accountancy_journal);
  542. print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
  543. }
  544. print '</td></tr>';
  545. }
  546. // Other attributes
  547. $cols = 2;
  548. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
  549. print '</table>';
  550. print '</div>';
  551. print '<div class="fichehalfright">';
  552. print '<div class="ficheaddleft">';
  553. print '<div class="underbanner clearboth"></div>';
  554. print '<table class="border tableforfield centpercent">';
  555. // Categories
  556. if ($conf->categorie->enabled) {
  557. print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
  558. print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
  559. print "</td></tr>";
  560. }
  561. print '<tr><td class="tdtop titlefield">'.$langs->trans("Comment").'</td>';
  562. print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
  563. print '</table>';
  564. if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
  565. print '<div class="underbanner clearboth"></div>';
  566. print '<table class="border tableforfield centpercent">';
  567. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("BankName").'</td>';
  568. print '<td>'.$object->bank.'</td></tr>';
  569. // Show fields of bank account
  570. foreach ($object->getFieldsToShow() as $val) {
  571. if ($val == 'BankCode') {
  572. $content = $object->code_banque;
  573. } elseif ($val == 'DeskCode') {
  574. $content = $object->code_guichet;
  575. } elseif ($val == 'BankAccountNumber') {
  576. $content = $object->number;
  577. } elseif ($val == 'BankAccountNumberKey') {
  578. $content = $object->cle_rib;
  579. }
  580. print '<tr><td>'.$langs->trans($val).'</td>';
  581. print '<td>'.$content.'</td>';
  582. print '</tr>';
  583. }
  584. $ibankey = FormBank::getIBANLabel($object);
  585. $bickey = "BICNumber";
  586. if ($object->getCountryCode() == 'IN') {
  587. $bickey = "SWIFT";
  588. }
  589. print '<tr><td>'.$langs->trans($ibankey).'</td>';
  590. print '<td>'.$object->iban.'&nbsp;';
  591. if (!empty($object->iban)) {
  592. if (!checkIbanForAccount($object)) {
  593. print img_picto($langs->trans("IbanNotValid"), 'warning');
  594. } else {
  595. print img_picto($langs->trans("IbanValid"), 'info');
  596. }
  597. }
  598. print '</td></tr>';
  599. print '<tr><td>'.$langs->trans($bickey).'</td>';
  600. print '<td>'.$object->bic.'&nbsp;';
  601. if (!empty($object->bic)) {
  602. if (!checkSwiftForAccount($object)) {
  603. print img_picto($langs->trans("SwiftNotValid"), 'warning');
  604. } else {
  605. print img_picto($langs->trans("SwiftValid"), 'info');
  606. }
  607. }
  608. print '</td></tr>';
  609. if ($conf->prelevement->enabled) {
  610. print '<tr><td>'.$langs->trans("ICS").'</td>';
  611. print '<td>'.$object->ics.'</td>';
  612. print '</tr>';
  613. }
  614. if ($conf->paymentbybanktransfer->enabled) {
  615. print '<tr><td>'.$langs->trans("ICSTransfer").'</td>';
  616. print '<td>'.$object->ics_transfer.'</td>';
  617. print '</tr>';
  618. }
  619. print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
  620. print nl2br($object->domiciliation);
  621. print "</td></tr>\n";
  622. print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td>';
  623. print $object->proprio;
  624. print "</td></tr>\n";
  625. print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
  626. print nl2br($object->owner_address);
  627. print "</td></tr>\n";
  628. print '</table>';
  629. }
  630. print '</div>';
  631. print '</div>';
  632. print '</div>';
  633. print '<div class="clearboth"></div>';
  634. print dol_get_fiche_end();
  635. /*
  636. * Action bar
  637. */
  638. print '<div class="tabsAction">';
  639. if ($user->rights->banque->configurer) {
  640. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
  641. }
  642. $canbedeleted = $object->can_be_deleted(); // Renvoi vrai si compte sans mouvements
  643. if ($user->rights->banque->configurer && $canbedeleted) {
  644. print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
  645. }
  646. print '</div>';
  647. }
  648. /* ************************************************************************** */
  649. /* */
  650. /* Edition */
  651. /* */
  652. /* ************************************************************************** */
  653. if (GETPOST('id', 'int') && $action == 'edit' && $user->rights->banque->configurer) {
  654. $object = new Account($db);
  655. $object->fetch(GETPOST('id', 'int'));
  656. print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'bank_account');
  657. if ($conf->use_javascript_ajax) {
  658. print "\n".'<script type="text/javascript" language="javascript">';
  659. print 'jQuery(document).ready(function () {
  660. jQuery("#selecttype").change(function() {
  661. document.formsoc.action.value="edit";
  662. document.formsoc.submit();
  663. });
  664. })'."\n";
  665. print 'jQuery(document).ready(function () {
  666. jQuery("#selectaccount_country_id").change(function() {
  667. document.formsoc.action.value="edit";
  668. document.formsoc.submit();
  669. });
  670. })';
  671. print '</script>'."\n";
  672. }
  673. print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post" name="formsoc">';
  674. print '<input type="hidden" name="token" value="'.newToken().'">';
  675. print '<input type="hidden" name="action" value="update">';
  676. print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">'."\n\n";
  677. print dol_get_fiche_head(array(), 0, '', 0);
  678. //print '<div class="underbanner clearboth"></div>';
  679. print '<table class="border centpercent">';
  680. // Ref
  681. print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
  682. print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET("ref") ? GETPOST("ref") : $object->ref).'"></td></tr>';
  683. // Label
  684. print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
  685. print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET("label") ? GETPOST("label") : $object->label).'"></td></tr>';
  686. // Type
  687. print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
  688. print '<td class="maxwidth200onsmartphone">';
  689. $formbank->selectTypeOfBankAccount((GETPOSTISSET("type") ? GETPOST("type") : $object->type), "type");
  690. print '</td></tr>';
  691. // Currency
  692. print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
  693. print '<input type="hidden" value="'.$object->currency_code.'">';
  694. print '</td>';
  695. print '<td class="maxwidth200onsmartphone">';
  696. $selectedcode = $object->currency_code;
  697. if (!$selectedcode) {
  698. $selectedcode = $conf->currency;
  699. }
  700. print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
  701. //print $langs->trans("Currency".$conf->currency);
  702. //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
  703. print '</td></tr>';
  704. // Status
  705. print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
  706. print '<td class="maxwidth200onsmartphone">';
  707. print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos") : $object->clos));
  708. print '</td></tr>';
  709. // Country
  710. $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
  711. $selectedcode = $object->country_code;
  712. if (GETPOSTISSET("account_country_id")) {
  713. $selectedcode = GETPOST("account_country_id");
  714. } elseif (empty($selectedcode)) {
  715. $selectedcode = $mysoc->country_code;
  716. }
  717. $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
  718. print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
  719. print '<td class="maxwidth200onsmartphone">';
  720. print $form->select_country($selectedcode, 'account_country_id');
  721. if ($user->admin) {
  722. print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
  723. }
  724. print '</td></tr>';
  725. // State
  726. print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
  727. if ($selectedcode) {
  728. print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $object->state_id, $selectedcode, 'account_state_id');
  729. } else {
  730. print $countrynotdefined;
  731. }
  732. print '</td></tr>';
  733. // Conciliable
  734. print '<tr><td>'.$langs->trans("Conciliable").'</td>';
  735. print '<td>';
  736. $conciliate = $object->canBeConciliated();
  737. if ($conciliate == -2) {
  738. print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
  739. } elseif ($conciliate == -3) {
  740. print $langs->trans("No").' ('.$langs->trans("Closed").')';
  741. } else {
  742. print '<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ? '' : ' checked="checked"').'"> <label for="norappro">'.$langs->trans("DisableConciliation").'</label>';
  743. }
  744. print '</td></tr>';
  745. // Balance
  746. print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
  747. 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>';
  748. print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
  749. 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>';
  750. // Web
  751. print '<tr><td>'.$langs->trans("Web").'</td>';
  752. print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET("url") ? GETPOST("url") : $object->url).'">';
  753. print '</td></tr>';
  754. // Tags-Categories
  755. if ($conf->categorie->enabled) {
  756. print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
  757. $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
  758. $c = new Categorie($db);
  759. $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
  760. if (is_array($cats)) {
  761. foreach ($cats as $cat) {
  762. $arrayselected[] = $cat->id;
  763. }
  764. }
  765. print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
  766. print "</td></tr>";
  767. }
  768. // Comment
  769. print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
  770. print '<td>';
  771. // Editor wysiwyg
  772. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  773. $doleditor = new DolEditor('account_comment', (GETPOST("account_comment") ?GETPOST("account_comment") : $object->comment), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4, '95%');
  774. $doleditor->Create();
  775. print '</td></tr>';
  776. // Other attributes
  777. $parameters = array();
  778. $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  779. print $hookmanager->resPrint;
  780. if (empty($reshook)) {
  781. print $object->showOptionals($extrafields, 'edit', $parameters);
  782. }
  783. print '</table>';
  784. print '<br>';
  785. //print '<div class="underbanner clearboth"></div>';
  786. print '<table class="border centpercent">';
  787. // Accountancy code
  788. $tdextra = ' class="titlefieldcreate"';
  789. if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
  790. $tdextra = ' class="fieldrequired titlefieldcreate"';
  791. }
  792. print '<tr class="liste_titre_add"><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
  793. print '<td>';
  794. if (!empty($conf->accounting->enabled)) {
  795. print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
  796. } else {
  797. print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">';
  798. }
  799. print '</td></tr>';
  800. // Accountancy journal
  801. if (!empty($conf->accounting->enabled)) {
  802. print '<tr><td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>';
  803. print '<td>';
  804. print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
  805. print '</td></tr>';
  806. }
  807. print '</table>';
  808. if (GETPOST("type") == Account::TYPE_SAVINGS || GETPOST("type") == Account::TYPE_CURRENT) {
  809. print '<br>';
  810. //print '<div class="underbanner clearboth"></div>';
  811. print '<table class="border centpercent">';
  812. // If bank account
  813. print '<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
  814. print '<td><input size="30" type="text" class="flat" name="bank" value="'.$object->bank.'"></td>';
  815. print '</tr>';
  816. // Show fields of bank account
  817. foreach ($object->getFieldsToShow() as $val) {
  818. if ($val == 'BankCode') {
  819. $name = 'code_banque';
  820. $size = 8;
  821. $content = $object->code_banque;
  822. } elseif ($val == 'DeskCode') {
  823. $name = 'code_guichet';
  824. $size = 8;
  825. $content = $object->code_guichet;
  826. } elseif ($val == 'BankAccountNumber') {
  827. $name = 'number';
  828. $size = 18;
  829. $content = $object->number;
  830. } elseif ($val == 'BankAccountNumberKey') {
  831. $name = 'cle_rib';
  832. $size = 3;
  833. $content = $object->cle_rib;
  834. }
  835. print '<tr><td>'.$langs->trans($val).'</td>';
  836. print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
  837. print '</tr>';
  838. }
  839. $ibankey = FormBank::getIBANLabel($object);
  840. $bickey = "BICNumber";
  841. if ($object->getCountryCode() == 'IN') {
  842. $bickey = "SWIFT";
  843. }
  844. // IBAN
  845. print '<tr><td>'.$langs->trans($ibankey).'</td>';
  846. print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.$object->iban.'"></td></tr>';
  847. print '<tr><td>'.$langs->trans($bickey).'</td>';
  848. print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.$object->bic.'"></td></tr>';
  849. if ($conf->prelevement->enabled) {
  850. print '<tr><td>'.$langs->trans("ICS").'</td>';
  851. print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.$object->ics.'"></td></tr>';
  852. }
  853. if ($conf->paymentbybanktransfer->enabled) {
  854. print '<tr><td>'.$langs->trans("ICSTransfer").'</td>';
  855. print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics_transfer" value="'.$object->ics_transfer.'"></td></tr>';
  856. }
  857. print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
  858. print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
  859. print $object->domiciliation;
  860. print "</textarea></td></tr>";
  861. print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
  862. print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.'"></td>';
  863. print '</tr>';
  864. print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
  865. print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
  866. print $object->owner_address;
  867. print "</textarea></td></tr>";
  868. print '</table>';
  869. }
  870. print dol_get_fiche_end();
  871. print '<div class="center">';
  872. print '<input value="'.$langs->trans("Modify").'" type="submit" class="button">';
  873. print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  874. print '<input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button button-cancel">';
  875. print '</div>';
  876. print '</form>';
  877. }
  878. }
  879. // End of page
  880. llxFooter();
  881. $db->close();