CmdTimesheet: Add ability to specify if context should be used
This makes timesheet consistent with other report commands.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ class CmdTimesheet : public Command
|
||||
public:
|
||||
CmdTimesheet ();
|
||||
int execute (std::string&);
|
||||
bool uses_context () const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user