mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-29 16:50:13 +01:00
2018-02-15 Fred Gleason <fredg@paravelsystems.com>
* Added a 'SERVICES.LOG_SHELFLIFE_ORIGIN' field to the database. * Incremented the database version to 275. * Added a drop-down control to the 'Set Logs to auto-delete' control to allow origin to be specified in the 'Edit Service' dialog in rdadmin(1).
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
/*
|
||||
* Current Database Version
|
||||
*/
|
||||
#define RD_VERSION_DATABASE 274
|
||||
#define RD_VERSION_DATABASE 275
|
||||
|
||||
|
||||
#endif // DBVERSION_H
|
||||
|
||||
@@ -487,22 +487,26 @@ QString RDLog::xml() const
|
||||
|
||||
|
||||
bool RDLog::create(const QString &name,const QString &svc_name,
|
||||
const QString &user_name,QString *err_msg,RDConfig *config)
|
||||
const QDate &air_date,const QString &user_name,
|
||||
QString *err_msg,RDConfig *config)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
int shelflife=-1;
|
||||
RDSvc::ShelflifeOrigin shelforigin;
|
||||
QString desc_tmpl;
|
||||
|
||||
sql=QString("select ")+
|
||||
"DEFAULT_LOG_SHELFLIFE,"+ // 00
|
||||
"DESCRIPTION_TEMPLATE "+ // 01
|
||||
"LOG_SHELFLIFE_ORIGIN,"+ // 01
|
||||
"DESCRIPTION_TEMPLATE "+ // 02
|
||||
"from SERVICES where "+
|
||||
"NAME=\""+RDEscapeString(svc_name)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
shelflife=q->value(0).toInt();
|
||||
desc_tmpl=q->value(1).toString();
|
||||
shelforigin=(RDSvc::ShelflifeOrigin)q->value(1).toInt();
|
||||
desc_tmpl=q->value(2).toString();
|
||||
}
|
||||
else {
|
||||
*err_msg=QObject::tr("No such service!");
|
||||
@@ -519,8 +523,19 @@ bool RDLog::create(const QString &name,const QString &svc_name,
|
||||
"LINK_DATETIME=now(),"+
|
||||
"SERVICE=\""+RDEscapeString(svc_name)+"\"";
|
||||
if(shelflife>=0) {
|
||||
sql+=",PURGE_DATE=\""+
|
||||
QDate::currentDate().addDays(shelflife).toString("yyyy-MM-dd")+"\"";
|
||||
switch(shelforigin) {
|
||||
case RDSvc::OriginCreationDate:
|
||||
sql+=",PURGE_DATE=\""+
|
||||
QDate::currentDate().addDays(shelflife).toString("yyyy-MM-dd")+"\"";
|
||||
break;
|
||||
|
||||
case RDSvc::OriginAirDate:
|
||||
if(air_date.isValid()) {
|
||||
sql+=",PURGE_DATE=\""+
|
||||
air_date.addDays(shelflife).toString("yyyy-MM-dd")+"\"";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->isActive()) {
|
||||
|
||||
@@ -79,8 +79,8 @@ class RDLog
|
||||
RDLogEvent *createLogEvent() const;
|
||||
QString xml() const;
|
||||
static bool create(const QString &name,const QString &svc_name,
|
||||
const QString &user_name,QString *err_msg,
|
||||
RDConfig *config);
|
||||
const QDate &air_date,const QString &user_name,
|
||||
QString *err_msg,RDConfig *config);
|
||||
static bool exists(const QString &name);
|
||||
static bool remove(const QString &name,RDStation *station,RDUser *user,
|
||||
RDConfig *config);
|
||||
|
||||
@@ -158,6 +158,19 @@ void RDSvc::setDefaultLogShelflife(int days) const
|
||||
}
|
||||
|
||||
|
||||
RDSvc::ShelflifeOrigin RDSvc::logShelflifeOrigin() const
|
||||
{
|
||||
return (RDSvc::ShelflifeOrigin)RDGetSqlValue("SERVICES","NAME",svc_name,
|
||||
"LOG_SHELFLIFE_ORIGIN").toInt();
|
||||
}
|
||||
|
||||
|
||||
void RDSvc::setLogShelflifeOrigin(RDSvc::ShelflifeOrigin orig)
|
||||
{
|
||||
SetRow("LOG_SHELFLIFE_ORIGIN",(int)orig);
|
||||
}
|
||||
|
||||
|
||||
int RDSvc::elrShelflife() const
|
||||
{
|
||||
return RDGetSqlValue("SERVICES","NAME",svc_name,"ELR_SHELFLIFE").toInt();
|
||||
@@ -737,7 +750,7 @@ bool RDSvc::generateLog(const QDate &date,const QString &logname,
|
||||
RDLog::remove(logname,svc_station,user,svc_config);
|
||||
delete log_lock;
|
||||
}
|
||||
RDLog::create(logname,svc_name,"RDLogManager",err_msg,svc_config);
|
||||
RDLog::create(logname,svc_name,date,"RDLogManager",err_msg,svc_config);
|
||||
log_lock=new RDLogLock(logname,user,svc_station,this);
|
||||
if(!TryLock(log_lock,err_msg)) {
|
||||
delete log_lock;
|
||||
|
||||
@@ -40,6 +40,7 @@ class RDSvc : public QObject
|
||||
enum ImportField {CartNumber=0,ExtData=3,ExtEventId=4,ExtAnncType=5,
|
||||
Title=6,StartHours=7,StartMinutes=8,StartSeconds=9,
|
||||
LengthHours=10,LengthMinutes=11,LengthSeconds=12};
|
||||
enum ShelflifeOrigin {OriginAirDate=0,OriginCreationDate=1};
|
||||
RDSvc(QString svcname,RDStation *station,RDConfig *config,QObject *parent=0);
|
||||
QString name() const;
|
||||
bool exists() const;
|
||||
@@ -59,6 +60,8 @@ class RDSvc : public QObject
|
||||
void setAutoRefresh(bool state);
|
||||
int defaultLogShelflife() const;
|
||||
void setDefaultLogShelflife(int days) const;
|
||||
ShelflifeOrigin logShelflifeOrigin() const;
|
||||
void setLogShelflifeOrigin(ShelflifeOrigin orig);
|
||||
int elrShelflife() const;
|
||||
void setElrShelflife(int days) const;
|
||||
bool chainto() const;
|
||||
|
||||
Reference in New Issue
Block a user