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..8cc70018f 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'); } } @@ -36,14 +36,22 @@ 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'); } else { - prnMsg(__('There was a peoblem updating the script'), 'error'); + prnMsg(__('There was a problem updating the script'), 'error'); } } @@ -62,16 +70,19 @@ $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'); } else { - prnMsg(__('There was a peoblem inserting the script'), 'error'); + prnMsg(__('There was a problem inserting the script'), 'error'); } } @@ -155,6 +166,9 @@