From 30238e52cd38034104c45a9af856873bde87407b Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 15 Nov 2023 15:25:53 -0700 Subject: [PATCH] Et2SelectEmail: Fix incorrect total result, wrongly shown "No results" --- .../Et2Select/Select/Et2SelectEmail.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/Et2Select/Select/Et2SelectEmail.ts b/api/js/etemplate/Et2Select/Select/Et2SelectEmail.ts index 25ae6edabc..628aecd0b4 100644 --- a/api/js/etemplate/Et2Select/Select/Et2SelectEmail.ts +++ b/api/js/etemplate/Et2Select/Select/Et2SelectEmail.ts @@ -207,9 +207,22 @@ export class Et2SelectEmail extends Et2Select */ protected remoteQuery(search : string, options : object) { - return this.egw().request(this.searchUrl, [search, {includeLists: this.includeLists}]).then((result) => + return this.egw().request(this.searchUrl, [search, {includeLists: this.includeLists}]).then((results) => { - this.processRemoteResults(result); + // If results have a total included, pull it out. + // It will cause errors if left in the results + if(typeof results.total !== "undefined") + { + this._total_result_count += results.total; + delete results.total; + // Make it an array, since it was probably an object, and cleanSelectOptions() treats objects differently + results = Object.values(results); + } + else + { + this._total_result_count += results.length; + } + this._total_result_count -= this.processRemoteResults(results); }); }