Improve audit logging, error handling, and metadata encoding

- Ensure all email/SMS send attempts are audit-logged, including API errors, exceptions, invalid addresses, and disabled service cases; logs now include raw API responses or exception details for better diagnostics.
- Fix audit log parameter builder to never pass NULL for NOT NULL columns (`config`, `DateSent`).
- Add unit tests covering all send paths and audit log correctness.
- Percent-encode non-ASCII/control chars in `DocumentMetadataBuilder` for safe HTTP header metadata; add tests.
- Simplify admin test mail dialog JS and improve success handler robustness.
- Set `charset=utf-8` in admin controller JSON responses for OCORE consistency.
- Update minified JS to match new admin dialog logic.
This commit is contained in:
Stefan
2026-07-16 16:03:58 +02:00
parent 8a0ebeeb1e
commit c812d94d99
9 changed files with 238 additions and 47 deletions
+7 -12
View File
@@ -315,18 +315,13 @@ let $adm = {
button: $adt.testmail_btn,
size: [420, 560],
addcontent: $$.dc('adm_note').text($adt.tm_hint),
submit: function (e) {
let c = $(this).ldng(1);
let qs = c.serializeObject(true, { typedvalues: true });
$ocms.postXT({
url: $ocms.url('admin/testmail'), data: qs, timeout: 60000, success: function (r) {
let res = r.result || {};
alert(res.message || (res.sent ? $adt.tm_sent : $adt.tm_failed));
c.trigger('modal_close');
}, error: function () {
alert($adt.tm_failed);
}, complete: function () { c.ldng(0); }
});
url: $ocms.url('admin/testmail'),
typedvalues: true,
/* Runs inside jQuery's success dispatch — it must never throw, or postXT's
`complete` (which clears the page loading indicator) is skipped. */
success: function (r) {
let res = (r && r.result) || {};
alert(res.message || (res.sent === true ? $adt.tm_sent : $adt.tm_failed));
}
});
}