2022-12-30 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in rdadmin(1) that made it impossible to set the
	name of newly created host variables.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-12-30 16:37:54 -05:00
parent 3848c9c064
commit 436ac4cb4e
2 changed files with 23 additions and 3 deletions

View File

@ -23890,3 +23890,6 @@
* Added a 'wmctrl' dependency to the 'rivendell' RPM package.
2022-12-30 Fred Gleason <fredg@paravelsystems.com>
* Added a 'wmctrl' dependency to the 'rivendell' DEB package.
2022-12-30 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdadmin(1) that made it impossible to set the
name of newly created host variables.

View File

@ -2,7 +2,7 @@
//
// Edit a Rivendell Host Variable
//
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2022 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
@ -18,6 +18,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <QMessageBox>
#include <QPushButton>
#include <rdescape_string.h>
@ -42,7 +43,6 @@ EditHostvar::EditHostvar(QWidget *parent)
//
edit_name_edit=new QLineEdit(this);
edit_name_edit->setGeometry(125,11,120,19);
edit_name_edit->setReadOnly(true);
QLabel *label=new QLabel(tr("Variable Name:"),this);
label->setGeometry(10,11,110,19);
label->setFont(labelFont());
@ -133,7 +133,24 @@ int EditHostvar::exec(int id)
void EditHostvar::okData()
{
QString sql=QString("update `HOSTVARS` set ")+
QString sql;
RDSqlQuery *q=NULL;
sql=QString("select ")+
"`ID` "+ // 00
"from `HOSTVARS` where "+
"`STATION_NAME`='"+RDEscapeString(rda->station()->name())+"' && "+
"`NAME`='"+RDEscapeString(edit_name_edit->text())+"' && "+
QString::asprintf("`ID`!=%d",edit_id);
q=new RDSqlQuery(sql);
if(q->first()) {
QMessageBox::warning(this,"RDAdmin - "+tr("Error"),
tr("The variable name is already in use!"));
delete q;
return;
}
sql=QString("update `HOSTVARS` set ")+
"`NAME`='"+RDEscapeString(edit_name_edit->text())+"',"+
"`VARVALUE`='"+RDEscapeString(edit_varvalue_edit->text())+"',"+
"`REMARK`='"+RDEscapeString(edit_remark_edit->text())+"' "+