Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2012-03-18 23:45:58 +01:00
13 changed files with 40 additions and 72 deletions

View File

@@ -2142,7 +2142,7 @@ abstract class CommonObject
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' SET extraparams = "'.$this->db->escape(dol_json_encode($this->extraparams)).'"';
$sql.= ' SET extraparams = "'.$this->db->escape(json_encode($this->extraparams)).'"';
$sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG);
@@ -2416,7 +2416,7 @@ abstract class CommonObject
}
else
{
$this->_printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$hookmanager);
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$hookmanager);
}
$i++;
@@ -2443,7 +2443,7 @@ abstract class CommonObject
* @param HookManager $hookmanager Hook manager
* @return void
*/
private function _printObjectLine($action,$line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer,$selected=0,$hookmanager=false)
function printObjectLine($action,$line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer,$selected=0,$hookmanager=false)
{
global $conf,$langs,$user;
global $form,$bc,$bcdd;
@@ -2567,7 +2567,7 @@ abstract class CommonObject
}
else
{
$this->_printOriginLine($line,$var);
$this->printOriginLine($line,$var);
}
$i++;
@@ -2584,7 +2584,7 @@ abstract class CommonObject
* @param string $var Var
* @return void
*/
private function _printOriginLine($line,$var)
function printOriginLine($line,$var)
{
global $langs,$bc;

View File

@@ -165,7 +165,7 @@ class Conf
$varname = $partname.'_modules'; // TODO deprecated
if (! isset($this->$varname) || ! is_array($this->$varname)) { $this->$varname = array(); } // TODO deprecated
if (! isset($this->modules_parts[$partname]) || ! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); }
$arrValue = dol_json_decode($value,true);
$arrValue = json_decode($value,true);
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
else if (in_array($partname,array('login','menus','substitutions','triggers'))) $value = '/'.$modulename.'/core/'.$partname.'/';
else if (in_array($partname,array('models'))) $value = '/'.$modulename.'/';

View File

@@ -2791,7 +2791,7 @@ class Form
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
$this->cache_currencies[$obj->code_iso]['unicode'] = (array) dol_json_decode($obj->unicode, true);
$this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode($obj->unicode, true);
$label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label'];
$i++;
}

View File

@@ -145,38 +145,6 @@ if (! function_exists('json_decode'))
}
}
/**
* Function that encodes data in json format.
* TODO Remove this function because the json_encode is already redesigned by dolibarr function and
* this functions was designed for compatibility between an instable 3.2 version with final 3.2 version. We must
* manage compatibility only between 2 stable versions.
*
* @param mixed $elements PHP object to json encode
* @return string Json encoded string
*/
function dol_json_encode($elements)
{
return json_encode($elements); // This function is redesigned into functions.lib.php
}
/**
* Function that decodes data from json format
* TODO Remove this function because the json_encode is already redesigned by dolibarr function and
* this functions was designed for compatibility between an instable 3.2 version with final 3.2 version. We must
* manage compatibility only between 2 stable versions.
*
* @param string $json Json encoded to PHP Object or Array
* @param bool $assoc False return an object, true return an array
* @return mixed Object or Array
*/
function dol_json_decode($json, $assoc=false)
{
$out='';
$out = @unserialize($json); // For compatibility, test if serialized
if (empty($out)) $out = json_decode($json, $assoc); // This function is redesigned into functions.lib.php
return $out;
}
/**
* Function to return value of a static property when class
* name is dynamically defined (not hard coded).

View File

@@ -1308,12 +1308,12 @@ abstract class DolibarrModules
// Can defined other parameters
if (is_array($value['data']) && ! empty($value['data']))
{
$newvalue = dol_json_encode($value['data']);
$newvalue = json_encode($value['data']);
if (isset($value['entity'])) $entity = $value['entity'];
}
else
{
$newvalue = dol_json_encode($value);
$newvalue = json_encode($value);
}
}