2022-03-04 Fred Gleason <fredg@paravelsystems.com>

* Modified the 'RDCart::setSchedCodesList()' so as to normalize
	the case of scheduler codes.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-03-04 15:55:54 -05:00
parent 5afcd7e7af
commit 9123bf420a
2 changed files with 18 additions and 0 deletions

View File

@ -20853,3 +20853,6 @@
* Fixed a bug in rdimport(1) that could create duplicate
Scheduler Code entries when using the '--to-cart' and
'--add-scheduler-code' switches simultaneously.
2022-03-04 Fred Gleason <fredg@paravelsystems.com>
* Modified the 'RDCart::setSchedCodesList()' so as to normalize
the case of scheduler codes.

View File

@ -309,12 +309,27 @@ QStringList RDCart::schedCodesList() const
void RDCart::setSchedCodesList(QStringList codes) const
{
QString sql;
RDSqlQuery *q=NULL;
QString sched_codes="";
sql=QString().sprintf("delete from CART_SCHED_CODES where CART_NUMBER=%u",cart_number);
RDSqlQuery::apply(sql);
//
// Normalize Codes
//
sql=QString("select `CODE` from `SCHED_CODES`");
q=new RDSqlQuery(sql);
while(q->next()) {
for(int i=0;i<codes.size();i++) {
if(codes.at(i).toLower()==q->value(0).toString().toLower()) {
codes[i]=q->value(0).toString();
}
}
}
delete q;
codes.removeDuplicates();
for(int i=0;i<codes.size();i++) {
sql=QString().sprintf("insert into CART_SCHED_CODES set CART_NUMBER=%u,SCHED_CODE='%s'",cart_number,(const char *)codes.at(i));
RDSqlQuery::apply(sql);