* Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2014-2017 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/compta/bank/card.php * \ingroup bank * \brief Page to create/view a bank account */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page $langs->loadLangs(array("banks","bills","categories","companies","compta")); $action = GETPOST('action','aZ09'); $cancel = GETPOST('cancel', 'alpha'); // Security check if (isset($_GET["id"]) || isset($_GET["ref"])) { $id = isset($_GET["id"])?GETPOST("id"):(isset($_GET["ref"])?GETPOST("ref"):''); } $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); $object = new Account($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('bankcard','globalcard')); /* * Actions */ if ($cancel) $action=''; if ($action == 'add') { $error=0; $db->begin(); // Create account $object = new Account($db); $object->ref = dol_sanitizeFileName(trim($_POST["ref"])); $object->label = trim($_POST["label"]); $object->courant = $_POST["type"]; $object->clos = $_POST["clos"]; $object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1; $object->url = $_POST["url"]; $object->bank = trim($_POST["bank"]); $object->code_banque = trim($_POST["code_banque"]); $object->code_guichet = trim($_POST["code_guichet"]); $object->number = trim($_POST["number"]); $object->cle_rib = trim($_POST["cle_rib"]); $object->bic = trim($_POST["bic"]); $object->iban = trim($_POST["iban"]); $object->domiciliation = trim($_POST["domiciliation"]); $object->proprio = trim($_POST["proprio"]); $object->owner_address = trim($_POST["owner_address"]); $account_number = GETPOST('account_number','alpha'); if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; } else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal','int'); if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; } $object->solde = $_POST["solde"]; $object->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); $object->currency_code = trim($_POST["account_currency_code"]); $object->state_id = $_POST["account_state_id"]; $object->country_id = $_POST["account_country_id"]; $object->min_allowed = GETPOST("account_min_allowed",'int'); $object->min_desired = GETPOST("account_min_desired",'int'); $object->comment = trim(GETPOST("account_comment")); $object->fk_user_author = $user->id; if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors'); $action='create'; // Force chargement page en mode creation $error++; } if (empty($object->ref)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors'); $action='create'; // Force chargement page en mode creation $error++; } if (empty($object->label)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors'); $action='create'; // Force chargement page en mode creation $error++; } // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $error) { $id = $object->create($user); if ($id > 0) { // Category association $categories = GETPOST('categories', 'array'); $object->setCategories($categories); $_GET["id"]=$id; // Force chargement page en mode visu $action=''; } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); $action='create'; // Force chargement page en mode creation } } if (! $error) { $db->commit(); } else { $db->rollback(); } } if ($action == 'update') { $error=0; // Update account $object = new Account($db); $object->fetch(GETPOST("id")); $object->ref = dol_string_nospecial(trim($_POST["ref"])); $object->label = trim($_POST["label"]); $object->courant = $_POST["type"]; $object->clos = $_POST["clos"]; $object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1; $object->url = trim($_POST["url"]); $object->bank = trim($_POST["bank"]); $object->code_banque = trim($_POST["code_banque"]); $object->code_guichet = trim($_POST["code_guichet"]); $object->number = trim($_POST["number"]); $object->cle_rib = trim($_POST["cle_rib"]); $object->bic = trim($_POST["bic"]); $object->iban = trim($_POST["iban"]); $object->domiciliation = trim($_POST["domiciliation"]); $object->proprio = trim($_POST["proprio"]); $object->owner_address = trim($_POST["owner_address"]); $account_number = GETPOST('account_number', 'alpha'); if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; } else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal','int'); if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; } $object->currency_code = trim($_POST["account_currency_code"]); $object->state_id = $_POST["account_state_id"]; $object->country_id = $_POST["account_country_id"]; $object->min_allowed = GETPOST("account_min_allowed",'int'); $object->min_desired = GETPOST("account_min_desired",'int'); $object->comment = trim(GETPOST("account_comment")); if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors'); $action='edit'; // Force chargement page en mode creation $error++; } if (empty($object->ref)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")), null, 'errors'); $action='edit'; // Force chargement page en mode creation $error++; } if (empty($object->label)) { setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors'); $action='edit'; // Force chargement page en mode creation $error++; } // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $error) { $result = $object->update($user); if ($result >= 0) { // Category association $categories = GETPOST('categories', 'array'); $object->setCategories($categories); $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu } else { setEventMessages($object->error, $object->errors, 'errors'); $action='edit'; // Force chargement page edition } } } if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer) { // Delete $object = new Account($db); $object->fetch(GETPOST("id","int")); $result = $object->delete($user); if ($result > 0) { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); header("Location: ".DOL_URL_ROOT."/compta/bank/list.php"); exit; } else { setEventMessages($account->error, $account->errors, 'errors'); $action=''; } } /* * View */ $form = new Form($db); $formbank = new FormBank($db); $formcompany = new FormCompany($db); if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; $title = $langs->trans("FinancialAccount") . " - " . $langs->trans("Card"); $helpurl = ""; llxHeader("",$title,$helpurl); // Creation if ($action == 'create') { $object=new Account($db); print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'title_bank.png'); if ($conf->use_javascript_ajax) { print "\n".''."\n"; } print '
'; print ''; print ''; print ''; dol_fiche_head(''); print ''; // Ref print ''; print ''; // Label print ''; print ''; // Type print ''; print ''; // Currency print ''; print ''; // Status print ''; print ''; // Country $selectedcode=''; if (isset($_POST["account_country_id"])) { $selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$object->country_code; } elseif (empty($selectedcode)) $selectedcode=$mysoc->country_code; $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''; print ''; // State print ''; // Web print ''; print ''; // Tags-Categories if ($conf->categorie->enabled) { print '"; } // Comment print ''; print ''; // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { print $object->showOptionals($extrafields,'edit',$parameters); } print '
'.$langs->trans("Ref").'ref).'" maxlength="12" autofocus>
'.$langs->trans("LabelBankCashAccount").'
'.$langs->trans("AccountType").''; $formbank->selectTypeOfBankAccount(isset($_POST["type"])?$_POST["type"]: Account::TYPE_CURRENT,"type"); print '
'.$langs->trans("Currency").''; $selectedcode=$object->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); //print ''; print '
'.$langs->trans("Status").''; print $form->selectarray("clos", $object->status,(GETPOST("clos",'int')!=''?GETPOST("clos",'int'):$object->clos)); print '
'.$langs->trans("BankAccountCountry").''; print $form->select_country($selectedcode,'account_country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.$langs->trans('State').''; if ($selectedcode) { $formcompany->select_departement(isset($_POST["account_state_id"])?$_POST["account_state_id"]:'',$selectedcode,'account_state_id'); } else { print $countrynotdefined; } print '
'.$langs->trans("Web").'
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $c = new Categorie($db); $cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT); foreach($cats as $cat) { $arrayselected[] = $cat->id; } print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print "
'.$langs->trans("Comment").''; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $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%'); $doleditor->Create(); print '
'; print '
'; print ''; // Sold print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$langs->trans("InitialBankBalance").'solde)).'">
'.$langs->trans("Date").''; print $form->selectDate('', 're', 0, 0, 0, 'formsoc'); print '
'.$langs->trans("BalanceMinimalAllowed").'min_allowed).'">
'.$langs->trans("BalanceMinimalDesired").'min_desired).'">
'; print '
'; if ($_POST["type"] == Account::TYPE_SAVINGS || $_POST["type"] == Account::TYPE_CURRENT) { print ''; // If bank account print ''; print ''; print ''; // Show fields of bank account foreach ($object->getFieldsToShow() as $val) { if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; $content = $object->code_banque; } elseif ($val == 'DeskCode') { $name = 'code_guichet'; $size = 8; $content = $object->code_guichet; } elseif ($val == 'BankAccountNumber') { $name = 'number'; $size = 18; $content = $object->number; } elseif ($val == 'BankAccountNumberKey') { $name = 'cle_rib'; $size = 3; $content = $object->cle_rib; } print ''; print ''; print ''; } $ibankey = FormBank::getIBANLabel($object); $bickey="BICNumber"; if ($object->getCountryCode() == 'IN') $bickey="SWIFT"; // IBAN print ''; print ''; print ''; print ''; print '"; print ''; print ''; print '"; print '
'.$langs->trans("BankName").'
'.$langs->trans($val).'
'.$langs->trans($ibankey).'
'.$langs->trans($bickey).'
'.$langs->trans("BankAccountDomiciliation").''; print "
'.$langs->trans("BankAccountOwner").''; print '
'.$langs->trans("BankAccountOwnerAddress").''; print "
'; print '
'; } print ''; // Accountancy code $fieldrequired=''; if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired='fieldrequired '; if (! empty($conf->accounting->enabled)) { print ''; print ''; } else { print ''; print ''; } // Accountancy journal if (! empty($conf->accounting->enabled)) { print ''; print ''; } print '
'.$langs->trans("AccountancyCode").''; print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); print '
'.$langs->trans("AccountancyCode").'account_number).'">
'.$langs->trans("AccountancyJournal").''; print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0); print '
'; dol_fiche_end(); print '
'; print ''; print '     '; print ''; print '
'; print '
'; } /* ************************************************************************** */ /* */ /* Visu et edition */ /* */ /* ************************************************************************** */ else { if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') { $object = new Account($db); if ($_GET["id"]) { $object->fetch($_GET["id"]); } if ($_GET["ref"]) { $object->fetch(0,$_GET["ref"]); $_GET["id"]=$object->id; } // Show tabs $head=bank_prepare_head($object); dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account'); $formconfirm = ''; // Confirmation to delete if ($action == 'delete') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); } // Print form confirm print $formconfirm; $linkback = ''.$langs->trans("BackToList").''; $morehtmlref=''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; print '
'; print ''; // Type print ''; print ''; // Currency print ''; print ''; // Conciliate print ''; print ''; print ''; print ''; print ''; print ''; // Accountancy code print ''; print ''; // Accountancy journal if (! empty($conf->accounting->enabled)) { print ''; print ''; } // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; print '
'.$langs->trans("AccountType").''.$object->type_lib[$object->type].'
'.$langs->trans("Currency").''; $selectedcode=$object->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $langs->trans("Currency".$selectedcode); print '
'.$langs->trans("Conciliable").''; $conciliate=$object->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); print '
'.$langs->trans("BalanceMinimalAllowed").''.$object->min_allowed.'
'.$langs->trans("BalanceMinimalDesired").''.$object->min_desired.'
'.$langs->trans("AccountancyCode").''; if (! empty($conf->accounting->enabled)) { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('',$object->account_number, 1); print $accountingaccount->getNomUrl(0,1,1,'',1); } else { print $object->account_number; } print '
'.$langs->trans("AccountancyJournal").''; $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($object->fk_accountancy_journal); print $accountingjournal->getNomUrl(0,1,1,'',1); print '
'; print '
'; print '
'; print '
'; print '
'; print ''; // Categories if ($conf->categorie->enabled) { print '"; } print ''; print ''; print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id,'bank_account',1); print "
'.$langs->trans("Comment").''.dol_htmlentitiesbr($object->comment).'
'; if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) { print '
'; print ''; print ''; print ''; // Show fields of bank account foreach ($object->getFieldsToShow() as $val) { if ($val == 'BankCode') { $content = $object->code_banque; } elseif ($val == 'DeskCode') { $content = $object->code_guichet; } elseif ($val == 'BankAccountNumber') { $content = $object->number; } elseif ($val == 'BankAccountNumberKey') { $content = $object->cle_rib; } print ''; print ''; print ''; } $ibankey = FormBank::getIBANLabel($object); $bickey="BICNumber"; if ($object->getCountryCode() == 'IN') $bickey="SWIFT"; print ''; print ''; print ''; print ''; print '\n"; print '\n"; print '\n"; print '
'.$langs->trans("BankName").''.$object->bank.'
'.$langs->trans($val).''.$content.'
'.$langs->trans($ibankey).''.$object->iban.' '; if (! empty($object->iban)) { if (! checkIbanForAccount($object)) { print img_picto($langs->trans("IbanNotValid"),'warning'); } else { print img_picto($langs->trans("IbanValid"),'info'); } } print '
'.$langs->trans($bickey).''.$object->bic.' '; if (! empty($object->bic)) { if (! checkSwiftForAccount($object)) { print img_picto($langs->trans("SwiftNotValid"),'warning'); } else { print img_picto($langs->trans("SwiftValid"),'info'); } } print '
'.$langs->trans("BankAccountDomiciliation").''; print nl2br($object->domiciliation); print "
'.$langs->trans("BankAccountOwner").''; print $object->proprio; print "
'.$langs->trans("BankAccountOwnerAddress").''; print nl2br($object->owner_address); print "
'; } print '
'; print '
'; print '
'; print '
'; dol_fiche_end(); /* * Barre d'actions */ print '
'; if ($user->rights->banque->configurer) { print 'id.'">'.$langs->trans("Modify").''; } $canbedeleted=$object->can_be_deleted(); // Renvoi vrai si compte sans mouvements if ($user->rights->banque->configurer && $canbedeleted) { print 'id.'">'.$langs->trans("Delete").''; } print '
'; } /* ************************************************************************** */ /* */ /* Edition */ /* */ /* ************************************************************************** */ if (GETPOST('id','int') && $action == 'edit' && $user->rights->banque->configurer) { $object = new Account($db); $object->fetch(GETPOST('id','int')); print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'title_bank.png'); if ($conf->use_javascript_ajax) { print "\n".''."\n"; } print '
'; print ''; print ''; print ''."\n\n"; dol_fiche_head(array(), 0, '', 0); //print '
'; print ''; // Ref print ''; print ''; // Label print ''; print ''; // Type print ''; print ''; // Currency print ''; print ''; // Status print ''; print ''; // Country $object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; $selectedcode=$object->country_code; if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"]; elseif (empty($selectedcode)) $selectedcode=$mysoc->country_code; $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''; print ''; // State print ''; // Conciliable print ''; print ''; // Balance print ''; print ''; print ''; print ''; // Web print ''; print ''; // Tags-Categories if ($conf->categorie->enabled) { print '"; } // Comment print ''; print ''; // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); } print '
'.$langs->trans("Ref").'ref).'">
'.$langs->trans("Label").'label).'">
'.$langs->trans("AccountType").''; $formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$object->type),"type"); print '
'.$langs->trans("Currency"); print ''; print ''; $selectedcode=$object->currency_code; if (! $selectedcode) $selectedcode=$conf->currency; print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); //print $langs->trans("Currency".$conf->currency); //print ''; print '
'.$langs->trans("Status").''; print $form->selectarray("clos", $object->status, (isset($_POST["clos"])?$_POST["clos"]:$object->clos)); print '
'.$langs->trans("Country").''; print $form->select_country($selectedcode,'account_country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.$langs->trans('State').''; if ($selectedcode) { print $formcompany->select_state(isset($_POST["account_state_id"])?$_POST["account_state_id"]:$object->state_id,$selectedcode,'account_state_id'); } else { print $countrynotdefined; } print '
'.$langs->trans("Conciliable").''; $conciliate=$object->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; else print ' 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation"); print '
'.$langs->trans("BalanceMinimalAllowed").'min_allowed).'">
'.$langs->trans("BalanceMinimalDesired").'min_desired).'">
'.$langs->trans("Web").'url).'">'; print '
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $c = new Categorie($db); $cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT); foreach($cats as $cat) { $arrayselected[] = $cat->id; } print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print "
'.$langs->trans("Comment").''; // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $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%'); $doleditor->Create(); print '
'; print '
'; //print '
'; print ''; // Accountancy code $tdextra = ' class="titlefieldcreate"'; if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { $tdextra = ' class="fieldrequired titlefieldcreate"'; } print ''.$langs->trans("AccountancyCode").''; print ''; // Accountancy journal if (! empty($conf->accounting->enabled)) { print ''; print ''; } print '
'; if (!empty($conf->accounting->enabled)) { print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); } else { print 'account_number).'">'; } print '
'.$langs->trans("AccountancyJournal").''; print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0); print '
'; if ($_POST["type"] == Account::TYPE_SAVINGS || $_POST["type"] == Account::TYPE_CURRENT) { print '
'; //print '
'; print ''; // If bank account print ''; print ''; print ''; // Show fields of bank account foreach ($object->getFieldsToShow() as $val) { if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; $content = $object->code_banque; } elseif ($val == 'DeskCode') { $name = 'code_guichet'; $size = 8; $content = $object->code_guichet; } elseif ($val == 'BankAccountNumber') { $name = 'number'; $size = 18; $content = $object->number; } elseif ($val == 'BankAccountNumberKey') { $name = 'cle_rib'; $size = 3; $content = $object->cle_rib; } print ''; print ''; print ''; } $ibankey = FormBank::getIBANLabel($object); $bickey="BICNumber"; if ($object->getCountryCode() == 'IN') $bickey="SWIFT"; // IBAN print ''; print ''; print ''; print ''; print '"; print ''; print ''; print ''; print '"; print '
'.$langs->trans("BankName").'
'.$langs->trans($val).'
'.$langs->trans($ibankey).'
'.$langs->trans($bickey).'
'.$langs->trans("BankAccountDomiciliation").''; print '
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwnerAddress").''; print '
'; } dol_fiche_end(); print '
'; print ''; print '     '; print ''; print '
'; print '
'; } } // End of page llxFooter(); $db->close();