summaryrefslogtreecommitdiff
path: root/src/timelog.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/timelog.cc')
-rw-r--r--src/timelog.cc41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/timelog.cc b/src/timelog.cc
index 217aa581..698e2420 100644
--- a/src/timelog.cc
+++ b/src/timelog.cc
@@ -41,8 +41,9 @@ namespace ledger {
namespace {
void clock_out_from_timelog(std::list<time_xact_t>& time_xacts,
- time_xact_t out_event,
- journal_t& journal)
+ time_xact_t out_event,
+ journal_t& journal,
+ scope_t& scope)
{
time_xact_t event;
@@ -55,29 +56,29 @@ namespace {
}
else if (! out_event.account) {
throw parse_error
- (_("When multiple check-ins are active, checking out requires an account"));
+ (_("When multiple check-ins are active, checking out requires an account"));
}
else {
bool found = false;
for (std::list<time_xact_t>::iterator i = time_xacts.begin();
- i != time_xacts.end();
- i++)
- if (out_event.account == (*i).account) {
- event = *i;
- found = true;
- time_xacts.erase(i);
- break;
- }
+ i != time_xacts.end();
+ i++)
+ if (out_event.account == (*i).account) {
+ event = *i;
+ found = true;
+ time_xacts.erase(i);
+ break;
+ }
if (! found)
- throw parse_error
- (_("Timelog check-out event does not match any current check-ins"));
+ throw parse_error
+ (_("Timelog check-out event does not match any current check-ins"));
}
if (out_event.checkin < event.checkin)
throw parse_error
- (_("Timelog check-out date less than corresponding check-in"));
+ (_("Timelog check-out date less than corresponding check-in"));
if (! out_event.desc.empty() && event.desc.empty()) {
event.desc = out_event.desc;
@@ -94,11 +95,11 @@ namespace {
curr->pos = event.position;
if (! event.note.empty())
- curr->append_note(event.note.c_str());
+ curr->append_note(event.note.c_str(), scope);
char buf[32];
std::sprintf(buf, "%lds", long((out_event.checkin - event.checkin)
- .total_seconds()));
+ .total_seconds()));
amount_t amt;
amt.parse(buf);
VERIFY(amt.valid());
@@ -128,8 +129,8 @@ time_log_t::~time_log_t()
foreach (account_t * account, accounts)
clock_out_from_timelog(time_xacts,
- time_xact_t(none, CURRENT_TIME(), account),
- journal);
+ time_xact_t(none, CURRENT_TIME(), account),
+ journal, scope);
assert(time_xacts.empty());
}
@@ -140,7 +141,7 @@ void time_log_t::clock_in(time_xact_t event)
if (! time_xacts.empty()) {
foreach (time_xact_t& time_xact, time_xacts) {
if (event.account == time_xact.account)
- throw parse_error(_("Cannot double check-in to the same account"));
+ throw parse_error(_("Cannot double check-in to the same account"));
}
}
@@ -152,7 +153,7 @@ void time_log_t::clock_out(time_xact_t event)
if (time_xacts.empty())
throw std::logic_error(_("Timelog check-out event without a check-in"));
- clock_out_from_timelog(time_xacts, event, journal);
+ clock_out_from_timelog(time_xacts, event, journal, scope);
}
} // namespace ledger