diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php deleted file mode 100644 index f20d70ef14fcc28c4cd8dc8336c4e04f41d00350..0000000000000000000000000000000000000000 --- a/htdocs/compta/bank/bankid_fr.php +++ /dev/null @@ -1,477 +0,0 @@ -<?php -/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> - * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> - * Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -/** - * \file htdocs/compta/bank/bankid_fr.php - * \ingroup banque - * \brief Fiche creation compte bancaire - */ - -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.'/compta/bank/class/account.class.php'; - -$langs->load("banks"); -$langs->load("categories"); -$langs->load("bills"); - -$action=GETPOST('action'); -$id=GETPOST('id','int'); -$ref=GETPOST('ref'); - -// Security check -if (isset($_GET["id"]) || isset($_GET["ref"])) -{ - $id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["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); - - -/* - * Actions - */ - -if ($action == 'update' && ! $_POST["cancel"]) -{ - // Modification - $account = new Account($db); - $account->fetch($id); - - $account->bank = trim($_POST["bank"]); - $account->code_banque = trim($_POST["code_banque"]); - $account->code_guichet = trim($_POST["code_guichet"]); - $account->number = trim($_POST["number"]); - $account->cle_rib = trim($_POST["cle_rib"]); - $account->bic = trim($_POST["bic"]); - $account->iban = trim($_POST["iban"]); - $account->domiciliation = trim($_POST["domiciliation"]); - $account->proprio = trim($_POST["proprio"]); - $account->owner_address = trim($_POST["owner_address"]); - $account->state_id = trim($_POST["state_id"]); - //$account->country_id = trim($_POST["country_id"]); // We do not change this. - - if ($account->id) - { - $result = $account->update_bban($user); - if ($result >= 0) - { - $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu - } - else - { - setEventMessage($account->error, 'errors'); - $action='edit'; // Force chargement page edition - } - } -} - -if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer) -{ - // Modification - $account = new Account($db); - $account->fetch($id); - $account->delete(); - - header("Location: ".DOL_URL_ROOT."/compta/bank/index.php"); - exit; -} - - -/* - * View - */ - -llxHeader(); - -$form = new Form($db); - -/* ************************************************************************** */ -/* */ -/* Affichage page en mode creation */ -/* */ -/* ************************************************************************** */ - -if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') -{ - $account = new Account($db); - if ($_GET["id"]) - { - $result=$account->fetch($id); - } - if ($_GET["ref"]) - { - $result=$account->fetch(0,$_GET["ref"]); - $_GET["id"]=$account->id; - } - - // Onglets - $head=bank_prepare_head($account); - dol_fiche_head($head, 'bankid', $langs->trans("FinancialAccount"),0,'account'); - - // Confirmation de la suppression - if ($action == 'delete') - { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); - - } - - - print '<table class="border" width="100%">'; - - $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; - - // Ref - print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>'; - print '<td colspan="3">'; - print $form->showrefnav($account, 'ref', $linkback, 1, 'ref'); - print '</td></tr>'; - - // Label - print '<tr><td valign="top">'.$langs->trans("Label").'</td>'; - print '<td colspan="3">'.$account->label.'</td></tr>'; - - // Type - print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>'; - print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>'; - - // Currency - print '<tr><td valign="top">'.$langs->trans("Currency").'</td>'; - print '<td colspan="3">'; - $selectedcode=$account->account_currency_code; - if (! $selectedcode) $selectedcode=$conf->currency; - print $langs->trans("Currency".$selectedcode); - print '</td></tr>'; - - // Status - print '<tr><td valign="top">'.$langs->trans("Status").'</td>'; - print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>'; - - if ($account->type == 0 || $account->type == 1) - { - // Country - print '<tr><td valign="top">'.$langs->trans("BankAccountCountry").'</td><td colspan="3">'; - $img=picto_from_langcode($account->country_code); - print $img?$img.' ':''; - print getCountry($account->getCountryCode(), 0, $db); - print "</td></tr>\n"; - - print '<tr><td valign="top">'.$langs->trans("BankName").'</td>'; - print '<td colspan="3">'.$account->bank.'</td></tr>'; - - // Show fields of bank account - $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey'; - if (! empty($conf->global->BANK_SHOW_ORDER_OPTION)) - { - if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) - { - if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber'; - } - else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION; - } - $fieldlistsarray=explode(' ',$fieldlists); - - foreach($fieldlistsarray as $val) - { - if ($val == 'BankCode') - { - if ($account->useDetailedBBAN() == 1) - { - print '<tr><td>'.$langs->trans("BankCode").'</td>'; - print '<td colspan="3">'.$account->code_banque.'</td>'; - print '</tr>'; - } - } - if ($val == 'DeskCode') - { - if ($account->useDetailedBBAN() == 1) - { - print '<tr><td>'.$langs->trans("DeskCode").'</td>'; - print '<td colspan="3">'.$account->code_guichet.'</td>'; - print '</tr>'; - } - } - - if ($val == 'BankCode') - { - if ($account->useDetailedBBAN() == 2) - { - print '<tr><td>'.$langs->trans("BankCode").'</td>'; - print '<td colspan="3">'.$account->code_banque.'</td>'; - print '</tr>'; - } - } - - if ($val == 'AccountNumber') - { - print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>'; - print '<td colspan="3">'.$account->number.'</td>'; - print '</tr>'; - } - - if ($val == 'BankAccountNumberKey') - { - if ($account->useDetailedBBAN() == 1) - { - print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>'; - print '<td colspan="3">'.$account->cle_rib.'</td>'; - print '</tr>'; - } - } - } - - $ibankey="IBANNumber"; - $bickey="BICNumber"; - if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; - if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; - - print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>'; - print '<td colspan="3">'.$account->iban.' '; - if (! empty($account->iban)) { - if (! checkIbanForAccount($account)) { - print img_picto($langs->trans("IbanNotValid"),'warning'); - } else { - print img_picto($langs->trans("IbanValid"),'info'); - } - } - print '</td></tr>'; - - print '<tr><td valign="top">'.$langs->trans($bickey).'</td>'; - print '<td colspan="3">'.$account->bic.' '; - if (! empty($account->bic)) { - if (! checkSwiftForAccount($account)) { - print img_picto($langs->trans("SwiftNotValid"),'warning'); - } else { - print img_picto($langs->trans("SwiftValid"),'info'); - } - } - print '</td></tr>'; - - print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">'; - print nl2br($account->domiciliation); - print "</td></tr>\n"; - - print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">'; - print $account->proprio; - print "</td></tr>\n"; - - print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">'; - print nl2br($account->owner_address); - print "</td></tr>\n"; - - } - - print '</table>'; - - - // Check BBAN - if (! checkBanForAccount($account)) - { - print '<div class="warning">'.$langs->trans("RIBControlError").'</div>'; - } - - print "\n</div>\n"; - - - /* - * Barre d'actions - */ - - print '<div class="tabsAction">'; - - if ($user->rights->banque->configurer) - { - print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Modify").'</a>'; - } - - print '</div>'; - -} - -/* ************************************************************************** */ -/* */ -/* Edition */ -/* */ -/* ************************************************************************** */ - -if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer) -{ - $account = new Account($db); - $account->fetch($id); - - print_fiche_titre($langs->trans("EditFinancialAccount")); - print "<br>"; - - print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">'; - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - print '<input type="hidden" name="action" value="update">'; - print '<input type="hidden" name="id" value="'.$_GET["id"].'">'."\n\n"; - - print '<table class="border" width="100%">'; - - // Ref - print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>'; - print '<td colspan="3">'.$account->ref; - print '</td></tr>'; - - // Label - print '<tr><td valign="top">'.$langs->trans("Label").'</td>'; - print '<td colspan="3">'.$account->label; - print '</td></tr>'; - - // Type - print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>'; - print '<td colspan="3">'.$account->type_lib[$account->type]; - print '</td></tr>'; - - // Currency - print '<tr><td valign="top">'.$langs->trans("Currency").'</td>'; - print '<td colspan="3">'; - $selectedcode=$account->account_currency_code; - if (! $selectedcode) $selectedcode=$conf->currency; - print $langs->trans("Currency".$selectedcode); - print '</td></tr>'; - - // Status - print '<tr><td valign="top">'.$langs->trans("Status").'</td>'; - print '<td colspan="3">'.$account->getLibStatut(4); - print '</td></tr>'; - - if ($account->type == 0 || $account->type == 1) - { - print '<tr><td valign="top">'.$langs->trans("BankAccountCountry").'</td><td colspan="3">'; - $img=picto_from_langcode($account->country_code); - print $img?$img.' ':''; - print getCountry($account->getCountryCode(), 0, $db); - print "</td></tr>\n"; - - // If bank account - print '<tr><td valign="top">'.$langs->trans("BankName").'</td>'; - print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>'; - print '</tr>'; - - // Show fields of bank account - $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey'; - if (! empty($conf->global->BANK_SHOW_ORDER_OPTION)) - { - if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) - { - if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber'; - } - else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION; - } - $fieldlistsarray=explode(' ',$fieldlists); - - foreach($fieldlistsarray as $val) - { - if ($val == 'BankCode') - { - if ($account->useDetailedBBAN() == 1) - { - print '<tr><td>'.$langs->trans("BankCode").'</td>'; - print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>'; - print '</tr>'; - } - } - - if ($val == 'DeskCode') - { - if ($account->useDetailedBBAN() == 1) - { - print '<tr><td>'.$langs->trans("DeskCode").'</td>'; - print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>'; - print '</tr>'; - } - } - - if ($val == 'BankCode') - { - if ($account->useDetailedBBAN() == 2) - { - print '<tr><td>'.$langs->trans("BankCode").'</td>'; - print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>'; - print '</tr>'; - } - } - - if ($val == 'AccountNumber') - { - print '<td>'.$langs->trans("BankAccountNumber").'</td>'; - print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>'; - print '</tr>'; - } - - if ($val == 'BankAccountNumberKey') - { - if ($account->useDetailedBBAN() == 1) - { - print '<td>'.$langs->trans("BankAccountNumberKey").'</td>'; - print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>'; - print '</tr>'; - } - } - } - - $ibankey="IBANNumber"; - $bickey="BICNumber"; - if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; - if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; - - // IBAN - print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>'; - print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>'; - - print '<tr><td valign="top">'.$langs->trans($bickey).'</td>'; - print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>'; - - print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">'; - print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">"; - print $account->domiciliation; - print "</textarea></td></tr>"; - - print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>'; - print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">'; - print '</td></tr>'; - - print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">'; - print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">"; - print $account->owner_address; - print "</textarea></td></tr>"; - - } - - print '</table>'; - - print '<br>'; - - print '<div align="center">'; - print '<input value="'.$langs->trans("Save").'" type="submit" class="button">'; - print ' <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">'; - print '</div>'; - - print '</form>'; -} - - -llxFooter(); - -$db->close(); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index c44dd2058b7c577cef2968797f4a08fc9787423a..0b4307f8a98c8a3afd03763494d70ee34cc226b0 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -2,8 +2,8 @@ /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> - * Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> - * Copytight (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> + * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com> * * 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 @@ -21,16 +21,16 @@ /** * \file htdocs/compta/bank/card.php - * \ingroup banque + * \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/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'; $langs->load("banks"); @@ -70,6 +70,18 @@ if ($_POST["action"] == 'add') $account->clos = $_POST["clos"]; $account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1; $account->url = $_POST["url"]; + + $account->bank = trim($_POST["bank"]); + $account->code_banque = trim($_POST["code_banque"]); + $account->code_guichet = trim($_POST["code_guichet"]); + $account->number = trim($_POST["number"]); + $account->cle_rib = trim($_POST["cle_rib"]); + $account->bic = trim($_POST["bic"]); + $account->iban = trim($_POST["iban"]); + $account->domiciliation = trim($_POST["domiciliation"]); + + $account->proprio = trim($_POST["proprio"]); + $account->owner_address = trim($_POST["owner_address"]); $account->account_number = trim($_POST["account_number"]); $account->accountancy_journal = trim($_POST["accountancy_journal"]); @@ -233,8 +245,15 @@ if ($action == 'create') if ($conf->use_javascript_ajax) { - print "\n".'<script type="text/javascript" language="javascript">'; + print "\n".'<script type="text/javascript" language="javascript">'; print 'jQuery(document).ready(function () { + jQuery("#selecttype").change(function() { + document.formsoc.action.value="create"; + document.formsoc.submit(); + }); + })'."\n"; + + print 'jQuery(document).ready(function () { jQuery("#selectaccount_country_id").change(function() { document.formsoc.action.value="create"; document.formsoc.submit(); @@ -251,7 +270,7 @@ if ($action == 'create') print '<table class="border" width="100%">'; // Ref - print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>'; + print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>'; print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>'; // Label @@ -326,7 +345,6 @@ if ($action == 'create') print $account->showOptionals($extrafields,'edit',$parameters); } - print '</table>'; print '<br>'; @@ -349,9 +367,108 @@ if ($action == 'create') print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->account_min_desired).'"></td></tr>'; print '</table>'; - print '<br>'; + if ($_POST["type"] == 0 || $_POST["type"] == 1) + { + print '<table class="border" width="100%">'; + + // If bank account + print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>'; + print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>'; + print '</tr>'; + + // Show fields of bank account + $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey'; + if (! empty($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber'; + } + else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION; + } + $fieldlistsarray=explode(' ',$fieldlists); + + foreach($fieldlistsarray as $val) + { + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 1) + { + print '<tr><td>'.$langs->trans("BankCode").'</td>'; + print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>'; + print '</tr>'; + } + } + + if ($val == 'DeskCode') + { + if ($account->useDetailedBBAN() == 1) + { + print '<tr><td>'.$langs->trans("DeskCode").'</td>'; + print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>'; + print '</tr>'; + } + } + + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 2) + { + print '<tr><td>'.$langs->trans("BankCode").'</td>'; + print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>'; + print '</tr>'; + } + } + + if ($val == 'AccountNumber') + { + print '<td>'.$langs->trans("BankAccountNumber").'</td>'; + print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>'; + print '</tr>'; + } + + if ($val == 'BankAccountNumberKey') + { + if ($account->useDetailedBBAN() == 1) + { + print '<td>'.$langs->trans("BankAccountNumberKey").'</td>'; + print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>'; + print '</tr>'; + } + } + } + $ibankey="IBANNumber"; + $bickey="BICNumber"; + if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; + if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; + + // IBAN + print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>'; + print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>'; + + print '<tr><td valign="top">'.$langs->trans($bickey).'</td>'; + print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>'; + + print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">'; + print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">"; + print $account->domiciliation; + print "</textarea></td></tr>"; + + print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>'; + print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">'; + print '</td></tr>'; + + print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">'; + print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">"; + print $account->owner_address; + print "</textarea></td></tr>"; + + print '</table>'; + print '<br>'; + } + print '<table class="border" width="100%">'; // Accountancy code if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) @@ -495,6 +612,118 @@ else print '</table>'; print '<br>'; + + if ($account->type == 0 || $account->type == 1) + { + print '<table class="border" width="100%">'; + + print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>'; + print '<td colspan="3">'.$account->bank.'</td></tr>'; + + // Show fields of bank account + $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey'; + if (! empty($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber'; + } + else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION; + } + $fieldlistsarray=explode(' ',$fieldlists); + + foreach($fieldlistsarray as $val) + { + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 1) + { + print '<tr><td>'.$langs->trans("BankCode").'</td>'; + print '<td colspan="3">'.$account->code_banque.'</td>'; + print '</tr>'; + } + } + if ($val == 'DeskCode') + { + if ($account->useDetailedBBAN() == 1) + { + print '<tr><td>'.$langs->trans("DeskCode").'</td>'; + print '<td colspan="3">'.$account->code_guichet.'</td>'; + print '</tr>'; + } + } + + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 2) + { + print '<tr><td>'.$langs->trans("BankCode").'</td>'; + print '<td colspan="3">'.$account->code_banque.'</td>'; + print '</tr>'; + } + } + + if ($val == 'AccountNumber') + { + print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>'; + print '<td colspan="3">'.$account->number.'</td>'; + print '</tr>'; + } + + if ($val == 'BankAccountNumberKey') + { + if ($account->useDetailedBBAN() == 1) + { + print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>'; + print '<td colspan="3">'.$account->cle_rib.'</td>'; + print '</tr>'; + } + } + } + + $ibankey="IBANNumber"; + $bickey="BICNumber"; + if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; + if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; + + print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>'; + print '<td colspan="3">'.$account->iban.' '; + if (! empty($account->iban)) { + if (! checkIbanForAccount($account)) { + print img_picto($langs->trans("IbanNotValid"),'warning'); + } else { + print img_picto($langs->trans("IbanValid"),'info'); + } + } + print '</td></tr>'; + + print '<tr><td valign="top">'.$langs->trans($bickey).'</td>'; + print '<td colspan="3">'.$account->bic.' '; + if (! empty($account->bic)) { + if (! checkSwiftForAccount($account)) { + print img_picto($langs->trans("SwiftNotValid"),'warning'); + } else { + print img_picto($langs->trans("SwiftValid"),'info'); + } + } + print '</td></tr>'; + + print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">'; + print nl2br($account->domiciliation); + print "</td></tr>\n"; + + print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">'; + print $account->proprio; + print "</td></tr>\n"; + + print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">'; + print nl2br($account->owner_address); + print "</td></tr>\n"; + + print '</table>'; + print '<br>'; + } + print '<table class="border" width="100%">'; // Accountancy code print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>'; @@ -549,6 +778,13 @@ else { print "\n".'<script type="text/javascript" language="javascript">'; print 'jQuery(document).ready(function () { + jQuery("#selecttype").change(function() { + document.formsoc.action.value="edit"; + document.formsoc.submit(); + }); + })'."\n"; + + print 'jQuery(document).ready(function () { jQuery("#selectaccount_country_id").change(function() { document.formsoc.action.value="edit"; document.formsoc.submit(); @@ -643,7 +879,7 @@ else // Comment print '<tr><td valign="top">'.$langs->trans("Comment").'</td>'; print '<td colspan="3">'; - // Editor wysiwyg + // Editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); @@ -656,11 +892,110 @@ else { print $account->showOptionals($extrafields,'edit'); } - - print '</table>'; - print '<br>'; + + if ($_POST["type"] == 0 || $_POST["type"] == 1) + { + print '<table class="border" width="100%">'; + + // If bank account + print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>'; + print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>'; + print '</tr>'; + + // Show fields of bank account + $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey'; + if (! empty($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber'; + } + else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION; + } + $fieldlistsarray=explode(' ',$fieldlists); + + foreach($fieldlistsarray as $val) + { + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 1) + { + print '<tr><td>'.$langs->trans("BankCode").'</td>'; + print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>'; + print '</tr>'; + } + } + + if ($val == 'DeskCode') + { + if ($account->useDetailedBBAN() == 1) + { + print '<tr><td>'.$langs->trans("DeskCode").'</td>'; + print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>'; + print '</tr>'; + } + } + + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 2) + { + print '<tr><td>'.$langs->trans("BankCode").'</td>'; + print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>'; + print '</tr>'; + } + } + + if ($val == 'AccountNumber') + { + print '<td>'.$langs->trans("BankAccountNumber").'</td>'; + print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>'; + print '</tr>'; + } + + if ($val == 'BankAccountNumberKey') + { + if ($account->useDetailedBBAN() == 1) + { + print '<td>'.$langs->trans("BankAccountNumberKey").'</td>'; + print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>'; + print '</tr>'; + } + } + } + + $ibankey="IBANNumber"; + $bickey="BICNumber"; + if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; + if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; + + // IBAN + print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>'; + print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>'; + + print '<tr><td valign="top">'.$langs->trans($bickey).'</td>'; + print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>'; + + print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">'; + print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">"; + print $account->domiciliation; + print "</textarea></td></tr>"; + + print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>'; + print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">'; + print '</td></tr>'; + + print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">'; + print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">"; + print $account->owner_address; + print "</textarea></td></tr>"; + + print '</table>'; + print '<br>'; + } + print '<table class="border" width="100%">'; // Accountancy code diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 1db6ec18cc6a3fd11c5d2872901aaceb8a415419..98ef24e177d496296c5e47bf39f7e7f1c1d00a2c 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1,11 +1,12 @@ <?php -/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> - * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> - * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> - * Copytight (C) 2013 Florian Henry <florian.henry@open-concept.pro> - * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> +/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> + * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> + * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> + * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> + * Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com> * * 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 @@ -23,7 +24,7 @@ /** * \file htdocs/compta/bank/class/account.class.php - * \ingroup banque + * \ingroup bank * \brief File of class to manage bank accounts */ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; @@ -389,7 +390,17 @@ class Account extends CommonObject $sql.= ", entity"; $sql.= ", account_number"; $sql.= ", accountancy_journal"; - $sql.= ", currency_code"; + $sql.= ", bank"; + $sql.= ", code_banque"; + $sql.= ", code_guichet"; + $sql.= ", number"; + $sql.= ", cle_rib"; + $sql.= ", bic"; + $sql.= ", iban_prefix"; + $sql.= ", domiciliation"; + $sql.= ", proprio"; + $sql.= ", owner_address"; + $sql.= ", currency_code"; $sql.= ", rappro"; $sql.= ", min_allowed"; $sql.= ", min_desired"; @@ -403,6 +414,16 @@ class Account extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->escape($this->account_number)."'"; $sql.= ", '".$this->db->escape($this->accountancy_journal)."'"; + $sql.= ", '".$this->db->escape($this->bank)."'"; + $sql.= ", '".$this->code_banque."'"; + $sql.= ", '".$this->code_guichet."'"; + $sql.= ", '".$this->number."'"; + $sql.= ", '".$this->cle_rib."'"; + $sql.= ", '".$this->bic."'"; + $sql.= ", '".$this->iban."'"; + $sql.= ", '".$this->db->escape($this->domiciliation)."'"; + $sql.= ", '".$this->db->escape($this->proprio)."'"; + $sql.= ", '".$this->db->escape($this->owner_address)."'"; $sql.= ", '".$this->currency_code."'"; $sql.= ", ".$this->rappro; $sql.= ", ".price2num($this->min_allowed); @@ -523,6 +544,17 @@ class Account extends CommonObject $sql.= ",url = ".($this->url?"'".$this->url."'":"null"); $sql.= ",account_number = '".$this->account_number."'"; $sql.= ",accountancy_journal = '".$this->accountancy_journal."'"; + + $sql.= ",bank = '".$this->db->escape($this->bank)."'"; + $sql.= ",code_banque='".$this->code_banque."'"; + $sql.= ",code_guichet='".$this->code_guichet."'"; + $sql.= ",number='".$this->number."'"; + $sql.= ",cle_rib='".$this->cle_rib."'"; + $sql.= ",bic='".$this->bic."'"; + $sql.= ",iban_prefix = '".$this->iban."'"; + $sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; + $sql.= ",proprio = '".$this->db->escape($this->proprio)."'"; + $sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql.= ",currency_code = '".$this->currency_code."'"; diff --git a/htdocs/core/class/html.formbank.class.php b/htdocs/core/class/html.formbank.class.php index 647688bb64120409adb4680e87d993884b4ffa26..12bff860a2662568cb31c32fac14277933f0865d 100644 --- a/htdocs/core/class/html.formbank.class.php +++ b/htdocs/core/class/html.formbank.class.php @@ -1,5 +1,6 @@ <?php -/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com> * * 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 @@ -55,7 +56,7 @@ class FormBank $type_available=array(0,1,2); - print '<select class="flat" name="'.$htmlname.'">'; + print '<select id="select'.$htmlname.'" class="flat" name="'.$htmlname.'">'; $num = count($type_available); $i = 0; if ($num) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 001c030305ae1983254426bdce13e08e8476beb6..a0f670c1958edf095d0335ffd2bcd4352906cf87 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -1,7 +1,7 @@ <?php - /* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com> * * 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 @@ -20,8 +20,8 @@ /** * \file htdocs/core/lib/bank.lib.php + * \ingroup bank * \brief Ensemble de fonctions de base pour le module banque - * \ingroup banque */ /** @@ -41,13 +41,6 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'bankname'; $h++; - if ($object->type == 0 || $object->type == 1) { - $head[$h][0] = DOL_URL_ROOT . '/compta/bank/bankid_fr.php?id=' . $object->id; - $head[$h][1] = $langs->trans("RIB"); - $head[$h][2] = 'bankid'; - $h++; - } - $head[$h][0] = DOL_URL_ROOT . "/compta/bank/account.php?id=" . $object->id; $head[$h][1] = $langs->trans("Transactions"); $head[$h][2] = 'journal';