Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git …
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
eldy committed Mar 18, 2012
2 parents fe9b244 + 3afb287 commit e4a5b6e
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 72 deletions.
48 changes: 24 additions & 24 deletions htdocs/comm/propal/class/propal.class.php
@@ -1,32 +1,32 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/

/**
* \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");
Expand Down Expand Up @@ -1037,7 +1037,7 @@ function fetch($rowid,$ref='')
$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;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/commande/class/commande.class.php
Expand Up @@ -1293,7 +1293,7 @@ function fetch($id, $ref='', $ref_ext='', $ref_int='')
$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();

Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/deplacement/class/deplacement.class.php
Expand Up @@ -232,7 +232,7 @@ function fetch($id)
$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;
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/facture/class/facture.class.php
Expand Up @@ -828,7 +828,7 @@ function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
$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;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/contrat/class/contrat.class.php
Expand Up @@ -355,7 +355,7 @@ function fetch($id,$ref='')
$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);

Expand Down
10 changes: 5 additions & 5 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -2142,7 +2142,7 @@ function setExtraParameters()
$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);
Expand Down Expand Up @@ -2416,7 +2416,7 @@ function printObjectLines($action,$seller,$buyer,$selected=0,$dateSelector=0,$ho
}
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++;
Expand All @@ -2443,7 +2443,7 @@ function printObjectLines($action,$seller,$buyer,$selected=0,$dateSelector=0,$ho
* @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;
Expand Down Expand Up @@ -2567,7 +2567,7 @@ function printOriginLinesList($hookmanager=false)
}
else
{
$this->_printOriginLine($line,$var);
$this->printOriginLine($line,$var);
}

$i++;
Expand All @@ -2584,7 +2584,7 @@ function printOriginLinesList($hookmanager=false)
* @param string $var Var
* @return void
*/
private function _printOriginLine($line,$var)
function printOriginLine($line,$var)
{
global $langs,$bc;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/conf.class.php
Expand Up @@ -165,7 +165,7 @@ function setValues($db)
$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.'/';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.form.class.php
Expand Up @@ -2791,7 +2791,7 @@ function load_cache_currencies()

// 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++;
}
Expand Down
32 changes: 0 additions & 32 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -145,38 +145,6 @@ function json_decode($json, $assoc=false)
}
}

/**
* 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).
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/DolibarrModules.class.php
Expand Up @@ -1308,12 +1308,12 @@ function insert_module_parts()
// 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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/fichinter/class/fichinter.class.php
Expand Up @@ -245,7 +245,7 @@ function fetch($rowid,$ref='')
$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;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/class/fournisseur.commande.class.php
Expand Up @@ -169,7 +169,7 @@ function fetch($id,$ref='')
$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);

Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/class/fournisseur.facture.class.php
Expand Up @@ -346,7 +346,7 @@ function fetch($id='',$ref='')
$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;
Expand Down

0 comments on commit e4a5b6e

Please sign in to comment.