diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index 75d679f8d7c..1da8a80dcf0 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -513,7 +513,8 @@ if ($account || $_GET["ref"])
// Payment type
print "
";
- $label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type;
+ //$label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type;
+ $label=$langs->getTradFromKey("PaymentTypeShort".$objp->fk_type);
if ($objp->fk_type == 'SOLD') $label=' ';
print $label;
print " | \n";
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index f446dc31304..eaaae3acb2e 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -340,7 +340,8 @@ class Translate {
}
/**
- * Return translated value of key
+ * Return translated value of key. Search in lang file, then into database.
+ * If not found, return key
*
* @param key
* @return string
@@ -361,22 +362,26 @@ class Translate {
{
$newstr=$this->getLabelFromKey($db,$reg[1],'c_shipment_mode','code','libelle');
}
+ else if (preg_match('/PaymentTypeShort([0-9A-Z]+)$/i',$key,$reg))
+ {
+ $newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle');
+ }
return $newstr;
}
/**
- * \brief Retourne la version traduite du texte passe en parametre en la codant en HTML
+ * Return text translated of text received as parameter (and encode it into HTML)
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
* et si toujours pas trouve, il est retourne tel quel
* Les parametres de cette methode peuvent contenir de balises HTML.
- * \param key cle de chaine a traduire
- * \param param1 chaine de param1
- * \param param2 chaine de param2
- * \param param3 chaine de param3
- * \param param4 chaine de param4
- * \param maxsize taille max
- * \return string Chaine traduite et code en HTML
+ * @param key cle de chaine a traduire
+ * @param param1 chaine de param1
+ * @param param2 chaine de param2
+ * @param param3 chaine de param3
+ * @param param4 chaine de param4
+ * @param maxsize taille max
+ * @return string Chaine traduite et code en HTML
*/
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
{
@@ -605,14 +610,14 @@ class Translate {
/**
- * \brief Return a label for a key. Store key-label in a cache.
- * \param db Database handler
- * \param key Key to get label (key in language file)
- * \param tablename Table name without prefix
- * \param fieldkey Field for key
- * \param fieldlabel Field for label
- * \return string Label in UTF8 (but without entities)
- * \remarks This function can be used to get label in database but more often to get code from key id.
+ * Return a label for a key. Store key-label into cache variable $this->cache_labels to save SQL requests to get labels.
+ * @param db Database handler
+ * @param key Key to get label (key in language file)
+ * @param tablename Table name without prefix
+ * @param fieldkey Field for key
+ * @param fieldlabel Field for label
+ * @return string Label in UTF8 (but without entities)
+ * @remarks This function can be used to get label in database but more often to get code from key id.
*/
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel)
{
@@ -640,7 +645,8 @@ class Translate {
{
$obj = $db->fetch_object($resql);
if ($obj) $this->cache_labels[$tablename][$key]=$obj->label;
- else $this->cache_labels[$tablename][$key]='';
+ else $this->cache_labels[$tablename][$key]=$key;
+
$db->free($resql);
return $this->cache_labels[$tablename][$key];
}
diff --git a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql
index 1b2c396c92c..6fd8182a779 100644
--- a/htdocs/install/mysql/migration/2.9.0-3.0.0.sql
+++ b/htdocs/install/mysql/migration/2.9.0-3.0.0.sql
@@ -14,14 +14,15 @@
UPDATE llx_bank_url SET type='payment' WHERE type='?' AND label='(payment)' AND url LIKE '%compta/paiement/fiche.php%';
-- Add recuperableonly field
-alter table llx_product add column recuperableonly integer NOT NULL DEFAULT '0' after tva_tx;
-alter table llx_product_price add column recuperableonly integer NOT NULL DEFAULT '0' after tva_tx;
+ALTER TABLE llx_product add column recuperableonly integer NOT NULL DEFAULT '0' after tva_tx;
+ALTER TABLE llx_product_price add column recuperableonly integer NOT NULL DEFAULT '0' after tva_tx;
-- Rename envente into tosell and add tobuy
-alter table llx_product change column envente tosell tinyint DEFAULT 1;
-alter table llx_product add column tobuy tinyint DEFAULT 1 after tosell;
-alter table llx_product_price change column envente tosell tinyint DEFAULT 1;
+ALTER TABLE llx_product CHANGE column envente tosell tinyint DEFAULT 1;
+ALTER TABLE llx_product add column tobuy tinyint DEFAULT 1 after tosell;
+ALTER TABLE llx_product_price CHANGE column envente tosell tinyint DEFAULT 1;
+ALTER TABLE llx_bank MODIFY column fk_type varchar(6);
ALTER TABLE llx_boxes_def DROP INDEX uk_boxes_def;
ALTER TABLE llx_boxes_def MODIFY file varchar(200) NOT NULL;
diff --git a/htdocs/install/mysql/tables/llx_bank.sql b/htdocs/install/mysql/tables/llx_bank.sql
index 7f34d0a3120..dd6d3cf7a8a 100644
--- a/htdocs/install/mysql/tables/llx_bank.sql
+++ b/htdocs/install/mysql/tables/llx_bank.sql
@@ -1,6 +1,6 @@
-- ===================================================================
-- Copyright (C) 2000-2006 Rodolphe Quiedeville
--- Copyright (C) 2005-2008 Laurent Destailleur
+-- Copyright (C) 2005-2010 Laurent Destailleur
--
-- 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
@@ -30,7 +30,7 @@ create table llx_bank
fk_account integer,
fk_user_author integer,
fk_user_rappro integer,
- fk_type varchar(4), -- CB, Virement, cheque
+ fk_type varchar(6), -- TIP,VIR,PRE,CB,CHQ,... (Code in llx_c_paiement)
num_releve varchar(50),
num_chq varchar(50),
rappro tinyint default 0,