From bc952e557b111f149f8736fa755515be2e04d82c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Mon, 2 Feb 2004 22:51:34 +0000
Subject: [PATCH] =?UTF-8?q?La=20taille=20des=20champs=20entre=20bank=20(li?=
 =?UTF-8?q?bell=E9)=20et=20domiciliation=20(adresse=20postale)=20=E9taient?=
 =?UTF-8?q?=20invers=E9es,=20l'adresse=20du=20RIB=20=E9tait=20du=20coup=20?=
 =?UTF-8?q?tronqu=E9e.=20Ajout=20du=20nom=20du=20propri=E9taire=20du=20com?=
 =?UTF-8?q?pte=20et=20de=20l'adresse=20du=20propri=E9taire=20du=20compte.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/compta/bank/account.class.php | 12 +++--
 htdocs/compta/bank/fiche.php         | 66 ++++++++++++++++++++++------
 htdocs/compta/bank/index.php         |  2 +-
 3 files changed, 62 insertions(+), 18 deletions(-)

diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php
index 17049e6d07e..dd57e801118 100644
--- a/htdocs/compta/bank/account.class.php
+++ b/htdocs/compta/bank/account.class.php
@@ -34,6 +34,8 @@ class Account
   var $cle_rib;
   var $bic;
   var $iban_prefix;
+  var $proprio;
+  var $adresse_proprio;
 
   Function Account($DB, $rowid=0)
   {
@@ -213,10 +215,12 @@ class Account
       $sql .= ",number='".$this->number."'";
       $sql .= ",cle_rib='".$this->cle_rib."'";
       $sql .= ",bic='".$this->bic."'";
+      $sql .= ",iban_prefix = '".$this->iban_prefix."'";
       $sql .= ",domiciliation='".$this->domiciliation."'";
+      $sql .= ",proprio = '".$this->proprio."'";
+      $sql .= ",adresse_proprio = '".$this->adresse_proprio."'";
       $sql .= ",courant = ".$this->courant;
       $sql .= ",clos = ".$this->clos;
-      $sql .= ",iban_prefix = '".$this->iban_prefix."'";
 
       $sql .= " WHERE rowid = $this->id";
       
@@ -243,7 +247,7 @@ class Account
   Function fetch($id)
   {
     $this->id = $id; 
-    $sql = "SELECT rowid, label, bank, number, courant, clos, code_banque,code_guichet,cle_rib,bic,iban_prefix,domiciliation FROM ".MAIN_DB_PREFIX."bank_account";
+    $sql = "SELECT rowid, label, bank, number, courant, clos, code_banque, code_guichet, cle_rib, bic, iban_prefix, domiciliation, proprio, adresse_proprio FROM ".MAIN_DB_PREFIX."bank_account";
     $sql .= " WHERE rowid  = ".$id;
 
     $result = $this->db->query($sql);
@@ -263,8 +267,10 @@ class Account
 	    $this->number        = $obj->number;
 	    $this->cle_rib       = $obj->cle_rib;
 	    $this->bic           = $obj->bic;
-	    $this->domiciliation = $obj->domiciliation;
 	    $this->iban_prefix   = $obj->iban_prefix;
+	    $this->domiciliation = $obj->domiciliation;
+	    $this->proprio       = $obj->proprio;
+	    $this->adresse_proprio = $obj->adresse_proprio;
 	  }
 	$this->db->free();
       }
diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php
index 0ccff3b8e32..3fd3dd93e06 100644
--- a/htdocs/compta/bank/fiche.php
+++ b/htdocs/compta/bank/fiche.php
@@ -34,8 +34,10 @@ if ($HTTP_POST_VARS["action"] == 'add')
 
   $account->bank          = $HTTP_POST_VARS["bank"];
   $account->label         = $HTTP_POST_VARS["label"];
+
   $account->courant       = $HTTP_POST_VARS["courant"];
   $account->clos          = $HTTP_POST_VARS["clos"];
+
   $account->code_banque   = $HTTP_POST_VARS["code_banque"];
   $account->code_guichet  = $HTTP_POST_VARS["code_guichet"];
   $account->number        = $HTTP_POST_VARS["number"];
@@ -43,6 +45,10 @@ if ($HTTP_POST_VARS["action"] == 'add')
   $account->bic           = $HTTP_POST_VARS["bic"];
   $account->iban_prefix   = $HTTP_POST_VARS["iban_prefix"];
   $account->domiciliation = $HTTP_POST_VARS["domiciliation"];
+
+  $account->proprio 	  = $HTTP_POST_VARS["proprio"];
+  $account->adresse_proprio = $HTTP_POST_VARS["adresse_proprio"];
+
   $account->solde         = $HTTP_POST_VARS["solde"];
   $account->date_solde    = mktime(12,0,0,$HTTP_POST_VARS["remonth"],$HTTP_POST_VARS["reday"],$HTTP_POST_VARS["reyear"]);
 
@@ -67,6 +73,10 @@ if ($action == 'update')
   $account->bic          = $HTTP_POST_VARS["bic"];
   $account->iban_prefix  = $HTTP_POST_VARS["iban_prefix"];
   $account->domiciliation = $HTTP_POST_VARS["domiciliation"];
