Selaa lähdekoodia

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

Marcos García de La Fuente 11 vuotta sitten
vanhempi
commit
1c97b3f779

+ 1 - 1
htdocs/compta/ajaxpayment.php

@@ -114,4 +114,4 @@ $toJsonArray['result'] = price($result);		// Return value to user format
 $toJsonArray['resultnum'] = price2num($result);	// Return value to numeric format
 
 // Encode to JSON to return
-echo dol_json_encode($toJsonArray);	// Printing the call's result
+echo json_encode($toJsonArray);	// Printing the call's result

+ 1 - 1
htdocs/core/boxes/box_graph_invoices_permonth.php

@@ -104,7 +104,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
 			}
 			else
 			{
-				$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
+				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
 				$endyear=$tmparray['year'];
 				$shownb=$tmparray['shownb'];
 				$showtot=$tmparray['showtot'];

+ 1 - 1
htdocs/core/boxes/box_graph_invoices_supplier_permonth.php

@@ -103,7 +103,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
 			}
 			else
 			{
-				$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
+				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
 				$endyear=$tmparray['year'];
 				$shownb=$tmparray['shownb'];
 				$showtot=$tmparray['showtot'];

+ 1 - 1
htdocs/core/boxes/box_graph_orders_permonth.php

@@ -104,7 +104,7 @@ class box_graph_orders_permonth extends ModeleBoxes
 			}
 			else
 			{
-				$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
+				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
 				$endyear=$tmparray['year'];
 				$shownb=$tmparray['shownb'];
 				$showtot=$tmparray['showtot'];

+ 1 - 1
htdocs/core/boxes/box_graph_orders_supplier_permonth.php

@@ -103,7 +103,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
 			}
 			else
 			{
-				$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
+				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
 				$endyear=$tmparray['year'];
 				$shownb=$tmparray['shownb'];
 				$showtot=$tmparray['showtot'];

+ 1 - 1
htdocs/core/boxes/box_graph_product_distribution.php

@@ -96,7 +96,7 @@ class box_graph_product_distribution extends ModeleBoxes
 		}
 		else
 		{
-			$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
+			$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
 			$year=$tmparray['year'];
 			$showinvoicenb=$tmparray['showinvoicenb'];
 			$showpropalnb=$tmparray['showpropalnb'];

+ 1 - 1
htdocs/core/boxes/box_graph_propales_permonth.php

@@ -104,7 +104,7 @@ class box_graph_propales_permonth extends ModeleBoxes
 			}
 			else
 			{
-				$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
+				$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
 				$endyear=$tmparray['year'];
 				$shownb=$tmparray['shownb'];
 				$showtot=$tmparray['showtot'];

+ 6 - 6
htdocs/core/class/stats.class.php

@@ -81,7 +81,7 @@ abstract class Stats
 		if ($foundintocache)    // Cache file found and is not too old
 		{
 			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
 		{
@@ -112,7 +112,7 @@ abstract class Stats
 			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);
 			$fp = fopen($newpathofdestfile, 'w');
-			fwrite($fp, dol_json_encode($data));
+			fwrite($fp, json_encode($data));
 			fclose($fp);
 			if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
 			@chmod($newpathofdestfile, octdec($newmask));
@@ -172,7 +172,7 @@ abstract class Stats
         if ($foundintocache)    // Cache file found and is not too old
         {
         	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
 		{
@@ -203,7 +203,7 @@ abstract class Stats
 			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);
 			$fp = fopen($newpathofdestfile, 'w');
-			fwrite($fp, dol_json_encode($data));
+			fwrite($fp, json_encode($data));
 			fclose($fp);
 			if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
 			@chmod($newpathofdestfile, octdec($newmask));
@@ -295,7 +295,7 @@ abstract class Stats
         if ($foundintocache)    // Cache file found and is not too old
         {
         	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
 		{
@@ -309,7 +309,7 @@ abstract class Stats
 			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);
 			$fp = fopen($newpathofdestfile, 'w');
-			fwrite($fp, dol_json_encode($data));
+			fwrite($fp, json_encode($data));
 			fclose($fp);
 			if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
 			@chmod($newpathofdestfile, octdec($newmask));

+ 1 - 1
htdocs/main.inc.php

@@ -176,7 +176,7 @@ if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
 		if (! empty($_POST[$postkey])) $cookiearrayvalue[$tmpkey]=$_POST[$postkey];
 	}
 	$cookiename=$tmpautoset[0];
-	$cookievalue=dol_json_encode($cookiearrayvalue);
+	$cookievalue=json_encode($cookiearrayvalue);
 	//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
 	setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/');	// keep cookie 1 year
 	if (empty($cookievalue)) unset($_COOKIE[$cookiename]);

+ 3 - 3
htdocs/product/stock/massstockmove.php

@@ -64,7 +64,7 @@ $limit = $conf->liste_limit;
 $offset = $limit * $page ;
 
 $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;
 		else $id=1;
 		$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_sw);
@@ -117,7 +117,7 @@ if ($action == 'addline')
 if ($action == 'delline' && $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']);
 }