diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 89d172b48da..39a602eadc5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1,32 +1,32 @@ * Copyright (C) 2004 Eric Seigne -* Copyright (C) 2004-2011 Laurent Destailleur -* Copyright (C) 2005 Marc Barilley -* Copyright (C) 2005-2012 Regis Houssin -* Copyright (C) 2006 Andre Cianfarani -* Copyright (C) 2008 Raphael Bertrand -* Copyright (C) 2010-2011 Juanjo Menent -* Copyright (C) 2010-2011 Philippe Grand -* -* 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 -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2008 Raphael Bertrand + * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2011 Philippe Grand + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/comm/propal/class/propal.class.php -* \brief Fichier de la classe des propales -*/ + * \brief Fichier de la classe des propales + */ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/product/class/product.class.php"); @@ -1037,7 +1037,7 @@ class Propal extends CommonObject $this->cond_reglement = $obj->cond_reglement; $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; - $this->extraparams = (array) dol_json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 1c1f3467f68..0f80894cb2b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1293,7 +1293,7 @@ class Commande extends CommonObject $this->fk_delivery_address = $obj->fk_adresse_livraison; $this->propale_id = $obj->fk_source; - $this->extraparams = (array) dol_json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->lines = array(); diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 74840aa2188..8b24f22f2cd 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -232,7 +232,7 @@ class Deplacement extends CommonObject $this->note_public = $obj->note_public; $this->fk_project = $obj->fk_projet; - $this->extraparams = (array) dol_json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); return 1; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 044c39c6495..30ad1d0dff8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -828,7 +828,7 @@ class Facture extends CommonObject $this->user_valid = $obj->fk_user_valid; $this->modelpdf = $obj->model_pdf; - $this->extraparams = (array) dol_json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); if ($this->statut == 0) $this->brouillon = 1; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 40573e77a7f..7771520978d 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -355,7 +355,7 @@ class Contrat extends CommonObject $this->socid = $result["fk_soc"]; $this->fk_soc = $result["fk_soc"]; - $this->extraparams = (array) dol_json_decode($result["extraparams"], true); + $this->extraparams = (array) json_decode($result["extraparams"], true); $this->db->free($resql); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b243de184ab..679d380a40c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 455ded86c93..dbff136ff30 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -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.'/'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 08787c8b1bc..c0941ba7c48 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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++; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 93827c7107c..5814b271cbf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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). diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 5ba0935124f..5d60c70c4e6 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -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); } } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 650915aa654..4d43f0cd416 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -245,7 +245,7 @@ class Fichinter extends CommonObject $this->note_private = $obj->note_private; $this->modelpdf = $obj->model_pdf; - $this->extraparams = (array) dol_json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); if ($this->statut == 0) $this->brouillon = 1; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c9fe55b4a1a..bedafa87fdd 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -169,7 +169,7 @@ class CommandeFournisseur extends Commande $this->note_public = $obj->note_public; $this->modelpdf = $obj->model_pdf; - $this->extraparams = (array) dol_json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->db->free($resql); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 0edafd896f7..e6941ab7a33 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -346,7 +346,7 @@ class FactureFournisseur extends Facture $this->model_pdf = $obj->model_pdf; $this->import_key = $obj->import_key; - $this->extraparams = (array) dol_json_decode($obj->extraparams, true); + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->socid = $obj->socid; $this->socnom = $obj->socnom;