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;
}
<?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;
'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(
$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