CmdTimesheet: Add ability to specify if context should be used

This makes timesheet consistent with other report commands.
This commit is contained in:
Tomas Babej 2021-08-20 20:51:44 -04:00
parent ab29ef8326
commit 5309132add
2 changed files with 17 additions and 0 deletions

View file

@ -53,6 +53,22 @@ CmdTimesheet::CmdTimesheet ()
_category = Command::Category::report;
}
////////////////////////////////////////////////////////////////////////////////
// Whether a the timesheet uses context is defined by the
// report.timesheet.context configuration variable.
//
bool CmdTimesheet::uses_context () const
{
auto config = Context::getContext ().config;
auto key = "report.timesheet.context";
if (config.has (key))
return config.getBoolean (key);
else
return _uses_context;
}
////////////////////////////////////////////////////////////////////////////////
int CmdTimesheet::execute (std::string& output)
{

View file

@ -35,6 +35,7 @@ class CmdTimesheet : public Command
public:
CmdTimesheet ();
int execute (std::string&);
bool uses_context () const override;
};
#endif