Time registration

Registration over midnight

Registrations over midnight, are governed by a strategy saved in the property Registration,midnight_strategy. There are three strategies:

Registration::MIDNIGHT_STRATEGY_SPLIT

In this case registrations over midnight isn't allowed. When entered directly into the system, they shouldn't be allowed and when derived from checkins they should be split at midnight.

Registration::MIDNIGHT_STRATEGY_FIRSTDAY

In this case registrations over midnight is considered to belong to the first date in question. Time registered on January 15th from 23:00 to 02:00 is considered to carry into January 16th but is all registered to January 15th.

Registration::MIDNIGHT_STRATEGY_SECONDAY

In this case registrations over midnight is considered to belong to the second date in question. Time registered on January 15th from 23:00 to 02:00 is considered to be carried from January 14th but is all assigned to January 15th.


Daily loop

There is a daily administrative loop as follows. It is handled in the daily bookkeeping-script /job/manual/bookkeeping.php/ with the following functions Registration::openForToday(), Registration::handleAutoCloseApprove() and some inline code.


OpenForToday

This function is intended to run early in the day.

First all users that are required to register time is selected and then a RegistrationDay is created for each user on todays date, which is the same as demanding a time registration for the day.

Workplan integration

If the workplan module is installed this is examined and a RegistrationDay is only created if the user is expected to be at work (status corresponds to WORK or OUT)

The workplan can be configured to make certain automatic hour registrations based on what is selected in the plan. This can be an internal registration or a registration on a certain task.

This is accomplished by a rewrite which is obtained by calling

$rewrite = WorkplanRegType::getRewrite($planreg);

with the Workplan registration and then

Registration::reRegisterToInternal($userid, $date, $rewrite);

which handles the registration. Such a rewrite will always close and approve the day.


Handling automatic registration

The next step is handling people who are setup for automatic registration, where the production planning from the day before is copied to the time sheet as registrations.

This is handled directly in the bookkeeping-script, by getting all automatic users and then copying the information

$userids = Registration::getAutomatics();
foreach ($userids as $userid) {
  Prodplan::sendUserToRegistration($date, $userid, $daystate);
}

It is possible to configure in Microbizz if these registrations should be open, closed or approved, which is saved in the Module setting registration,autoregistrationclosestate


handleAutoCloseApprove

At last automatic closing and approving of time sheets is handled through the Registration::handleAutoCloseApprove() function. This will automatically close and/or approve time sheets.

This can be configured for either automatic registrations or all registrations (registration,autoclosetarget), and be configured X days after the registration day.

If automatic closing is setup it will close any open time sheet from X days before. (registration,delayautoclose)

If automatic approving is setup it will close and approve any non-approved time sheet from X days before. (registration,delayautoapprove)


See also

Registration

Registration approval