From f49ab5fd528e00d1127035f1ca74cfb227258f5d Mon Sep 17 00:00:00 2001 From: Igor I Date: Mon, 27 Nov 2023 13:47:06 +0600 Subject: [PATCH] =?UTF-8?q?+=D0=A4=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=20p?= =?UTF-8?q?ostJsonData?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- metadata/dbms/records.php | 20 ++++++++++++----- metadata/dbms/showrecord.js | 2 +- metadata/dbms/tools.js | 45 ++++++++++++++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/metadata/dbms/records.php b/metadata/dbms/records.php index 4923b1a..8bdae86 100644 --- a/metadata/dbms/records.php +++ b/metadata/dbms/records.php @@ -534,7 +534,11 @@ try { $res = $stmt->execute(); } catch (Exception $e) - { sendError(1,$e->getMessage()."\n".$sql_query); + { + if(str_contains($e->getMessage(), ']]')) //If already sending short error text. + sendError(1, $e->getMessage()); + else + sendError(1, '[['.trt("SQL_query_error").']]'.$e->getMessage()."\n".$sql_query); } $result = $stmt->fetch(PDO::FETCH_NUM); //$obj_id if($result[0]==''){ $result[0]=$obj_id; } @@ -569,7 +573,11 @@ try { $res = $db->query($sql_query); }catch (Exception $e) - { sendError(1,$e->getMessage()); + { + if(str_contains($e->getMessage(), ']]')) //If already sending short error text. + sendError(1, $e->getMessage()); + else + sendError(1, '[['.trt("SQL_query_error").']]'.$e->getMessage()."\n".$sql_query); } //записываем id удалённой записи для удаления без перезагрузки страницы через javascript $xmlstring=""; @@ -1290,9 +1298,7 @@ if ($code!=$_POST['code']) return new AuthError('invalid code'); $file='file_'.$num.'.xls'; $myFile = $dir.$file; - $fh = fopen($myFile, 'w'); - if($fh) - { + if(($fh = @fopen($myFile, 'w')) !== FALSE){ fwrite($fh, ''."\n"); fwrite($fh, ' '."\n"); fwrite($fh, ' '.$currNode->getAttribute("d").''."\n"); @@ -1345,7 +1351,9 @@ if ($code!=$_POST['code']) return new AuthError('invalid code'); fwrite($fh, ''."\n"); fclose($fh); - } + }else{ + sendError(1,trt('Failed_to_generate_report')); + } /*if($ext=="pdf") { diff --git a/metadata/dbms/showrecord.js b/metadata/dbms/showrecord.js index d7e8ae7..e87d4d0 100644 --- a/metadata/dbms/showrecord.js +++ b/metadata/dbms/showrecord.js @@ -1472,7 +1472,7 @@ class SRec { if(nodeCol.nodeName=="column") { - if(nodeCol.getAttribute("n")==col){ + if(nodeCol.getAttribute("n")==name){ break; } i++; diff --git a/metadata/dbms/tools.js b/metadata/dbms/tools.js index 4e41163..e237003 100644 --- a/metadata/dbms/tools.js +++ b/metadata/dbms/tools.js @@ -20,6 +20,18 @@ function trt(key) else return val; } +function deleteOption(sel,id){ + if(typeof sel == 'string') sel=document.getElementById(sel); + let i=0; + while (i