From c1cf7381bd996a41f1cd3f89d61da57b42c003b0 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Mon, 26 Apr 2021 10:16:40 -0400 Subject: [PATCH] 2021-04-26 Fred Gleason * Fixed a bug in 'RDCartFilter' that caused a SQL error when no groups were included in the search terms. Signed-off-by: Fred Gleason --- ChangeLog | 3 +++ lib/rdcartfilter.cpp | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 24f810b1..1f7d0194 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21604,3 +21604,6 @@ errors. * Fixed typo in 'lib/rdlogmodel.cpp' that caused SQL errors. +2021-04-26 Fred Gleason + * Fixed a bug in 'RDCartFilter' that caused a SQL error when + no groups were included in the search terms. diff --git a/lib/rdcartfilter.cpp b/lib/rdcartfilter.cpp index d20a7055..f386e9a0 100644 --- a/lib/rdcartfilter.cpp +++ b/lib/rdcartfilter.cpp @@ -234,7 +234,12 @@ QString RDCartFilter::filterSql(const QStringList &and_fields) const sql+=RDCartFilter::phraseFilter(d_filter_edit->text().trimmed(),true); QStringList groups; for(int i=0;icount();i++) { - groups.push_back(d_group_box->itemText(i)); + if(d_group_box->itemText(i)!=tr("ALL")) { + groups.push_back(d_group_box->itemText(i)); + } + } + if(groups.size()==0) { // No groups selected, so force an empty selection + return QString(" where `CART`.`NUMBER`<0"); // An impossibility } sql+=RDCartFilter::groupFilter(d_group_box->currentText(),groups); if(d_show_track_carts) { @@ -340,6 +345,7 @@ QString RDCartFilter::service() const void RDCartFilter::setService(const QString &svc) { + if(svc!=d_service) { d_service=svc; if(!d_service.isEmpty()) { @@ -427,6 +433,7 @@ void RDCartFilter::setMatchCount(int matches) void RDCartFilter::searchClickedData() { + d_search_button->setDisabled(true); if(d_filter_edit->text().isEmpty()) { d_clear_button->setDisabled(true);