void ScheduleDialog::setSchedule( const Schedule & schedule )
{
	mSchedule = schedule;
	setWindowTitle( "Modify Schedule..." );
	mDateEndEdit->setEnabled( false );
	setDateRange( schedule.date(), schedule.date() );
//	setAssetType( schedule.assetType() );
	setElement( schedule.element(), schedule.assetType() );
	setEmployee( schedule.user() );
	mHoursSpin->setValue( schedule.duration().hours() );
}
void TimeEntryDialog::setupSuggestedTimeSheet()
{
	VarList v;
	v += QDate::currentDate();
	v += User::currentUser().key();
	ScheduleList sl = Schedule::select( "date = ? and fkeyuser = ?", v );
	if( !sl.isEmpty() ) {
		Schedule s = sl[0];
		setElementList( s.element() );
	} else {
		TimeSheetList recent = TimeSheet::select( "fkeyemployee=? order by dateTime desc limit 1", VarList() += User::currentUser().key() );
		if( !recent.isEmpty() ) {
			TimeSheet ts = recent[0];
			setProject( ts.project() );
			setAssetType( ts.assetType() );
			setElementList( ts.element() );
		}
	}
}
Beispiel #3
0
// TODO: complete this to work. Or determine how to do this.
void TestModels::test_ModelAPIs_currentSchedule()
{
    Schedule* sch = ModelAPIs::currentSchedule("running");
    QVERIFY(sch->element()->name() == "running");
    QVERIFY(ModelAPIs::currentSchedule("noName") == 0);
}