* Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * 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 2 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/societe/rib.php * \ingroup societe * \brief BAN tab for companies * \version $Id$ */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); require_once DOL_DOCUMENT_ROOT."/societe/class/companybankaccount.class.php"; $langs->load("companies"); $langs->load("banks"); $langs->load("bills"); // Security check $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'societe','',''); $soc = new Societe($db); $soc->id = $_GET["socid"]; $soc->fetch($_GET["socid"]); /* * Actions */ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) { // Modification $account = new CompanyBankAccount($db); $account->socid = $soc->id; $account->bank = $_POST["bank"]; $account->label = $_POST["label"]; $account->courant = $_POST["courant"]; $account->clos = $_POST["clos"]; $account->code_banque = $_POST["code_banque"]; $account->code_guichet = $_POST["code_guichet"]; $account->number = $_POST["number"]; $account->cle_rib = $_POST["cle_rib"]; $account->bic = $_POST["bic"]; $account->iban_prefix = $_POST["iban_prefix"]; $account->domiciliation = $_POST["domiciliation"]; $account->proprio = $_POST["proprio"]; $account->adresse_proprio = $_POST["adresse_proprio"]; $result = $account->update($user); if (! $result) { $message=$account->error(); $_GET["action"]='edit'; // Force chargement page edition } else { $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu } } /* * View */ llxHeader(); $head=societe_prepare_head2($soc); dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company'); $account = new CompanyBankAccount($db); $account->fetch(0,$soc->id); if (empty($account->socid)) $account->socid=$soc->id; /* ************************************************************************** */ /* */ /* Visu et edition */ /* */ /* ************************************************************************** */ if ($_GET["socid"] && $_GET["action"] != 'edit') { // Check BBAN if (! checkBanForAccount($account)) { print '
'.$langs->trans("RIBControlError").'

'; } print ''; print ''; print ''; if ($account->useDetailedBBAN() == 1) { print ''; print ''; print ''; print ''; print ''; print ''; } if ($account->useDetailedBBAN() == 2) { print ''; print ''; print ''; } print ''; print ''; print ''; if ($account->useDetailedBBAN() == 1) { print ''; print ''; print ''; } print ''; print ''; print ''; print ''; print '\n"; print '\n"; print '\n"; print '
'.$langs->trans("Bank").''.$account->bank.'
'.$langs->trans("BankCode").''.$account->code_banque.'
'.$langs->trans("DeskCode").''.$account->code_guichet.'
'.$langs->trans("BankCode").''.$account->code_banque.'
'.$langs->trans("BankAccountNumber").''.$account->number.'
'.$langs->trans("BankAccountNumberKey").''.$account->cle_rib.'
'.$langs->trans("IBAN").''.$account->iban_prefix.'
'.$langs->trans("BIC").''.$account->bic.'
'.$langs->trans("BankAccountDomiciliation").''; print $account->domiciliation; print "
'.$langs->trans("BankAccountOwner").''; print $account->proprio; print "
'.$langs->trans("BankAccountOwnerAddress").''; print $account->adresse_proprio; print "
'; print ''; /* * Barre d'actions * */ print '
'; if ($user->rights->societe->creer) { print ''.$langs->trans("Modify").''; } print '
'; } /* ************************************************************************** */ /* */ /* Edition */ /* */ /* ************************************************************************** */ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer) { $form = new Form($db); if ($message) { print "$message

\n"; } print '
'; print ''; print ''; print ''; print ''; print ''; print ''; // BBAN if ($account->useDetailedBBAN() == 1) { print ''; print ''; print ''; print ''; print ''; print ''; } if ($account->useDetailedBBAN() == 2) { print ''; print ''; print ''; } print ''; print ''; print ''; if ($account->useDetailedBBAN() == 1) { print ''; print ''; print ''; } // IBAN print ''; print ''; print ''; print ''; print '"; print ''; print ''; print "\n"; print '"; print ''; print ''; print '
'.$langs->trans("Bank").'
'.$langs->trans("BankCode").'
'.$langs->trans("DeskCode").'
'.$langs->trans("BankCode").'
'.$langs->trans("BankAccountNumber").'
'.$langs->trans("BankAccountNumberKey").'
'.$langs->trans("IBAN").'
'.$langs->trans("BIC").'
'.$langs->trans("BankAccountDomiciliation").''; print "
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwnerAddress").''; print "
'; print '   '; print '
'; } $db->close(); llxFooter('$Date$ - $Revision$'); ?>