dolibarr/htdocs/societe/rib.php

220 lines
7.8 KiB
PHP
Raw Normal View History

2004-10-20 23:06:45 +02:00
<?php
2004-09-09 17:51:36 +02:00
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
2008-02-25 17:30:43 +01:00
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
2004-09-09 17:51:36 +02:00
*
* 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 Onglet rib de societe
2008-02-25 17:30:43 +01:00
\version $Id$
*/
2004-09-09 17:51:36 +02:00
require("./pre.inc.php");
2008-02-25 17:30:43 +01:00
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
require_once DOL_DOCUMENT_ROOT."/companybankaccount.class.php";
2004-09-09 17:51:36 +02:00
$langs->load("companies");
$langs->load("banks");
2008-02-25 17:30:43 +01:00
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
2008-02-25 21:03:21 +01:00
if ($user->societe_id) $socid=$user->societe_id;
2008-03-01 02:26:41 +01:00
$result = restrictedArea($user, 'societe','','');
2004-09-09 17:51:36 +02:00
$soc = new Societe($db);
$soc->id = $_GET["socid"];
$soc->fetch($_GET["socid"]);
2008-02-25 17:30:43 +01:00
/*
* Actions
*/
2004-09-09 17:51:36 +02:00
if ($_POST["action"] == 'update' && ! $_POST["cancel"])
{
// Modification
$account = new CompanyBankAccount($db, $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
}
}
/*
2008-02-25 17:30:43 +01:00
* View
*/
llxHeader();
2004-09-09 17:51:36 +02:00
2008-02-25 17:30:43 +01:00
$head=societe_prepare_head2($soc);
2008-02-25 17:30:43 +01:00
dolibarr_fiche_head($head, 'rib', $langs->trans("ThirdParty"));
2004-09-09 17:51:36 +02:00
$account = new CompanyBankAccount($db, $soc->id);
$account->fetch();
/* ************************************************************************** */
/* */
/* Visu et edition */
/* */
/* ************************************************************************** */
if ($_GET["socid"] && $_GET["action"] != 'edit')
{
if (!$account->verif())
2004-09-09 17:51:36 +02:00
{
print '<div class="error"><b>Le contr<74>le de la cl<63> indique que les informations de ce compte bancaire sont incompl<70>tes ou incorrectes.</b></div><br>';
}
2004-09-09 17:51:36 +02:00
print '<table class="border" width="100%">';
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
print '<td colspan="4">'.$account->bank.'</td></tr>';
print '<tr><td>'.$langs->trans("RIB").'</td><td align="center">Code Banque</td><td align="center">Code Guichet</td><td align="center">Num<75>ro</td><td align="center">Cl<43> RIB</td></tr>';
print '<tr><td>&nbsp;</td><td align="center">'.$account->code_banque.'</td>';
print '<td align="center">'.$account->code_guichet.'</td>';
print '<td align="center">'.$account->number.'</td>';
print '<td align="center">'.$account->cle_rib.'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
print '<td colspan="4">'.$account->iban_prefix.'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
print '<td colspan="4">'.$account->bic.'</td></tr>';
print '<tr><td valign="top">Domiciliation</td><td colspan="4">';
print $account->domiciliation;
print "</td></tr>\n";
print '<tr><td valign="top">Nom propri<72>taire du compte</td><td colspan="4">';
print $account->proprio;
print "</td></tr>\n";
print '<tr><td valign="top">Adresse propri<72>taire du compte</td><td colspan="4">';
print $account->adresse_proprio;
print "</td></tr>\n";
2004-09-09 17:51:36 +02:00
print '</table>';
2004-09-09 17:51:36 +02:00
print '</div>';
2004-09-09 17:51:36 +02:00
/*
* Barre d'actions
*
*/
2004-09-09 17:51:36 +02:00
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="rib.php?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
}
2004-09-09 17:51:36 +02:00
print '</div>';
}
2004-09-09 17:51:36 +02:00
/* ************************************************************************** */
/* */
/* Edition */
/* */
/* ************************************************************************** */
2004-09-09 17:51:36 +02:00
if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer)
{
$form = new Form($db);
if ($message) { print "$message<br><br>\n"; }
print '<form action="rib.php?socid='.$soc->id.'" method="post">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
2004-09-09 17:51:36 +02:00
print '<table class="border" width="100%">';
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
print '<td colspan="4"><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
print '<tr><td>'.$langs->trans("RIB").'</td><td>Code Banque</td><td>Code Guichet</td><td>Num<75>ro</td><td>Cl<43> RIB</td></tr>';
print '<tr><td>&nbsp;</td><td><input size="8" type="text" name="code_banque" value="'.$account->code_banque.'"></td>';
print '<td><input size="8" type="text" name="code_guichet" value="'.$account->code_guichet.'"></td>';
print '<td><input size="15" type="text" name="number" value="'.$account->number.'"></td>';
print '<td><input size="3" type="text" name="cle_rib" value="'.$account->cle_rib.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
2007-11-19 04:12:49 +01:00
print '<td colspan="4"><input size="30" type="text" name="iban_prefix" value="'.$account->iban_prefix.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>';
print '<tr><td valign="top">Domiciliation</td><td colspan="4">';
print "<textarea name=\"domiciliation\" rows=\"4\" cols=\"40\">";
print $account->domiciliation;
print "</textarea></td></tr>";
print '<tr><td valign="top">Nom propri<72>taire du compte</td>';
print '<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.'"></td></tr>';
print "</td></tr>\n";
print '<tr><td valign="top">Adresse propri<72>taire du compte</td><td colspan="4">';
print "<textarea name=\"adresse_proprio\" rows=\"4\" cols=\"40\">";
print $account->adresse_proprio;
print "</textarea></td></tr>";
2006-06-19 22:53:03 +02:00
print '<tr><td align="center" colspan="5"><input class="button" value="'.$langs->trans("Modify").'" type="submit">';
print ' &nbsp; <input name="cancel" class="button" value="'.$langs->trans("Cancel").'" type="submit">';
print '</td></tr>';
print '</form>';
2006-06-19 22:53:03 +02:00
print '</table>';
}
2004-09-09 17:51:36 +02:00
$db->close();
llxFooter('$Date$ - $Revision$');
2004-09-09 17:51:36 +02:00
?>