mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-12 15:45:59 +01:00
2017-04-17 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'lib/rdcart.cpp' that caused the 'Import' web API call to return 404 when importing with 'CREATE' set to '1' and unique titles enabled in the database.
This commit is contained in:
@@ -1274,7 +1274,7 @@ bool RDCart::create(const QString &groupname,RDCart::Type type)
|
||||
cart_number,type,
|
||||
(const char *)RDEscapeString(groupname),
|
||||
(const char *)
|
||||
RDEscapeString(RD_DEFAULT_CART_TITLE));
|
||||
RDEscapeString(RDCart::uniqueCartTitle(cart_number)));
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
bool ret=q->isActive();
|
||||
delete q;
|
||||
@@ -1985,6 +1985,32 @@ unsigned RDCart::readXml(std::vector<RDWaveData> *data,const QString &xml)
|
||||
}
|
||||
|
||||
|
||||
QString RDCart::uniqueCartTitle(unsigned cartnum)
|
||||
{
|
||||
QString basename=QObject::tr("new cart");
|
||||
QString title;
|
||||
QString sql;
|
||||
RDSqlQuery *q=NULL;
|
||||
int count=0;
|
||||
|
||||
if(cartnum!=0) {
|
||||
basename=QObject::tr("cart")+QString().sprintf(" %06u",cartnum);
|
||||
}
|
||||
do {
|
||||
title="["+basename+QString().sprintf("-%d",count+1)+"]";
|
||||
sql=QString("select NUMBER from CART where ")+
|
||||
"TITLE=\""+RDEscapeString(title)+"\"";
|
||||
count++;
|
||||
if(q!=NULL) {
|
||||
delete q;
|
||||
}
|
||||
q=new RDSqlQuery(sql);
|
||||
} while(q->first());
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
QVariant RDCart::GetXmlValue(const QString &tag,const QString &line)
|
||||
{
|
||||
bool ok=false;
|
||||
|
||||
Reference in New Issue
Block a user