2024-04-25 Fred Gleason <fredg@paravelsystems.com>

* Fixed a regression in rdlibrary(1) that caused output of the Cart
	Report to not reflect the current filter and sorting state of the
	library list.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2024-04-25 17:22:05 -04:00
parent 8f82adbd7b
commit 43761e9508
6 changed files with 34 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
//
// List RDLibrary Reports
//
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2024 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -29,11 +29,13 @@
#include "list_reports.h"
ListReports::ListReports(const QString &filter,const QString &grpname,
const QString &filter_sql,QWidget *parent)
const QString &filter_sql,int cart_limit,
QWidget *parent)
{
list_filter=filter;
list_group=grpname;
list_filter_sql=filter_sql;
list_cart_limit=cart_limit;
setWindowTitle("RDLibrary - "+tr("Select Report"));
@@ -190,11 +192,13 @@ void ListReports::GenerateCartReport(QString *report)
"left join `CUTS` on `CART`.`NUMBER`=`CUTS`.`CART_NUMBER` ";
sql+=list_filter_sql;
unsigned prev_cartnum=0;
int cart_count=list_cart_limit;
q=new RDSqlQuery(sql);
while(q->next()) {
while(q->next()&&(cart_count>0)) {
if(q->value(1).toUInt()!=prev_cartnum) { // So we don't show duplicates
prev_cartnum=q->value(1).toUInt();
cart_count--;
//
// Cart Type
//

View File

@@ -2,7 +2,7 @@
//
// List and Generate RDLibrary Reports
//
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2024 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -32,7 +32,7 @@ class ListReports : public RDDialog
Q_OBJECT
public:
ListReports(const QString &filter,const QString &grpname,
const QString &filter_sql,QWidget *parent);
const QString &filter_sql,int cart_limit,QWidget *parent);
~ListReports();
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
@@ -54,8 +54,8 @@ class ListReports : public RDDialog
QString list_type_filter;
QString list_group;
QString list_schedcode;
QString list_filter_sql;
int list_cart_limit;
};

View File

@@ -2,7 +2,7 @@
//
// The Library Utility for Rivendell.
//
// (C) Copyright 2002-2023 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2024 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -584,7 +584,9 @@ void MainWidget::reportsData()
ListReports *lr=
new ListReports(lib_cart_filter->filterText(),
lib_cart_filter->selectedGroup(),
lib_cart_filter->filterSql(),this);
lib_cart_filter->filterSql()+" "+
lib_cart_model->orderBySql(),
lib_cart_model->cartLimit(),this);
lr->exec();
delete lr;