From 292866cfae8ddaa56153c6680f1b91d7713dd0b8 Mon Sep 17 00:00:00 2001 From: Dale Scott Date: Mon, 6 Jul 2026 16:03:10 -0600 Subject: [PATCH 1/3] begin debugging dashboard on WSL Ubuntu --- .github/copilot_instructions.md | 14 ++++++++++++++ DashboardConfig.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .github/copilot_instructions.md diff --git a/.github/copilot_instructions.md b/.github/copilot_instructions.md new file mode 100644 index 000000000..0a82c3d81 --- /dev/null +++ b/.github/copilot_instructions.md @@ -0,0 +1,14 @@ +# webERP Coding Standards + +This repository is webERP. + +Requirements: + +- PHP compatibility consistent with webERP standards. +- Avoid modern framework assumptions. +- Use procedural PHP where appropriate. +- Preserve existing coding style. +- Use mysqli functions already used by the project. +- Maintain backwards compatibility. +- Generate SQL compatible with MariaDB/MySQL. +- Keep changes small and reviewable. diff --git a/DashboardConfig.php b/DashboardConfig.php index ad3cc3439..1bc2d90e4 100644 --- a/DashboardConfig.php +++ b/DashboardConfig.php @@ -71,7 +71,7 @@ if (DB_error_no() == 0) { prnMsg(__('The script was successfully inserted'), 'success'); } else { - prnMsg(__('There was a peoblem inserting the script'), 'error'); + prnMsg(__('There was a problem inserting the script'), 'error'); } } From edf42756738c4dc60061eba21ae02f7846ad8a39 Mon Sep 17 00:00:00 2001 From: Dale Scott Date: Mon, 6 Jul 2026 16:41:29 -0600 Subject: [PATCH 2/3] define before use --- DashboardConfig.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DashboardConfig.php b/DashboardConfig.php index 1bc2d90e4..9b5baaa73 100644 --- a/DashboardConfig.php +++ b/DashboardConfig.php @@ -23,7 +23,7 @@ if (DB_error_no() == 0) { prnMsg(__('The script was successfully removed'), 'success'); } else { - prnMsg(__('There was a peoblem removing the script'), 'error'); + prnMsg(__('There was a problem removing the script'), 'error'); } } @@ -43,7 +43,7 @@ if (DB_error_no() == 0) { prnMsg(__('The script was successfully updated'), 'success'); } else { - prnMsg(__('There was a peoblem updating the script'), 'error'); + prnMsg(__('There was a problem updating the script'), 'error'); } } @@ -157,6 +157,7 @@ $Scripts = glob('dashboard/*.php'); foreach ($Scripts as $ScriptName) { $ScriptName = basename($ScriptName); + $ScriptArray = array(); // per PHP 8.4, must be defined before use if ($ScriptName != 'template.php' and !in_array($ScriptName, $ScriptArray)) { if ($_POST['Script'] == $ScriptName) { echo ''; From 6e2aaa707be80d9a4364e6dba4745819e013aea2 Mon Sep 17 00:00:00 2001 From: Dale Scott Date: Mon, 6 Jul 2026 17:07:21 -0600 Subject: [PATCH 3/3] correct 2nd insert causing SQL duplicate key error --- DashboardConfig.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/DashboardConfig.php b/DashboardConfig.php index 9b5baaa73..8cc70018f 100644 --- a/DashboardConfig.php +++ b/DashboardConfig.php @@ -36,9 +36,17 @@ description='" . $_POST['Description'] . "' WHERE id='" . $_POST['ID'] . "'"; $Result = DB_query($SQL); - $SQL = "UPDATE scripts SET pagesecurity='" . $_POST['PageSecurity'] . "', - description='" . $_POST['Description'] . "' - WHERE script='" . $MyRow['scripts'] . "'"; + $SQL = "INSERT INTO scripts (script, + pagesecurity, + description + ) VALUES ( + '" . $MyRow['scripts'] . "', + '" . $_POST['PageSecurity'] . "', + '" . $_POST['Description'] . "' + ) + ON DUPLICATE KEY UPDATE + pagesecurity = VALUES(pagesecurity), + description = VALUES(description)"; $Result = DB_query($SQL); if (DB_error_no() == 0) { prnMsg(__('The script was successfully updated'), 'success'); @@ -62,11 +70,14 @@ $SQL = "INSERT INTO scripts (script, pagesecurity, description - ) VALUES ( - '" . $_POST['Script'] . "', - '" . $_POST['PageSecurity'] . "', - '" . $_POST['Description'] . "' - )"; + ) VALUES ( + '" . $_POST['Script'] . "', + '" . $_POST['PageSecurity'] . "', + '" . $_POST['Description'] . "' + ) + ON DUPLICATE KEY UPDATE + pagesecurity = VALUES(pagesecurity), + description = VALUES(description)"; $Result = DB_query($SQL); if (DB_error_no() == 0) { prnMsg(__('The script was successfully inserted'), 'success'); @@ -155,9 +166,11 @@