mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-25 23:00:21 +01:00
2017-06-19 Fred Gleason <fredg@paravelsystems.com>
* Added a 'SYSTEM.FIX_DUP_CART_TITLES' field to the database. * Incremented the database version to 264. * Added 'RDSystem::fixDuplicateCartTitles()' and 'RDSystem::setFixDuplicateCartTitles()' methods in 'lib/rdsystem.cpp' and 'lib/rdsystem.h'. * Added an 'Auto-Correct Duplicate Cart Titles' checkbox to the 'System Settings' dialog in 'rdadmin/edit_settings.cpp' and 'rdadmin/edit_settings.h'. * Modified the 'EditCart' web call to enforce the 'Auto-Correct Duplicate Cart Titles' setting.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
/*
|
||||
* Current Database Version
|
||||
*/
|
||||
#define RD_VERSION_DATABASE 263
|
||||
#define RD_VERSION_DATABASE 264
|
||||
|
||||
|
||||
#endif // DBVERSION_H
|
||||
|
||||
@@ -2011,6 +2011,20 @@ QString RDCart::uniqueCartTitle(unsigned cartnum)
|
||||
}
|
||||
|
||||
|
||||
bool RDCart::titleIsUnique(const QString &str)
|
||||
{
|
||||
bool ret=false;
|
||||
|
||||
QString sql=QString("select NUMBER from CART where ")+
|
||||
"TITLE=\""+RDEscapeString(str)+"\"";
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
ret=!q->first();
|
||||
delete q;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QVariant RDCart::GetXmlValue(const QString &tag,const QString &line)
|
||||
{
|
||||
bool ok=false;
|
||||
|
||||
@@ -167,6 +167,7 @@ class RDCart
|
||||
static void removePending(RDStation *station,RDUser *user,RDConfig *config);
|
||||
static unsigned readXml(std::vector<RDWaveData> *data,const QString &xml);
|
||||
static QString uniqueCartTitle(unsigned cartnum=0);
|
||||
static bool titleIsUnique(const QString &str);
|
||||
|
||||
private:
|
||||
static QVariant GetXmlValue(const QString &tag,const QString &line);
|
||||
|
||||
@@ -69,6 +69,34 @@ void RDSystem::setAllowDuplicateCartTitles(bool state) const
|
||||
}
|
||||
|
||||
|
||||
bool RDSystem::fixDuplicateCartTitles() const
|
||||
{
|
||||
bool ret=false;
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
sql="select FIX_DUP_CART_TITLES from SYSTEM";
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
ret=RDBool(q->value(0).toString());
|
||||
}
|
||||
delete q;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void RDSystem::setFixDuplicateCartTitles(bool state) const
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
sql=QString().sprintf("update SYSTEM set FIX_DUP_CART_TITLES=\"%s\"",
|
||||
(const char *)RDYesNo(state));
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDSystem::maxPostLength() const
|
||||
{
|
||||
unsigned ret;
|
||||
@@ -123,6 +151,7 @@ QString RDSystem::xml() const
|
||||
QString xml="<systemSettings>\n";
|
||||
xml+=RDXmlField("sampleRate",sampleRate());
|
||||
xml+=RDXmlField("duplicateTitles",allowDuplicateCartTitles());
|
||||
xml+=RDXmlField("fixDuplicateTitles",fixDuplicateCartTitles());
|
||||
xml+=RDXmlField("maxPostLength",maxPostLength());
|
||||
xml+=RDXmlField("isciXreferencePath",isciXreferencePath());
|
||||
xml+=RDXmlField("tempCartGroup",tempCartGroup());
|
||||
|
||||
@@ -31,6 +31,8 @@ class RDSystem
|
||||
void setSampleRate(unsigned rate) const;
|
||||
bool allowDuplicateCartTitles() const;
|
||||
void setAllowDuplicateCartTitles(bool state) const;
|
||||
bool fixDuplicateCartTitles() const;
|
||||
void setFixDuplicateCartTitles(bool state) const;
|
||||
unsigned maxPostLength() const;
|
||||
void setMaxPostLength(unsigned bytes) const;
|
||||
QString isciXreferencePath() const;
|
||||
|
||||
Reference in New Issue
Block a user