Fix: Missing fields and missing encoding of special chars

This commit is contained in:
Laurent Destailleur 2011-07-10 16:50:40 +00:00
parent 9ae8b88380
commit ff9b139705
3 changed files with 25 additions and 21 deletions

View File

@ -25,7 +25,7 @@
* \file htdocs/contact/class/contact.class.php
* \ingroup societe
* \brief File of contacts class
* \version $Id: contact.class.php,v 1.30 2011/07/04 09:36:29 eldy Exp $
* \version $Id: contact.class.php,v 1.31 2011/07/10 16:50:40 eldy Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -42,15 +42,16 @@ class Contact extends CommonObject
var $table_element='socpeople';
var $id;
var $civilite_id;
var $name;
var $nom;
var $civilite_id; // In fact we stor civility_code
var $lastname;
var $name; // TODO deprecated
var $nom; // TODO deprecated
var $firstname;
var $prenom;
var $prenom; // TODO deprecated
var $address;
var $cp; // TODO deprecated
var $cp; // TODO deprecated
var $zip;
var $ville; // TODO deprecated
var $ville; // TODO deprecated
var $town;
var $fk_departement; // Id of department

View File

@ -22,7 +22,7 @@
* \file htdocs/core/class/commonobject.class.php
* \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
* \version $Id: commonobject.class.php,v 1.144 2011/07/04 09:36:29 eldy Exp $
* \version $Id: commonobject.class.php,v 1.145 2011/07/10 16:50:40 eldy Exp $
*/
@ -264,10 +264,10 @@ class CommonObject
/**
* Get array of all contacts for an object
* @param statut Status of lines to get (-1=all)
* @param source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param list 0:all, 1:just id
* @return array Array of contacts
* @param statut int Status of lines to get (-1=all)
* @param source string Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param int list 0:Return array contains all properties, 1:Return array contains just id
* @return array Array of contacts
*/
function liste_contact($statut=-1,$source='external',$list=0)
{
@ -278,7 +278,7 @@ class CommonObject
$sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id";
if ($source == 'internal') $sql.=", '-1' as socid";
if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid";
$sql.= ", t.name as nom, t.firstname";
$sql.= ", t.civilite as civility, t.name as lastname, t.firstname, t.email";
$sql.= ", tc.source, tc.element, tc.code, tc.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
$sql.= ", ".MAIN_DB_PREFIX."element_contact ec";
@ -307,7 +307,9 @@ class CommonObject
{
$transkey="TypeContact_".$obj->element."_".$obj->source."_".$obj->code;
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,'nom'=>$obj->nom, 'firstname'=>$obj->firstname,
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,
'nom'=>$obj->lastname, // For backward compatibility
'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email,
'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut);
}
else
@ -329,9 +331,10 @@ class CommonObject
}
/**
* \brief Le detail d'un contact
* \param rowid L'identifiant du contact
* \return object L'objet construit par DoliDb.fetch_object
* Return fetch cursor of a contact
* FIXME We should never return an open db cursor
* @param rowid L'identifiant du contact
* @return object L'objet construit par DoliDb.fetch_object
*/
function detail_contact($rowid)
{

View File

@ -31,7 +31,7 @@
* \file htdocs/core/class/html.form.class.php
* \ingroup core
* \brief File of class with all html predefined components
* \version $Id: html.form.class.php,v 1.186 2011/07/04 11:33:22 eldy Exp $
* \version $Id: html.form.class.php,v 1.187 2011/07/10 16:50:40 eldy Exp $
*/
@ -3146,7 +3146,7 @@ class Form
* @param key_in_label 1 pour afficher la key dans la valeur "[key] value"
* @param value_as_key 1 to use value as key
* @param option Valeur de l'option en fonction du type choisi
* @param translate Traduire la valeur
* @param translate Translate and encode value
* @param maxlen Length maximum for labels
* @param disabled Html select box is disabled
* @return string HTML select string
@ -3178,13 +3178,13 @@ class Form
if ($key_in_label)
{
$newval=($translate?$langs->trans($value):$value);
$selectOptionValue = $key.' - '.($maxlen?dol_trunc($newval,$maxlen):$newval);
$selectOptionValue = dol_htmlentitiesbr($key.' - '.($maxlen?dol_trunc($newval,$maxlen):$newval));
$out.=$selectOptionValue;
}
else
{
$newval=($translate?$langs->trans($value):$value);
$selectOptionValue = ($maxlen?dol_trunc($newval,$maxlen):$newval);
$selectOptionValue = dol_htmlentitiesbr($maxlen?dol_trunc($newval,$maxlen):$newval);
if ($value == '' || $value == '-') { $selectOptionValue=' '; }
$out.=$selectOptionValue;
}