Procházet zdrojové kódy

product handler and curl_route handling fixes

szollosil před 1 rokem
rodič
revize
d8be769bd7

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
+custom/bbus/csv/
 documents/
 conf/
 supervisord.log

+ 3 - 2
custom/bbus/class/api_curl.class.php

@@ -8,11 +8,12 @@ trait CurlApi
 	private function curlInit($route, $postFields = '', $request = 'POST')
 	{
 		global $conf;
-		ApiBbusLog::appLog("{$conf->global->CURL_ROUTE}{$route} => {$postFields}");
+		$curl_route = 'http://' . $conf->global->CURL_ROUTE . '/api/index.php/';
+		ApiBbusLog::appLog("{$curl_route}{$route} => {$postFields}");
 		$curl = curl_init();
 
 		curl_setopt_array($curl, array(
-			CURLOPT_URL => $conf->global->CURL_ROUTE . $route,
+			CURLOPT_URL => $curl_route . $route,
 			CURLOPT_RETURNTRANSFER => true,
 			CURLOPT_VERBOSE => true,
 			CURLOPT_SSL_VERIFYPEER => false,

+ 6 - 1
custom/bbus/product_handler.php

@@ -90,6 +90,10 @@ function productsCreator($table, $schema)
                         } elseif ($row_array[$fieldCounter] == "") {
                             $fieldsValues[] = '\'\'';
                         } else {
+                            if (!mb_check_encoding($row_array[$fieldCounter], 'UTF-8')) {
+                                $row_array[$fieldCounter] = iconv('ISO-8859-2', 'UTF-8', $row_array[$fieldCounter]);
+                            }
+                            //print $row_array[$fieldCounter] . '<br>';
                             $fieldsValues[] = '\'' . $row_array[$fieldCounter] . '\'';
                         }
                     } else {
@@ -135,7 +139,8 @@ function runQuery($sql, $table)
         if (!empty($sql_command)) {
             $resql = $db->query($sql_command);
             if (!$resql) {
-                echo $sql . '<br>';
+                //echo $sql . '<br>';
+                echo '<br>';
                 echo "Hiba történt: " . $db->lasterror() . '<br>';
                 echo $sql_command . '<br><br>';
             }