Fix: Personalized payment mode is correctly saved and translation returned.
This commit is contained in:
parent
e719d62cd4
commit
5e046a91cf
@ -513,7 +513,8 @@ if ($account || $_GET["ref"])
|
|||||||
|
|
||||||
// Payment type
|
// Payment type
|
||||||
print "<td nowrap>";
|
print "<td nowrap>";
|
||||||
$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=' ';
|
if ($objp->fk_type == 'SOLD') $label=' ';
|
||||||
print $label;
|
print $label;
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|||||||
@ -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
|
* @param key
|
||||||
* @return string
|
* @return string
|
||||||
@ -361,22 +362,26 @@ class Translate {
|
|||||||
{
|
{
|
||||||
$newstr=$this->getLabelFromKey($db,$reg[1],'c_shipment_mode','code','libelle');
|
$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;
|
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
|
* 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
|
* et si toujours pas trouve, il est retourne tel quel
|
||||||
* Les parametres de cette methode peuvent contenir de balises HTML.
|
* Les parametres de cette methode peuvent contenir de balises HTML.
|
||||||
* \param key cle de chaine a traduire
|
* @param key cle de chaine a traduire
|
||||||
* \param param1 chaine de param1
|
* @param param1 chaine de param1
|
||||||
* \param param2 chaine de param2
|
* @param param2 chaine de param2
|
||||||
* \param param3 chaine de param3
|
* @param param3 chaine de param3
|
||||||
* \param param4 chaine de param4
|
* @param param4 chaine de param4
|
||||||
* \param maxsize taille max
|
* @param maxsize taille max
|
||||||
* \return string Chaine traduite et code en HTML
|
* @return string Chaine traduite et code en HTML
|
||||||
*/
|
*/
|
||||||
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
|
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.
|
* 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 db Database handler
|
||||||
* \param key Key to get label (key in language file)
|
* @param key Key to get label (key in language file)
|
||||||
* \param tablename Table name without prefix
|
* @param tablename Table name without prefix
|
||||||
* \param fieldkey Field for key
|
* @param fieldkey Field for key
|
||||||
* \param fieldlabel Field for label
|
* @param fieldlabel Field for label
|
||||||
* \return string Label in UTF8 (but without entities)
|
* @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.
|
* @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)
|
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel)
|
||||||
{
|
{
|
||||||
@ -640,7 +645,8 @@ class Translate {
|
|||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if ($obj) $this->cache_labels[$tablename][$key]=$obj->label;
|
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);
|
$db->free($resql);
|
||||||
return $this->cache_labels[$tablename][$key];
|
return $this->cache_labels[$tablename][$key];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,14 +14,15 @@
|
|||||||
UPDATE llx_bank_url SET type='payment' WHERE type='?' AND label='(payment)' AND url LIKE '%compta/paiement/fiche.php%';
|
UPDATE llx_bank_url SET type='payment' WHERE type='?' AND label='(payment)' AND url LIKE '%compta/paiement/fiche.php%';
|
||||||
|
|
||||||
-- Add recuperableonly field
|
-- Add recuperableonly field
|
||||||
alter table llx_product 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;
|
ALTER TABLE llx_product_price add column recuperableonly integer NOT NULL DEFAULT '0' after tva_tx;
|
||||||
|
|
||||||
-- Rename envente into tosell and add tobuy
|
-- Rename envente into tosell and add tobuy
|
||||||
alter table llx_product 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 add column tobuy tinyint DEFAULT 1 after tosell;
|
||||||
alter table llx_product_price change column envente tosell tinyint DEFAULT 1;
|
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 DROP INDEX uk_boxes_def;
|
||||||
ALTER TABLE llx_boxes_def MODIFY file varchar(200) NOT NULL;
|
ALTER TABLE llx_boxes_def MODIFY file varchar(200) NOT NULL;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Copyright (C) 2000-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
-- Copyright (C) 2000-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
-- Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
-- Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- 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
|
-- 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_account integer,
|
||||||
fk_user_author integer,
|
fk_user_author integer,
|
||||||
fk_user_rappro 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_releve varchar(50),
|
||||||
num_chq varchar(50),
|
num_chq varchar(50),
|
||||||
rappro tinyint default 0,
|
rappro tinyint default 0,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user