+
+  $account->proprio 	 = $HTTP_POST_VARS["proprio"];
+  $account->adresse_proprio = $HTTP_POST_VARS["adresse_proprio"];
+
   $account->update($id, $user);
 }
 
@@ -82,7 +92,7 @@ if ($action == 'create')
 {
   print_titre("Nouveau compte bancaire");
 
-  print '<p><form action="'.$PHP_SELF.'" method="post">';
+  print '<form action="'.$PHP_SELF.'" method="post">';
   print '<input type="hidden" name="action" value="add">';
   print '<input type="hidden" name="clos" value="0">';
 
@@ -111,8 +121,14 @@ if ($action == 'create')
   print '<option value="0">non<option value="1">oui</select></td></tr>';
 
   print '<tr><td valign="top">Domiciliation</td><td colspan="3">';
-  print "<textarea name=\"domiciliation\" rows=\"5\" cols=\"40\">";
-  //  print $user->description;
+  print "<textarea name=\"domiciliation\" rows=\"4\" cols=\"40\">";
+  print "</textarea></td></tr>";
+
+  print '<tr><td valign="top">Nom propri�taire du compte</td>';
+  print '<td colspan="3"><input size="12" type="text" name="proprio" value=""></td></tr>';
+
+  print '<tr><td valign="top">Adresse propri�taire du compte</td><td colspan="3">';
+  print "<textarea name=\"adresse_proprio\" rows=\"4\" cols=\"40\">";
   print "</textarea></td></tr>";
 
   print '<tr><td valign="top">Solde</td>';
@@ -136,7 +152,7 @@ if ($action == 'create')
 /* ************************************************************************** */
 else
 {
-  if ($id) 
+  if ($id && $action != 'edit') 
     {
       $account = new Account($db, $id);
       $account->fetch($id);
@@ -178,6 +194,14 @@ else
       print $account->domiciliation;
       print "</td></tr>\n";
 
+      print '<tr><td valign="top">Nom propri�taire du compte</td><td colspan="3">';
+      print $account->proprio;
+      print "</td></tr>\n";
+
+      print '<tr><td valign="top">Adresse propri�taire du compte</td><td colspan="3">';
+      print $account->adresse_proprio;
+      print "</td></tr>\n";
+
       print '</table>';
 
       print '<br><table width="100%" border="1" cellspacing="0" cellpadding="2">';
@@ -197,18 +221,25 @@ else
 
       print '</table><br>';
 
-      /* ************************************************************************** */
-      /*                                                                            */
-      /* Edition                                                                    */
-      /*                                                                            */
-      /* ************************************************************************** */
+    }
+
+  /* ************************************************************************** */
+  /*                                                                            */
+  /* Edition                                                                    */
+  /*                                                                            */
+  /* ************************************************************************** */
       
-      if ($action == 'edit' && $user->admin) 
+  if ($id && $action == 'edit' && $user->admin) 
 	{
 
+      $account = new Account($db, $id);
+      $account->fetch($id);
+
 	  $form = new Form($db);
 
-	  print '<p><form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
+      print '<div class="titre">Compte bancaire</div><br>';
+
+	  print '<form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
 	  print '<input type="hidden" name="action" value="update">';
 	  
 	  print '<table border="1" cellpadding="3" cellspacing="0">';
@@ -247,17 +278,24 @@ else
 	  print '</td></tr>';
 
 	  print '<tr><td valign="top">Domiciliation</td><td colspan="3">';
-	  print "<textarea name=\"domiciliation\" rows=\"5\" cols=\"40\">";
+	  print "<textarea name=\"domiciliation\" rows=\"4\" cols=\"40\">";
 	  print $account->domiciliation;
 	  print "</textarea></td></tr>";
 
+      print '<tr><td valign="top">Nom propri�taire du compte</td>';
+	  print '<td colspan="3"><input size="30" type="text" name="proprio" value="'.$account->proprio.'"></td></tr>';
+      print "</td></tr>\n";
+
+      print '<tr><td valign="top">Adresse propri�taire du compte</td><td colspan="3">';
+	  print "<textarea name=\"adresse_proprio\" rows=\"4\" cols=\"40\">";
+	  print $account->adresse_proprio;
+	  print "</textarea></td></tr>";
+
 	  print '<tr><td align="center" colspan="4"><input value="Enregistrer" type="submit"></td></tr>';
 	  print '</form>';
 	  print '</table>';
 	}
       
-    }
-  
 }
 
 
diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php
index 0f8e2a82c21..d807a840b12 100644
--- a/htdocs/compta/bank/index.php
+++ b/htdocs/compta/bank/index.php
@@ -145,7 +145,7 @@ print '<a href="fiche.php?action=create">Nouveau compte</a></td>';
  * Case 2
  */
 
-print '<td align="center" width="20%">-</td>';
+print '<td align="center" width="20%"><a href="config.php">Configurer</a></td>';
 print '<td align="center" width="20%">-</td>';
 print '<td align="center" width="20%">';
 print '<a href="categ.php">Cat�gories</a></td>';
-- 
GitLab