| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ************************************************************************* |
|
2
|
|
|
|
|
|
|
# Copyright (c) 2014-2015, SUSE LLC |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# All rights reserved. |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Redistribution and use in source and binary forms, with or without |
|
7
|
|
|
|
|
|
|
# modification, are permitted provided that the following conditions are met: |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# 1. Redistributions of source code must retain the above copyright notice, |
|
10
|
|
|
|
|
|
|
# this list of conditions and the following disclaimer. |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright |
|
13
|
|
|
|
|
|
|
# notice, this list of conditions and the following disclaimer in the |
|
14
|
|
|
|
|
|
|
# documentation and/or other materials provided with the distribution. |
|
15
|
|
|
|
|
|
|
# |
|
16
|
|
|
|
|
|
|
# 3. Neither the name of SUSE LLC nor the names of its contributors may be |
|
17
|
|
|
|
|
|
|
# used to endorse or promote products derived from this software without |
|
18
|
|
|
|
|
|
|
# specific prior written permission. |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
21
|
|
|
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
22
|
|
|
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
23
|
|
|
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
|
24
|
|
|
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
25
|
|
|
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
26
|
|
|
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
27
|
|
|
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
28
|
|
|
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
29
|
|
|
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
30
|
|
|
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE. |
|
31
|
|
|
|
|
|
|
# ************************************************************************* |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# ------------------------ |
|
34
|
|
|
|
|
|
|
# Model module |
|
35
|
|
|
|
|
|
|
# ------------------------ |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
package App::Dochazka::Common; |
|
38
|
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
|
64296
|
use 5.012; |
|
|
1
|
|
|
|
|
4
|
|
|
40
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
41
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
6
|
use Exporter 'import'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
26
|
|
|
44
|
1
|
|
|
1
|
|
506
|
use Time::Piece; |
|
|
1
|
|
|
|
|
11911
|
|
|
|
1
|
|
|
|
|
4
|
|
|
45
|
1
|
|
|
1
|
|
71
|
use Time::Seconds; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
234
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
App::Dochazka::Common - Dochazka Attendance and Time Tracking System shared modules |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 VERSION |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Version 0.209 |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
our $VERSION = '0.209'; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Sic transit gloria mundi. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This distro contains modules that are used by both the server |
|
77
|
|
|
|
|
|
|
L and the command-line client L. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DOCHAZKA DATA MODEL |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This section describes the Dochazka data model. Conceptually, Dochazka data |
|
85
|
|
|
|
|
|
|
can be seen to exist in the following classes of objects, all of which are |
|
86
|
|
|
|
|
|
|
implemented by this module: |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
##=item * Policy (parameters set when database is first created) |
|
91
|
|
|
|
|
|
|
## |
|
92
|
|
|
|
|
|
|
=item * Employee (an individual employee) |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * Privhistory (history of changes in an employee's privilege level) |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * Schedule (a schedule) |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * Schedhistory (history of changes in an employee's schedule) |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * Activities (what kinds of work are recognized) |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item * Intervals (the "work", or "attendance", itself) |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * Locks (determining whether a reporting period is locked or not) |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item * Components (Mason components, i.e. report templates) |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=back |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
These classes are described in the following sections. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
##=head2 Policy |
|
114
|
|
|
|
|
|
|
## |
|
115
|
|
|
|
|
|
|
##Dochazka is configurable in a number of ways. Some configuration parameters |
|
116
|
|
|
|
|
|
|
##are set once at installation time and, once set, can never be changed -- |
|
117
|
|
|
|
|
|
|
##these are referred to as "site policy" parameters. Others, referred to as |
|
118
|
|
|
|
|
|
|
##"site configuration parameters" or "site params", are set in configuration |
|
119
|
|
|
|
|
|
|
##files such as C (see L) and |
|
120
|
|
|
|
|
|
|
##can be changed more-or-less at will. |
|
121
|
|
|
|
|
|
|
## |
|
122
|
|
|
|
|
|
|
##The key difference between site policy and site configuration is that |
|
123
|
|
|
|
|
|
|
##site policy parameters cannot be changed, because changing them would |
|
124
|
|
|
|
|
|
|
##compromise the referential integrity of the underlying database. |
|
125
|
|
|
|
|
|
|
## |
|
126
|
|
|
|
|
|
|
##Site policy parameters are set at installation time and are stored, as a |
|
127
|
|
|
|
|
|
|
##single JSON string, in the C table. This table is rendered |
|
128
|
|
|
|
|
|
|
##effectively immutable by a trigger. |
|
129
|
|
|
|
|
|
|
## |
|
130
|
|
|
|
|
|
|
##For details, see L. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 Employee |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Users of Dochazka are referred to as "employees" regardless of their |
|
136
|
|
|
|
|
|
|
legal status -- in reality they might be independent contractors, or |
|
137
|
|
|
|
|
|
|
students, or even household pets, but as far as Dochazka is concerned they |
|
138
|
|
|
|
|
|
|
are employees. You could say that "employee" is the Dochazka term for "user". |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The purpose of the Employee table/object is to store whatever data the site |
|
141
|
|
|
|
|
|
|
is accustomed to use to identify its employees. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Within Dochazka itself, employees are distinguished by an internal employee ID |
|
144
|
|
|
|
|
|
|
number (EID), which is assigned by Dochazka itself when the employee record is |
|
145
|
|
|
|
|
|
|
created. In addition, four other fields/properties are provided to identify |
|
146
|
|
|
|
|
|
|
the employee: |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=over |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * nick |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * sec_id |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item * fullname |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * email |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=back |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
All four of these, plus the C field, have C constraints defined at |
|
161
|
|
|
|
|
|
|
the database level, meaning that duplicate entries are not permitted. However, |
|
162
|
|
|
|
|
|
|
of the four, only C is required. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Depending on how authentication is set up, employee passwords may also be |
|
165
|
|
|
|
|
|
|
stored in this table, using the C and C fields. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
For details, see L. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 Privhistory |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Dochazka has four privilege levels: C, C, C, and |
|
173
|
|
|
|
|
|
|
C: |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=over |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * C -- employee can view, modify, and place/remove locks on her |
|
178
|
|
|
|
|
|
|
own attendance data as well as that of other employees; she can also |
|
179
|
|
|
|
|
|
|
administer employee accounts and set privilege levels of other employees |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=item * C -- employee can view her own profile, attendance data, |
|
182
|
|
|
|
|
|
|
modify her own unlocked attendance data, and place locks on her attendance |
|
183
|
|
|
|
|
|
|
data |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item * C -- employee can view her own profile and attendance data |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * C -- employee can view her own profile |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=back |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Dochazka's C object is used to track changes in an employee's |
|
192
|
|
|
|
|
|
|
privilege level over time. Each time an employee's privilege level changes, |
|
193
|
|
|
|
|
|
|
a Dochazka administrator (i.e., an employee whose current privilege level is |
|
194
|
|
|
|
|
|
|
'admin'), a record is inserted into the database (in the C |
|
195
|
|
|
|
|
|
|
table). Ordinary employees (i.e. those whose current privilege level is |
|
196
|
|
|
|
|
|
|
'active') can read their own privhistory. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Thus, with Dochazka it is possible not only to determine not only an employee's |
|
199
|
|
|
|
|
|
|
current privilege level, but also to view "privilege histories" and to |
|
200
|
|
|
|
|
|
|
determine employees' privilege levels for any date (timestamp) in the past. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
For details, see L and L
|
|
203
|
|
|
|
|
|
|
history changes take effect>. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head2 Schedule |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
In addition to actual attendance data, Dochazka sites may need to store |
|
209
|
|
|
|
|
|
|
schedules. Dochazka defines the term "schedule" as a series of |
|
210
|
|
|
|
|
|
|
non-overlapping "time intervals" (or "timestamp ranges" in PostgreSQL |
|
211
|
|
|
|
|
|
|
terminology) falling within a single week. These time intervals express the |
|
212
|
|
|
|
|
|
|
times when the employee is "expected" or "supposed" to work (or be "at work") |
|
213
|
|
|
|
|
|
|
during the scheduling period. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Example: employee "Barb" is on a weekly schedule. That means her |
|
216
|
|
|
|
|
|
|
scheduling period is "weekly" and her schedule is an array of |
|
217
|
|
|
|
|
|
|
non-overlapping time intervals, all falling within a single week. |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
B
|
|
220
|
|
|
|
|
|
|
only.> Some sites, such as hospitals, nuclear power plants, fire departments, |
|
221
|
|
|
|
|
|
|
and the like, might have employees on more complicated schedules such as "one |
|
222
|
|
|
|
|
|
|
week on, one week off", alternating day and night shifts, "on call" duty, etc. |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Dochazka can still be used to track attendance of such employees, but if their |
|
225
|
|
|
|
|
|
|
work schedule cannot be expressed as a series of non-overlapping time intervals |
|
226
|
|
|
|
|
|
|
contained within a contiguous 168-hour period (i.e. one week), then their |
|
227
|
|
|
|
|
|
|
Dochazka schedule should be set to NULL. |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
For details, see L. |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head2 Schedhistory |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
The C table contains a historical record of changes in the |
|
235
|
|
|
|
|
|
|
employee's schedule. This makes it possible to determine an employee's |
|
236
|
|
|
|
|
|
|
schedule for any date (timestamp) in the past, as well as (crucially) the |
|
237
|
|
|
|
|
|
|
employee's current schedule. |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Every time an employee's schedule is to change, a Dochazka administrator |
|
240
|
|
|
|
|
|
|
must insert a record into this table. (Employees who are not administrators |
|
241
|
|
|
|
|
|
|
can only read their own history; they do not have write privileges.) For |
|
242
|
|
|
|
|
|
|
more information on privileges, see L. |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
For details, see L. |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head2 Activity |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
While on the job, employees "work" -- i.e., they engage in various activities |
|
250
|
|
|
|
|
|
|
that are tracked using Dochazka. The C table contains definitions |
|
251
|
|
|
|
|
|
|
of all the possible activities that may be entered in the C table. |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
The initial set of activities is defined in the site install configuration |
|
254
|
|
|
|
|
|
|
(C) and enters the database at installation |
|
255
|
|
|
|
|
|
|
time. Additional activities can be added later (by administrators), but |
|
256
|
|
|
|
|
|
|
activities can be deleted only if no intervals refer to them. |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Each activity has a code, or short name (e.g., "WORK") -- which is the |
|
259
|
|
|
|
|
|
|
primary way of referring to the activity -- as well as an optional long |
|
260
|
|
|
|
|
|
|
description. Activity codes must be all upper-case. |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
For details, see L. |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 Interval |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
Intervals are the heart of Dochazka's attendance data. For Dochazka, an |
|
268
|
|
|
|
|
|
|
interval is an amount of time that an employee spends doing an activity. |
|
269
|
|
|
|
|
|
|
In the database, intervals are represented using the C range |
|
270
|
|
|
|
|
|
|
operator introduced in PostgreSQL 9.2. |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Optionally, an interval can have a C (employee's description |
|
273
|
|
|
|
|
|
|
of what she did during the interval) and a C (admin remark). |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
For details, see L. |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 Lock |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
In Dochazka, a "lock" is a record in the "locks" table specifying that |
|
281
|
|
|
|
|
|
|
a particular user's attendance data (i.e. activity intervals) for a |
|
282
|
|
|
|
|
|
|
given period (tsrange) cannot be changed. That means, for intervals in |
|
283
|
|
|
|
|
|
|
the locked tsrange: |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=over |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=item * existing intervals cannot be updated or deleted |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=item * no new intervals can be inserted |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=back |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Employees can create locks (i.e., insert records into the locks table) on their |
|
294
|
|
|
|
|
|
|
own EID, but they cannot delete or update those locks (or any others). |
|
295
|
|
|
|
|
|
|
Administrators can insert, update, or delete locks at will. |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
How the lock is used will differ from site to site, and some sites may not |
|
298
|
|
|
|
|
|
|
even use locking at all. The typical use case would be to lock all the |
|
299
|
|
|
|
|
|
|
employee's attendance data within the given period as part of pre-payroll |
|
300
|
|
|
|
|
|
|
processing. For example, the Dochazka client application may be set up to |
|
301
|
|
|
|
|
|
|
enable reports to be generated only on fully locked periods. |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
"Fully locked" means either that a single lock record has been inserted |
|
304
|
|
|
|
|
|
|
covering the entire period, or that the entire period is covered by multiple |
|
305
|
|
|
|
|
|
|
locks. |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Any attempts (even by administrators) to enter activity intervals that |
|
308
|
|
|
|
|
|
|
intersect an existing lock will result in an error. |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
Clients can of course make it easy for the employee to lock entire blocks |
|
311
|
|
|
|
|
|
|
of time (weeks, months, years . . .) at once, if that is deemed expedient. |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
For details, see L. |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=head2 Component |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
L from |
|
319
|
|
|
|
|
|
|
L templates which consist of |
|
320
|
|
|
|
|
|
|
components. Mason expects these components to be stored in text files under |
|
321
|
|
|
|
|
|
|
a directory called the "component root". For the purposes of Dochazka, the |
|
322
|
|
|
|
|
|
|
component root is created under the Dochazka state directory, which is |
|
323
|
|
|
|
|
|
|
determined from the C site parameter (defaults to |
|
324
|
|
|
|
|
|
|
C). When the server starts, this Mason state in the |
|
325
|
|
|
|
|
|
|
filesystem is wiped and re-created from the database. The C |
|
326
|
|
|
|
|
|
|
class is used to manipulate Mason components. |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
This rather complicated setup is designed to enable administrators to |
|
329
|
|
|
|
|
|
|
develop their own report templates. |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=head1 PACKAGE VARIABLES AND EXPORTS |
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=cut |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
our ( $t, $today, $yesterday, $tomorrow ); |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
|
340
|
|
|
|
|
|
|
$t |
|
341
|
|
|
|
|
|
|
$today |
|
342
|
|
|
|
|
|
|
$yesterday |
|
343
|
|
|
|
|
|
|
$tomorrow |
|
344
|
|
|
|
|
|
|
init_timepiece |
|
345
|
|
|
|
|
|
|
); |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=head2 init_timepiece |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
(Re-)initialize the date/time-related package variables |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=cut |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
sub init_timepiece { |
|
359
|
|
|
|
|
|
|
#print "Entering " . __PACKAGE__ . "::init_timepiece\n"; |
|
360
|
0
|
|
|
0
|
1
|
|
$t = localtime; |
|
361
|
0
|
|
|
|
|
|
$today = $t->ymd; |
|
362
|
0
|
|
|
|
|
|
$yesterday = ($t - ONE_DAY)->ymd; |
|
363
|
0
|
|
|
|
|
|
$tomorrow = ($t + ONE_DAY)->ymd; |
|
364
|
|
|
|
|
|
|
} |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
1; |