Replaced usage of dol_json_encode and dol_json_decode with json_encode and json_decode. If json module is not installed, it will refer to dol_json_encode/decode
This commit is contained in:
parent
972d3c69b6
commit
1c97b3f779
@ -114,4 +114,4 @@ $toJsonArray['result'] = price($result); // Return value to user format
|
|||||||
$toJsonArray['resultnum'] = price2num($result); // Return value to numeric format
|
$toJsonArray['resultnum'] = price2num($result); // Return value to numeric format
|
||||||
|
|
||||||
// Encode to JSON to return
|
// Encode to JSON to return
|
||||||
echo dol_json_encode($toJsonArray); // Printing the call's result
|
echo json_encode($toJsonArray); // Printing the call's result
|
||||||
|
|||||||
@ -104,7 +104,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||||
$endyear=$tmparray['year'];
|
$endyear=$tmparray['year'];
|
||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||||
$endyear=$tmparray['year'];
|
$endyear=$tmparray['year'];
|
||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
|
|||||||
@ -104,7 +104,7 @@ class box_graph_orders_permonth extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||||
$endyear=$tmparray['year'];
|
$endyear=$tmparray['year'];
|
||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||||
$endyear=$tmparray['year'];
|
$endyear=$tmparray['year'];
|
||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
|
|||||||
@ -96,7 +96,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||||
$year=$tmparray['year'];
|
$year=$tmparray['year'];
|
||||||
$showinvoicenb=$tmparray['showinvoicenb'];
|
$showinvoicenb=$tmparray['showinvoicenb'];
|
||||||
$showpropalnb=$tmparray['showpropalnb'];
|
$showpropalnb=$tmparray['showpropalnb'];
|
||||||
|
|||||||
@ -104,7 +104,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
|
||||||
$endyear=$tmparray['year'];
|
$endyear=$tmparray['year'];
|
||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
|
|||||||
@ -81,7 +81,7 @@ abstract class Stats
|
|||||||
if ($foundintocache) // Cache file found and is not too old
|
if ($foundintocache) // Cache file found and is not too old
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate.".");
|
dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate.".");
|
||||||
$data = dol_json_decode(file_get_contents($newpathofdestfile), true);
|
$data = json_decode(file_get_contents($newpathofdestfile), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@ abstract class Stats
|
|||||||
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
||||||
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||||
$fp = fopen($newpathofdestfile, 'w');
|
$fp = fopen($newpathofdestfile, 'w');
|
||||||
fwrite($fp, dol_json_encode($data));
|
fwrite($fp, json_encode($data));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||||
@chmod($newpathofdestfile, octdec($newmask));
|
@chmod($newpathofdestfile, octdec($newmask));
|
||||||
@ -172,7 +172,7 @@ abstract class Stats
|
|||||||
if ($foundintocache) // Cache file found and is not too old
|
if ($foundintocache) // Cache file found and is not too old
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate.".");
|
dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate.".");
|
||||||
$data = dol_json_decode(file_get_contents($newpathofdestfile), true);
|
$data = json_decode(file_get_contents($newpathofdestfile), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -203,7 +203,7 @@ abstract class Stats
|
|||||||
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
||||||
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||||
$fp = fopen($newpathofdestfile, 'w');
|
$fp = fopen($newpathofdestfile, 'w');
|
||||||
fwrite($fp, dol_json_encode($data));
|
fwrite($fp, json_encode($data));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||||
@chmod($newpathofdestfile, octdec($newmask));
|
@chmod($newpathofdestfile, octdec($newmask));
|
||||||
@ -295,7 +295,7 @@ abstract class Stats
|
|||||||
if ($foundintocache) // Cache file found and is not too old
|
if ($foundintocache) // Cache file found and is not too old
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate.".");
|
dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate.".");
|
||||||
$data = dol_json_decode(file_get_contents($newpathofdestfile), true);
|
$data = json_decode(file_get_contents($newpathofdestfile), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -309,7 +309,7 @@ abstract class Stats
|
|||||||
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
||||||
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||||
$fp = fopen($newpathofdestfile, 'w');
|
$fp = fopen($newpathofdestfile, 'w');
|
||||||
fwrite($fp, dol_json_encode($data));
|
fwrite($fp, json_encode($data));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||||
@chmod($newpathofdestfile, octdec($newmask));
|
@chmod($newpathofdestfile, octdec($newmask));
|
||||||
|
|||||||
@ -176,7 +176,7 @@ if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
|
|||||||
if (! empty($_POST[$postkey])) $cookiearrayvalue[$tmpkey]=$_POST[$postkey];
|
if (! empty($_POST[$postkey])) $cookiearrayvalue[$tmpkey]=$_POST[$postkey];
|
||||||
}
|
}
|
||||||
$cookiename=$tmpautoset[0];
|
$cookiename=$tmpautoset[0];
|
||||||
$cookievalue=dol_json_encode($cookiearrayvalue);
|
$cookievalue=json_encode($cookiearrayvalue);
|
||||||
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
|
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
|
||||||
setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/'); // keep cookie 1 year
|
setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/'); // keep cookie 1 year
|
||||||
if (empty($cookievalue)) unset($_COOKIE[$cookiename]);
|
if (empty($cookievalue)) unset($_COOKIE[$cookiename]);
|
||||||
|
|||||||
@ -64,7 +64,7 @@ $limit = $conf->liste_limit;
|
|||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
$listofdata=array();
|
$listofdata=array();
|
||||||
if (! empty($_SESSION['massstockmove'])) $listofdata=dol_json_decode($_SESSION['massstockmove'],true);
|
if (! empty($_SESSION['massstockmove'])) $listofdata=json_decode($_SESSION['massstockmove'],true);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -105,7 +105,7 @@ if ($action == 'addline')
|
|||||||
if (count(array_keys($listofdata)) > 0) $id=max(array_keys($listofdata)) + 1;
|
if (count(array_keys($listofdata)) > 0) $id=max(array_keys($listofdata)) + 1;
|
||||||
else $id=1;
|
else $id=1;
|
||||||
$listofdata[$id]=array('id'=>$id, 'id_product'=>$id_product, 'qty'=>$qty, 'id_sw'=>$id_sw, 'id_tw'=>$id_tw);
|
$listofdata[$id]=array('id'=>$id, 'id_product'=>$id_product, 'qty'=>$qty, 'id_sw'=>$id_sw, 'id_tw'=>$id_tw);
|
||||||
$_SESSION['massstockmove']=dol_json_encode($listofdata);
|
$_SESSION['massstockmove']=json_encode($listofdata);
|
||||||
|
|
||||||
unset($id_product);
|
unset($id_product);
|
||||||
//unset($id_sw);
|
//unset($id_sw);
|
||||||
@ -117,7 +117,7 @@ if ($action == 'addline')
|
|||||||
if ($action == 'delline' && $idline != '')
|
if ($action == 'delline' && $idline != '')
|
||||||
{
|
{
|
||||||
if (! empty($listofdata[$idline])) unset($listofdata[$idline]);
|
if (! empty($listofdata[$idline])) unset($listofdata[$idline]);
|
||||||
if (count($listofdata) > 0) $_SESSION['massstockmove']=dol_json_encode($listofdata);
|
if (count($listofdata) > 0) $_SESSION['massstockmove']=json_encode($listofdata);
|
||||||
else unset($_SESSION['massstockmove']);
|
else unset($_SESSION['massstockmove']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user