]> _ Git - sandvik-apps.git/commitdiff
wip #5225 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 11 Aug 2022 12:33:40 +0000 (14:33 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 11 Aug 2022 12:33:40 +0000 (14:33 +0200)
CrushingChamber/_doc/data.xlsx
CrushingChamber/js/script.js
CrushingChamber/tools/common.php
CrushingChamber/tools/refreshdata.php

index b08a7f50a4348c76e00d25776dc85185d9ca2a9e..a2ea7fc4d13486cd939152576fba42d8a9640af9 100644 (file)
Binary files a/CrushingChamber/_doc/data.xlsx and b/CrushingChamber/_doc/data.xlsx differ
index bd45d7ff19e63415b5c8b7fdbfed6771145bdce8..a576979e1300db737873958fd61f52c8eb817a5e 100644 (file)
@@ -117,8 +117,8 @@ function createDynamicFields() {
 
     if (window.abbr_cj === undefined) {
         window.abbr_cj = {};
-        for (var j = 7; j <= 14; j++) {
-            var c = DATA['CJ'][0][j];
+        for (var j = 7; j <= 13; j++) {
+            var c = DATA['CJ'][0][j] == null ? '' : DATA['CJ'][0][j];
             var v = /\(([^\)]*)\)/.exec(c)[1];
             window.abbr_cj[j] = v;
         }
index 88752051e615f1cfbc91a5d11bcaf5490d45e134..78bf41f221abc0a3ead8e9a1c30454fccd82e96a 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-function postFiles($url, $file, $var = 'file')
+function postFiles($url, $file, $var = 'file',$data=[])
 {
     $boundary = '--------------------------' . microtime(true);
     $header = 'Content-Type: multipart/form-data; boundary=' . $boundary;
@@ -7,6 +7,11 @@ function postFiles($url, $file, $var = 'file')
         'Content-Disposition: form-data; name="' . $var . '"; filename="' . basename($file) . "\"\r\n" .
         "Content-Type: application/octet-stream\r\n\r\n" .
         file_get_contents($file) . "\r\n";
+    foreach ($data as $k=>$v){
+        $content .= "--".$boundary."\r\n".
+            "Content-Disposition: form-data; name=\"$k\"\r\n\r\n".
+            "$v\r\n";
+    }
     $content .= '--' . $boundary . "--\r\n";
     $context = stream_context_create(array(
         'http' => array(
index 0c00fa5e54d9c50e2a92c821f6901ab80cecfa71..1a21fad10a269437513090bfc2de869892eae888 100644 (file)
@@ -3,6 +3,7 @@ require_once 'common.php';
 $root = __DIR__ . '/../';
 $js = $root . 'js/data.js';
 $xlsx = $root . '/_doc/data.xlsx';
-$data = postFiles('https://extranet.cubedesigners.com/tools/convertXlsxToJson', $xlsx, 'file');
-file_put_contents($js, 'DATA=' . $data . ';');
+$data = postFiles('https://extranet.cubedesigners.com/tools/convertXlsxToJson', $xlsx, 'file', ['dataorg' => 'excelToArray', 'format' => 'js']);
+$data = str_replace('"SUISSE"', '"CH"',$data);
+file_put_contents($js, $data);
 header('Location: ../');
\ No newline at end of file