Fix: Data are always encoded in UTF8 in Dolibarr memory, so we must not use ut8_encode on this->property variables or we encode it twice (remove of utf8_encode call was forgotten in 2.6 for contacts).

This commit is contained in:
Laurent Destailleur 2009-08-11 12:51:33 +00:00
parent b1bb20c1bf
commit 9735c0c770
5 changed files with 483 additions and 486 deletions

View File

@ -142,13 +142,13 @@ if ($_POST["action"] == 'add_action')
{
if ($_POST["actioncode"] == 'AC_RDV' && $contact->getFullName($langs))
{
$actioncomm->label = $langs->transnoentities("TaskRDVWith",$contact->getFullName($langs));
$actioncomm->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs));
}
else
{
if ($langs->trans("Action".$actioncomm->type_code) != "Action".$actioncomm->type_code)
{
$actioncomm->label = $langs->transnoentities("Action".$actioncomm->type_code)."\n";
$actioncomm->label = $langs->transnoentitiesnoconv("Action".$actioncomm->type_code)."\n";
}
else $actioncomm->label = $cactioncomm->libelle;
}
@ -207,7 +207,7 @@ if ($_POST["action"] == 'add_action')
{
$error=1;
$_GET["action"] = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEnd")).'</div>';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'</div>';
}
if ($datea && $_POST["percentage"] == 0)
{
@ -220,7 +220,7 @@ if ($_POST["action"] == 'add_action')
{
$error=1;
$_GET["action"] = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
}
if (! $error)

File diff suppressed because it is too large Load Diff

View File

@ -1563,12 +1563,12 @@ class User extends CommonObject
}
/*
/**
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* \param info Info string loaded by _load_ldap_info
* \param mode 0=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
1=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
2=Return key only (uid=qqq)
* 1=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 2=Return key only (uid=qqq)
* \return string DN
*/
function _load_ldap_dn($info,$mode=0)
@ -1582,7 +1582,7 @@ class User extends CommonObject
}
/*
/**
* \brief Initialise tableau info (tableau des attributs LDAP)
* \return array Tableau info des attributs
*/

View File

@ -522,12 +522,12 @@ class UserGroup extends CommonObject
}
/*
/**
* \brief Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* \param info Info string loaded by _load_ldap_info
* \param mode 0=Return DN without key inside (ou=xxx,dc=aaa,dc=bbb)
1=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
2=Return key only (uid=qqq)
* 1=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 2=Return key only (uid=qqq)
* \return string DN
*/
function _load_ldap_dn($info,$mode=0)
@ -541,7 +541,7 @@ class UserGroup extends CommonObject
}
/*
/**
* \brief Initialise tableau info (tableau des attributs LDAP)
* \return array Tableau info des attributs
*/

View File

@ -1,6 +1,6 @@
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -15,20 +15,18 @@
* 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.
*
* $Id$
* $Source$
*/
/**
\file scripts/company/sync_contacts_dolibarr2ldap.php
\ingroup ldap company
\brief Script de mise a jour des contacts dans LDAP depuis base Dolibarr
*/
* \file scripts/company/sync_contacts_dolibarr2ldap.php
* \ingroup ldap company
* \brief Script to update all contacts from Dolibarr into a LDAP database
* \version $Id$
*/
// Test si mode CLI
$sapi_type = php_sapi_name();
$script_file=__FILE__;
$script_file=__FILE__;
if (eregi('([^\\\/]+)$',$script_file,$reg)) $script_file=$reg[1];
if (substr($sapi_type, 0, 3) == 'cgi') {
@ -37,7 +35,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
}
if (! isset($argv[1]) || ! $argv[1]) {
print "Usage: $script_file now\n";
print "Usage: $script_file now\n";
exit;
}
$now=$argv[1];
@ -59,7 +57,7 @@ print "***** $script_file ($version) *****\n";
if (! $conf->global->LDAP_CONTACT_ACTIVE)
{
print $langs->trans("LDAPSynchronizationNotSetupInDolibarr");
exit 1;
exit 1;
}
*/
@ -74,7 +72,7 @@ if ($resql)
$ldap=new Ldap();
$ldap->connect_bind();
while ($i < $num)
{
$ldap->error="";
@ -84,12 +82,12 @@ if ($resql)
$contact = new Contact($db);
$contact->id = $obj->rowid;
$contact->fetch($contact->id);
print $langs->trans("UpdateContact")." rowid=".$contact->id." ".$contact->getFullName($langs);
$info=$contact->_load_ldap_info();
$dn=$contact->_load_ldap_dn($info);
$result=$ldap->update($dn,$info,$user);
if ($result > 0)
{